reformed project

This commit is contained in:
Alexander Karpov 2023-02-16 10:38:42 +03:00
parent 5fd9c2bfb5
commit 727f6a6f9e
8 changed files with 20 additions and 13 deletions

View File

@ -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

View File

@ -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
```

View File

@ -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:

View File

@ -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,

View File

@ -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))

9
poetry.lock generated
View File

@ -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"

View File

@ -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"

View File

@ -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: