chore: Update code for minumum python 3.9

This commit is contained in:
Serhii Tereshchenko 2024-06-01 10:23:13 +03:00
parent d2c16feba9
commit 9d9a2ab8b0
10 changed files with 21 additions and 42 deletions

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from copy import deepcopy
from typing import Any, Iterable, Sequence, TypeVar
from typing import Any, TypeVar
from collections.abc import Iterable, Sequence
from django import forms
from django.db.models import Field, Model

View file

@ -1,6 +1,7 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Callable, Iterable, TypeVar
from typing import TYPE_CHECKING, Any, Callable, TypeVar
from collections.abc import Iterable
from django.db.models import Model

View file

@ -1,7 +1,8 @@
from __future__ import annotations
import copy
from typing import Any, Sequence, cast
from typing import Any, cast
from collections.abc import Sequence
from django import VERSION, forms
from django.core.exceptions import ImproperlyConfigured

View file

@ -11,7 +11,8 @@ Credits: Heavily inspired by django-transmeta's sync_transmeta_db command.
from __future__ import annotations
from typing import Any, Iterator, cast
from typing import Any, cast
from collections.abc import Iterator
from django import VERSION
from django.core.management.base import BaseCommand, CommandParser

View file

@ -9,7 +9,8 @@ from __future__ import annotations
import itertools
from functools import reduce
from typing import Any, Container, Iterator, Literal, Sequence, Iterable, TypeVar, cast, overload
from typing import Any, Literal, TypeVar, cast, overload
from collections.abc import Container, Iterator, Sequence, Iterable
from django import VERSION
from django.contrib.admin.utils import get_model_from_relation

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from functools import partial
from typing import Any, Callable, ClassVar, Collection, Iterable, Sequence, cast
from typing import Any, Callable, ClassVar, cast
from collections.abc import Collection, Iterable, Sequence
import django
from django.core.exceptions import ImproperlyConfigured

View file

@ -1,7 +1,8 @@
from __future__ import annotations
from contextlib import contextmanager
from typing import Any, Generator, Iterable, Iterator, TypeVar
from typing import Any, TypeVar
from collections.abc import Generator, Iterable, Iterator
from django.db import models
from django.utils.encoding import force_str

View file

@ -1,6 +1,7 @@
from __future__ import annotations
from typing import Any, Mapping
from typing import Any
from collections.abc import Mapping
from django.core.files.uploadedfile import UploadedFile
from django.forms.renderers import BaseRenderer

33
poetry.lock generated
View file

@ -36,34 +36,6 @@ tests = ["attrs[tests-no-zope]", "zope-interface"]
tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"]
tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"]
[[package]]
name = "backports-zoneinfo"
version = "0.2.1"
description = "Backport of the standard library zoneinfo module"
optional = false
python-versions = ">=3.6"
files = [
{file = "backports.zoneinfo-0.2.1-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:da6013fd84a690242c310d77ddb8441a559e9cb3d3d59ebac9aca1a57b2e18bc"},
{file = "backports.zoneinfo-0.2.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:89a48c0d158a3cc3f654da4c2de1ceba85263fafb861b98b59040a5086259722"},
{file = "backports.zoneinfo-0.2.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:1c5742112073a563c81f786e77514969acb58649bcdf6cdf0b4ed31a348d4546"},
{file = "backports.zoneinfo-0.2.1-cp36-cp36m-win32.whl", hash = "sha256:e8236383a20872c0cdf5a62b554b27538db7fa1bbec52429d8d106effbaeca08"},
{file = "backports.zoneinfo-0.2.1-cp36-cp36m-win_amd64.whl", hash = "sha256:8439c030a11780786a2002261569bdf362264f605dfa4d65090b64b05c9f79a7"},
{file = "backports.zoneinfo-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:f04e857b59d9d1ccc39ce2da1021d196e47234873820cbeaad210724b1ee28ac"},
{file = "backports.zoneinfo-0.2.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:17746bd546106fa389c51dbea67c8b7c8f0d14b5526a579ca6ccf5ed72c526cf"},
{file = "backports.zoneinfo-0.2.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5c144945a7752ca544b4b78c8c41544cdfaf9786f25fe5ffb10e838e19a27570"},
{file = "backports.zoneinfo-0.2.1-cp37-cp37m-win32.whl", hash = "sha256:e55b384612d93be96506932a786bbcde5a2db7a9e6a4bb4bffe8b733f5b9036b"},
{file = "backports.zoneinfo-0.2.1-cp37-cp37m-win_amd64.whl", hash = "sha256:a76b38c52400b762e48131494ba26be363491ac4f9a04c1b7e92483d169f6582"},
{file = "backports.zoneinfo-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:8961c0f32cd0336fb8e8ead11a1f8cd99ec07145ec2931122faaac1c8f7fd987"},
{file = "backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e81b76cace8eda1fca50e345242ba977f9be6ae3945af8d46326d776b4cf78d1"},
{file = "backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7b0a64cda4145548fed9efc10322770f929b944ce5cee6c0dfe0c87bf4c0c8c9"},
{file = "backports.zoneinfo-0.2.1-cp38-cp38-win32.whl", hash = "sha256:1b13e654a55cd45672cb54ed12148cd33628f672548f373963b0bff67b217328"},
{file = "backports.zoneinfo-0.2.1-cp38-cp38-win_amd64.whl", hash = "sha256:4a0f800587060bf8880f954dbef70de6c11bbe59c673c3d818921f042f9954a6"},
{file = "backports.zoneinfo-0.2.1.tar.gz", hash = "sha256:fadbfe37f74051d024037f223b8e001611eac868b5c5b06144ef4d8b799862f2"},
]
[package.extras]
tzdata = ["tzdata"]
[[package]]
name = "build"
version = "1.2.1"
@ -180,7 +152,6 @@ files = [
[package.dependencies]
asgiref = ">=3.6.0,<4"
"backports.zoneinfo" = {version = "*", markers = "python_version < \"3.9\""}
sqlparse = ">=0.3.1"
tzdata = {version = "*", markers = "sys_platform == \"win32\""}
@ -918,5 +889,5 @@ test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-it
[metadata]
lock-version = "2.0"
python-versions = ">=3.8,<4"
content-hash = "947556b866b3f632ba8e1d92e3a182cb3d790f63b838d103d4614cd639f1c7c9"
python-versions = ">=3.9,<4"
content-hash = "f81db2cab23e43e0b00d6a12fa0a51f1d2a340e1430caf851fa12f332e7472cc"

View file

@ -9,7 +9,7 @@ packages = [
]
[tool.poetry.dependencies]
python = ">=3.8,<4"
python = ">=3.9,<4"
django = ">=4.2"
typing-extensions = {version = ">=4.0.1", python = "<3.11"}
@ -34,7 +34,7 @@ pylsp-mypy = "^0.6.8"
[tool.ruff]
line-length = 100
target-version = "py38"
target-version = "py39"
[tool.ruff.lint]
ignore = [
"E501", # line length is handled by formatter
@ -50,7 +50,7 @@ extend-generics = [
]
[tool.mypy]
python_version = "3.8"
python_version = "3.9"
incremental = true
warn_unused_ignores = true
warn_redundant_casts = true