From 819378ad82796d8cf4d69282a1cebd803f9cd649 Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Tue, 26 Jul 2022 00:31:20 +0000 Subject: [PATCH] 'Refactored by Sourcery' --- hooks/post_gen_project.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 3f60bb7..7fcead0 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -3,7 +3,7 @@ def set_python_version(): - python_version = str(sys.version_info.major) + "." + str(sys.version_info.minor) + python_version = f"{str(sys.version_info.major)}.{str(sys.version_info.minor)}" file_names = ["Dockerfile", "Pipfile", ".github/workflows/test.yml"] for file_name in file_names: @@ -15,8 +15,8 @@ def set_python_version(): def remove_main_if_lib(): is_lib = '{{ cookiecutter.binary }}' - main_file_path = os.path.join('{{ cookiecutter.repo_name }}', '__main__.py') - if not (is_lib == "y" or is_lib == "Y"): + if is_lib not in {"y", "Y"}: + main_file_path = os.path.join('{{ cookiecutter.repo_name }}', '__main__.py') os.remove(main_file_path) print(main_file_path) @@ -28,7 +28,7 @@ def remove_main_if_lib(): def main(): set_python_version() remove_main_if_lib() - print(SUCCESS + "Project successfully initialized" + TERMINATOR) + print(f"{SUCCESS}Project successfully initialized{TERMINATOR}") if __name__ == "__main__":