diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2cca3e8..54926ef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,12 +32,6 @@ repos: args: ["--config=setup.cfg"] additional_dependencies: [flake8-isort] - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.0.0 - hooks: - - id: mypy - args: ["--config=setup.cfg"] - # sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date ci: autoupdate_schedule: weekly diff --git a/README.md b/README.md index 42c04ae..9c41261 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,11 @@ $ docker-compose -f local.yml up ``` - server - http://127.0.0.1:8000 - mail - http://127.0.0.1:8025 + + +### refactoring code +```shell +$ black akarpov +$ no_implicit_optional akarpov +$ mypy --config-file setup.cfg akarpov +``` diff --git a/akarpov/files/services/preview.py b/akarpov/files/services/preview.py index 44550e0..82d0e8b 100644 --- a/akarpov/files/services/preview.py +++ b/akarpov/files/services/preview.py @@ -25,7 +25,7 @@ def textfile_to_image(textfile_path) -> Image: with open(textfile_path) as f: lines = tuple(line.rstrip() for line in f.readlines()) - font = None + font: ImageFont = None large_font = 20 # get better resolution with larger size for font_filename in COMMON_MONO_FONT_FILENAMES: try: diff --git a/akarpov/tools/qr/services/simple.py b/akarpov/tools/qr/services/simple.py index c8e6c77..f315dcd 100644 --- a/akarpov/tools/qr/services/simple.py +++ b/akarpov/tools/qr/services/simple.py @@ -8,7 +8,7 @@ from akarpov.utils.generators import generate_charset -def run(words: str, path: str = "/tmp/", user: User = None) -> QR: +def run(words: str, path: str = "/tmp/", user: User | None = None) -> QR: version, level, qr_name = amzqr.run( words, version=1, diff --git a/merge_production_dotenvs_in_dotenv.py b/merge_production_dotenvs_in_dotenv.py index d702a5f..1651b1d 100644 --- a/merge_production_dotenvs_in_dotenv.py +++ b/merge_production_dotenvs_in_dotenv.py @@ -26,7 +26,7 @@ def merge( def main(): - merge(DOTENV_FILE_PATH, PRODUCTION_DOTENV_FILE_PATHS) + merge(str(DOTENV_FILE_PATH), str(PRODUCTION_DOTENV_FILE_PATHS)) @pytest.mark.parametrize("merged_file_count", range(3)) diff --git a/poetry.lock b/poetry.lock index 029c945..c43bf46 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1385,7 +1385,10 @@ files = [ [package.dependencies] django-stubs = ">=1.13.0" -mypy = ">=0.980" +mypy = [ + {version = ">=0.980"}, + {version = ">=0.991,<0.1000", optional = true, markers = "extra == \"compatible-mypy\""}, +] requests = ">=2.0.0" types-PyYAML = ">=5.4.3" types-requests = ">=0.1.12" @@ -2043,6 +2046,7 @@ category = "main" optional = false python-versions = "*" files = [ + {file = "livereload-2.6.3-py2.py3-none-any.whl", hash = "sha256:ad4ac6f53b2d62bb6ce1a5e6e96f1f00976a32348afedcb4b6d68df2a1d346e4"}, {file = "livereload-2.6.3.tar.gz", hash = "sha256:776f2f865e59fde56490a56bcc6773b6917366bce0c267c60ee8aaf1a0959869"}, ] @@ -3659,7 +3663,6 @@ category = "main" optional = false python-versions = "*" files = [ - {file = "wcwidth-0.2.6-py2.py3-none-any.whl", hash = "sha256:795b138f6875577cd91bba52baf9e445cd5118fd32723b460e30a0af30ea230e"}, {file = "wcwidth-0.2.6.tar.gz", hash = "sha256:a5220780a404dbe3353789870978e472cfe477761f06ee55077256e509b156d0"}, ] @@ -3774,4 +3777,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "69ccdf0950f670e050d0ee1985996ab9873538a9a39a72f58adeee63b3ada902" +content-hash = "392fed32dc5e397e6fd56683185d571a8bd93faaf71d54bba6479d1dce4dab84" diff --git a/pyproject.toml b/pyproject.toml index 8f79771..b193fa0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ mypy = "^0.991" django-stubs = "^1.13.1" pytest = "^7.2.0" pytest-sugar = "^0.9.6" -djangorestframework-stubs = "^1.8.0" +djangorestframework-stubs = {extras = ["compatible-mypy"], version = "^1.8.0"} sphinx = "^6.1.1" sphinx-autobuild = "^2021.3.14" flake8 = "^6.0.0" diff --git a/setup.cfg b/setup.cfg index b20382a..2d78fd1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,6 +28,8 @@ plugins = mypy_django_plugin.main, mypy_drf_plugin.main [mypy.plugins.django-stubs] django_settings_module = config.settings.test +# https://github.com/typeddjango/django-stubs/issues/1158 +django-manager-missing = False [mypy-*.migrations.*] # Django migrations should not produce any errors: