Skip to content

Commit

Permalink
Revert collections import (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer authored Dec 24, 2022
1 parent 437f2c4 commit 34ce3a6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions CHANGES/798.bugfix
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 13 additions & 6 deletions multidict/__init__.pyi
Original file line number Diff line number Diff line change
@@ -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")

Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 34ce3a6

Please sign in to comment.