diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 650e2ec1b..b3f0a64d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.x + python-version: 3.8 - name: Cache PyPI uses: actions/cache@v3 with: diff --git a/CHANGES/798.bugfix b/CHANGES/798.bugfix new file mode 100644 index 000000000..83a28163d --- /dev/null +++ b/CHANGES/798.bugfix @@ -0,0 +1 @@ +Fixed a type annotations regression introduced in v6.0.2 under Python versions <3.10. It was caused by importing certain types only available in newer versions. diff --git a/Makefile b/Makefile index 3e08e526a..fc0206827 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ black-check: mypy: mypy -lint: flake8 black-check mypy isort-check check_changes +lint: mypy flake8 black-check isort-check check_changes fmt: black -t py35 $(SRC) diff --git a/multidict/__init__.pyi b/multidict/__init__.pyi index f2cf00259..bbc5a5c0c 100644 --- a/multidict/__init__.pyi +++ b/multidict/__init__.pyi @@ -1,12 +1,19 @@ import abc -from collections.abc import Iterable, Iterator, Mapping, MutableMapping -from typing import Generic, TypeAlias, TypeVar, overload +from typing import ( + Generic, + Iterable, + Iterator, + Mapping, + MutableMapping, + TypeVar, + overload, +) class istr(str): ... upstr = istr -_S: TypeAlias = str | istr +_S = str | istr _T = TypeVar("_T") @@ -28,9 +35,9 @@ class MultiMapping(Mapping[_S, _T_co]): @abc.abstractmethod def getone(self, key: _S, default: _D) -> _T_co | _D: ... -_Arg: TypeAlias = (Mapping[str, _T] | Mapping[istr, _T] | dict[str, _T] - | dict[istr, _T] | MultiMapping[_T] - | Iterable[tuple[str, _T]] | Iterable[tuple[istr, _T]]) +_Arg = (Mapping[str, _T] | Mapping[istr, _T] | dict[str, _T] + | dict[istr, _T] | MultiMapping[_T] + | Iterable[tuple[str, _T]] | Iterable[tuple[istr, _T]]) class MutableMultiMapping(MultiMapping[_T], MutableMapping[_S, _T], Generic[_T]): @abc.abstractmethod diff --git a/setup.cfg b/setup.cfg index 7a0f57fe3..b5dce175b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,7 +8,8 @@ long_description = file: README.rst [flake8] -ignore = E302,E701,E305,E704,F811,N811, W503 +# Y026,Y027: Incompatible with Python 3.7 (https://github.com/aio-libs/multidict/pull/798) +ignore = E302,E701,E305,E704,F811,N811,W503,Y026,Y027 max-line-length=88