style: activate string normalization

This commit is contained in:
Henry Schreiner
2021-05-03 13:12:36 -04:00
committed by Henry Schreiner
parent d1900f6a05
commit bda76b21cb
54 changed files with 1598 additions and 1599 deletions
+18 -18
View File
@@ -8,42 +8,42 @@ from pathlib import Path
def main():
parser = ArgumentParser(
prog="python -m test.test_projects", description='Generate a test project to check it out'
prog="python -m test.test_projects", description="Generate a test project to check it out"
)
parser.add_argument(
'--open',
action='store_true',
help='Open the generated project in a file explorer',
"--open",
action="store_true",
help="Open the generated project in a file explorer",
)
parser.add_argument(
'PROJECT',
help='Python path to a project object. E.g. test.test_0_basic.basic_project',
"PROJECT",
help="Python path to a project object. E.g. test.test_0_basic.basic_project",
)
parser.add_argument(
'OUTPUT',
nargs='?',
help='Path to output dir. If no dir is passed, a tempdir will be generated.',
"OUTPUT",
nargs="?",
help="Path to output dir. If no dir is passed, a tempdir will be generated.",
)
options = parser.parse_args()
module, _, name = options.PROJECT.rpartition('.')
module, _, name = options.PROJECT.rpartition(".")
project = getattr(importlib.import_module(module), name)
project_dir = Path(options.OUTPUT or tempfile.mkdtemp())
project.generate(project_dir)
print('Project generated at', project_dir)
print("Project generated at", project_dir)
print()
if options.open:
if sys.platform == 'darwin':
subprocess.run(['open', '--', project_dir], check=True)
elif sys.platform == 'linux2':
subprocess.run(['xdg-open', '--', project_dir], check=True)
elif sys.platform == 'win32':
subprocess.run(['explorer', project_dir], check=True)
if sys.platform == "darwin":
subprocess.run(["open", "--", project_dir], check=True)
elif sys.platform == "linux2":
subprocess.run(["xdg-open", "--", project_dir], check=True)
elif sys.platform == "win32":
subprocess.run(["explorer", project_dir], check=True)
if __name__ == '__main__':
if __name__ == "__main__":
main()