diff --git a/docs/conf.py b/docs/conf.py index 82098a168..3b96c5017 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -188,7 +188,7 @@ latex_documents = [ "cookiecutter-django Documentation", "cookiecutter-django", "manual", - ) + ), ] # The name of an image file (relative to this directory) to place at the top of @@ -223,7 +223,7 @@ man_pages = [ "Cookiecutter Django documentation", ["Daniel Roy Greenfeld"], 1, - ) + ), ] # If true, show URL addresses after external links. @@ -242,9 +242,9 @@ texinfo_documents = [ "Cookiecutter Django documentation", "Daniel Roy Greenfeld", "Cookiecutter Django", - "A Cookiecutter template for creating production-ready " "Django projects quickly.", + "A Cookiecutter template for creating production-ready Django projects quickly.", "Miscellaneous", - ) + ), ] # Documents to append as an appendix to all manuals. diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 57e520924..55c9f1ace 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -39,7 +39,7 @@ def remove_custom_user_manager_files(): "{{cookiecutter.project_slug}}", "users", "managers.py", - ) + ), ) os.remove( os.path.join( @@ -47,7 +47,7 @@ def remove_custom_user_manager_files(): "users", "tests", "test_managers.py", - ) + ), ) @@ -132,7 +132,7 @@ def update_package_json(remove_dev_deps=None, remove_keys=None, scripts=None): remove_dev_deps = remove_dev_deps or [] remove_keys = remove_keys or [] scripts = scripts or {} - with open("package.json", mode="r") as fd: + with open("package.json") as fd: content = json.load(fd) for package_name in remove_dev_deps: content["devDependencies"].pop(package_name) @@ -196,7 +196,7 @@ def handle_js_runner(choice, use_docker, use_async): "dev": "concurrently npm:dev:*", "dev:webpack": "webpack serve --config webpack/dev.config.js", "dev:django": dev_django_cmd, - } + }, ) else: remove_dev_deps.append("concurrently") @@ -205,7 +205,7 @@ def handle_js_runner(choice, use_docker, use_async): def remove_prettier_pre_commit(): - with open(".pre-commit-config.yaml", "r") as fd: + with open(".pre-commit-config.yaml") as fd: content = fd.readlines() removing = False @@ -286,7 +286,7 @@ def set_flag(file_path, flag, value=None, formatted=None, *args, **kwargs): if random_string is None: print( "We couldn't find a secure pseudo-random number generator on your " - "system. Please, make sure to manually {} later.".format(flag) + f"system. Please, make sure to manually {flag} later.", ) random_string = flag if formatted is not None: @@ -464,7 +464,7 @@ def main(): print( INFO + ".env(s) are only utilized when Docker Compose and/or " "Heroku support is enabled so keeping them does not make sense " - "given your current setup." + TERMINATOR + "given your current setup." + TERMINATOR, ) remove_envs_and_associated_files() else: @@ -491,7 +491,7 @@ def main(): if "{{ cookiecutter.cloud_provider }}" == "None" and "{{ cookiecutter.use_docker }}".lower() == "n": print( WARNING + "You chose to not use any cloud providers nor Docker, " - "media files won't be served in production." + TERMINATOR + "media files won't be served in production." + TERMINATOR, ) if "{{ cookiecutter.use_celery }}".lower() == "n": diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 1e0c591ef..c2d6b7cd8 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -16,9 +16,9 @@ SUCCESS = "\x1b[1;32m [SUCCESS]: " project_slug = "{{ cookiecutter.project_slug }}" if hasattr(project_slug, "isidentifier"): - assert project_slug.isidentifier(), "'{}' project slug is not a valid Python identifier.".format(project_slug) + assert project_slug.isidentifier(), f"'{project_slug}' project slug is not a valid Python identifier." -assert project_slug == project_slug.lower(), "'{}' project slug should be all lowercase".format(project_slug) +assert project_slug == project_slug.lower(), f"'{project_slug}' project slug should be all lowercase" assert "\\" not in "{{ cookiecutter.author_name }}", "Don't include backslashes in author name." diff --git a/scripts/create_django_issue.py b/scripts/create_django_issue.py index 2e59f18b0..1fa1bcf96 100644 --- a/scripts/create_django_issue.py +++ b/scripts/create_django_issue.py @@ -14,7 +14,9 @@ import re import sys from collections.abc import Iterable from pathlib import Path -from typing import TYPE_CHECKING, Any, NamedTuple +from typing import TYPE_CHECKING +from typing import Any +from typing import NamedTuple import requests from github import Github @@ -221,8 +223,7 @@ class GitHubManager: if supported_dj_versions: if any(v >= needed_dj_version for v in supported_dj_versions): return package_info["info"]["version"], "✅" - else: - return "", "❌" + return "", "❌" # Django classifier DNE; assume it isn't a Django lib # Great exceptions include pylint-django, where we need to do this manually... diff --git a/scripts/update_changelog.py b/scripts/update_changelog.py index 1bedebf5a..63c8960a3 100644 --- a/scripts/update_changelog.py +++ b/scripts/update_changelog.py @@ -54,7 +54,7 @@ def main() -> None: # Run uv lock uv_lock_path = ROOT / "uv.lock" - subprocess.run(["uv", "lock", "--no-upgrade"], cwd=ROOT) + subprocess.run(["uv", "lock", "--no-upgrade"], cwd=ROOT, check=False) # Commit changes, create tag and push update_git_repo([changelog_path, setup_py_path, uv_lock_path], release) diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index 9669d78ba..33289bdea 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -315,7 +315,7 @@ def test_gitlab_invokes_precommit_and_pytest(cookies, context, use_docker, expec try: gitlab_config = yaml.safe_load(gitlab_yml) assert gitlab_config["precommit"]["script"] == [ - "pre-commit run --show-diff-on-failure --color=always --all-files" + "pre-commit run --show-diff-on-failure --color=always --all-files", ] assert gitlab_config["pytest"]["script"] == [expected_test_script] except yaml.YAMLError as e: @@ -401,7 +401,7 @@ def test_trim_domain_email(cookies, context): "use_docker": "y", "domain_name": " example.com ", "email": " me@example.com ", - } + }, ) result = cookies.bake(extra_context=context) diff --git a/tests/test_hooks.py b/tests/test_hooks.py index 2ccac84b2..c8d503426 100644 --- a/tests/test_hooks.py +++ b/tests/test_hooks.py @@ -8,7 +8,7 @@ import pytest from hooks.post_gen_project import append_to_gitignore_file -@pytest.fixture() +@pytest.fixture def working_directory(tmp_path): prev_cwd = Path.cwd() os.chdir(tmp_path)