From 1dc5e513f8f52430fd3201d1d7df4f2e5e0b4ff5 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 Dec 2022 19:10:06 +0000 Subject: [PATCH 01/12] Revert collections import --- multidict/__init__.pyi | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/multidict/__init__.pyi b/multidict/__init__.pyi index f2cf00259..e596b7e10 100644 --- a/multidict/__init__.pyi +++ b/multidict/__init__.pyi @@ -1,6 +1,17 @@ import abc -from collections.abc import Iterable, Iterator, Mapping, MutableMapping -from typing import Generic, TypeAlias, TypeVar, overload +from typing import ( + Dict, + Generic, + Iterable, + Iterator, + List, + Mapping, + MutableMapping, + Tuple, + TypeVar, + Union, + overload, +) class istr(str): ... From f72958884d746ca7c3ab00722ba5e5eb32fc93c9 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 Dec 2022 19:25:52 +0000 Subject: [PATCH 02/12] Update __init__.pyi --- multidict/__init__.pyi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/multidict/__init__.pyi b/multidict/__init__.pyi index e596b7e10..ba17f2b45 100644 --- a/multidict/__init__.pyi +++ b/multidict/__init__.pyi @@ -1,15 +1,11 @@ import abc from typing import ( - Dict, Generic, Iterable, Iterator, - List, Mapping, MutableMapping, - Tuple, TypeVar, - Union, overload, ) From 0dba63afa2a45bb33e51bdcbe520d33e544eb7cd Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 Dec 2022 19:28:03 +0000 Subject: [PATCH 03/12] Update __init__.pyi --- multidict/__init__.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/multidict/__init__.pyi b/multidict/__init__.pyi index ba17f2b45..c9c76f4a2 100644 --- a/multidict/__init__.pyi +++ b/multidict/__init__.pyi @@ -5,6 +5,7 @@ from typing import ( Iterator, Mapping, MutableMapping, + TypeAlias, TypeVar, overload, ) From 9402c62aa8a14bd3893d2aa740f21140a0f8d16f Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 Dec 2022 19:39:25 +0000 Subject: [PATCH 04/12] Revert TypeAlias --- multidict/__init__.pyi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/multidict/__init__.pyi b/multidict/__init__.pyi index c9c76f4a2..39b39b677 100644 --- a/multidict/__init__.pyi +++ b/multidict/__init__.pyi @@ -5,7 +5,6 @@ from typing import ( Iterator, Mapping, MutableMapping, - TypeAlias, TypeVar, overload, ) @@ -14,7 +13,7 @@ class istr(str): ... upstr = istr -_S: TypeAlias = str | istr +_S = str | istr _T = TypeVar("_T") @@ -36,7 +35,7 @@ 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] +_Arg = (Mapping[str, _T] | Mapping[istr, _T] | dict[str, _T] | dict[istr, _T] | MultiMapping[_T] | Iterable[tuple[str, _T]] | Iterable[tuple[istr, _T]]) From bbf4a60c769b5e7e82e838f220edd77e15f97223 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 Dec 2022 19:47:07 +0000 Subject: [PATCH 05/12] Update __init__.pyi --- multidict/__init__.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multidict/__init__.pyi b/multidict/__init__.pyi index 39b39b677..bbc5a5c0c 100644 --- a/multidict/__init__.pyi +++ b/multidict/__init__.pyi @@ -36,8 +36,8 @@ class MultiMapping(Mapping[_S, _T_co]): def getone(self, key: _S, default: _D) -> _T_co | _D: ... _Arg = (Mapping[str, _T] | Mapping[istr, _T] | dict[str, _T] - | dict[istr, _T] | MultiMapping[_T] - | Iterable[tuple[str, _T]] | Iterable[tuple[istr, _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 From 1fbd0eb4e998aa003d85024c736562f0cc9d57fc Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 Dec 2022 19:48:28 +0000 Subject: [PATCH 06/12] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 650e2ec1b..1324f29b2 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.7 - name: Cache PyPI uses: actions/cache@v3 with: From 3e67745eac2dc70cefdb6b2976b4a68892af57ae Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 Dec 2022 19:49:38 +0000 Subject: [PATCH 07/12] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1324f29b2..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.7 + python-version: 3.8 - name: Cache PyPI uses: actions/cache@v3 with: From 4d55436ea73d63d6255cd49349dc00c71d330f06 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 Dec 2022 19:51:40 +0000 Subject: [PATCH 08/12] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From c3ed54e5c11b294bbf369955eb73d1cbb674810f Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 Dec 2022 19:56:41 +0000 Subject: [PATCH 09/12] Update setup.cfg --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 7a0f57fe3..aa53c5641 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,7 +8,7 @@ long_description = file: README.rst [flake8] -ignore = E302,E701,E305,E704,F811,N811, W503 +ignore = E302,E701,E305,E704,F811,N811,W503,Y026,Y027 max-line-length=88 From c4b1b745fa133353fcf3440a111a2bd9a2abe352 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 Dec 2022 20:00:36 +0000 Subject: [PATCH 10/12] Create 798.bugfix --- CHANGES/798.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 CHANGES/798.bugfix diff --git a/CHANGES/798.bugfix b/CHANGES/798.bugfix new file mode 100644 index 000000000..cca0e92b8 --- /dev/null +++ b/CHANGES/798.bugfix @@ -0,0 +1 @@ +Fix a regression from 6.0.2 in type annotations when using Python <3.10. From 7fd3c368194f269a144584415ead64dfeb241ba7 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 24 Dec 2022 00:46:27 +0000 Subject: [PATCH 11/12] Update setup.cfg --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index aa53c5641..b5dce175b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,6 +8,7 @@ long_description = file: README.rst [flake8] +# 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 From a599ca3431fde22aa204029ff0ae5bb79716996e Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 24 Dec 2022 00:51:49 +0000 Subject: [PATCH 12/12] Update 798.bugfix --- CHANGES/798.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES/798.bugfix b/CHANGES/798.bugfix index cca0e92b8..83a28163d 100644 --- a/CHANGES/798.bugfix +++ b/CHANGES/798.bugfix @@ -1 +1 @@ -Fix a regression from 6.0.2 in type annotations when using Python <3.10. +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.