diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-03-08 12:14:01 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-03-08 13:52:41 -0500 |
commit | bcbb4007bbfa5102d7e53fea8aac50e528d4d1f2 (patch) | |
tree | 20ca47143fd2a26abd22c6419a18971a4eed6e93 /lib/sqlalchemy/util/_py_collections.py | |
parent | 8d5986fafd8360ddfe3992bd56602d5a52a23392 (diff) | |
download | sqlalchemy-bcbb4007bbfa5102d7e53fea8aac50e528d4d1f2.tar.gz |
update for mypy 1.1.1
looks like mypy 1.1.1 slipped in after the last jenkins pep484 build
for SQLAlchemy. update for its new issues.
Change-Id: Ifca967a75d5e592c04b0138aeda9b646067fe59b
Diffstat (limited to 'lib/sqlalchemy/util/_py_collections.py')
-rw-r--r-- | lib/sqlalchemy/util/_py_collections.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/sqlalchemy/util/_py_collections.py b/lib/sqlalchemy/util/_py_collections.py index 048825f60..8810800c4 100644 --- a/lib/sqlalchemy/util/_py_collections.py +++ b/lib/sqlalchemy/util/_py_collections.py @@ -23,9 +23,12 @@ from typing import NoReturn from typing import Optional from typing import Set from typing import Tuple +from typing import TYPE_CHECKING from typing import TypeVar from typing import Union +from ..util.typing import Self + _T = TypeVar("_T", bound=Any) _S = TypeVar("_S", bound=Any) _KT = TypeVar("_KT", bound=Any) @@ -54,6 +57,14 @@ class ReadOnlyContainer: class ImmutableDictBase(ReadOnlyContainer, Dict[_KT, _VT]): + if TYPE_CHECKING: + + def __new__(cls, *args: Any) -> Self: + ... + + def __init__(cls, *args: Any): + ... + def _readonly(self, *arg: Any, **kw: Any) -> NoReturn: self._immutable() @@ -75,7 +86,7 @@ class ImmutableDictBase(ReadOnlyContainer, Dict[_KT, _VT]): class immutabledict(ImmutableDictBase[_KT, _VT]): def __new__(cls, *args): - new = dict.__new__(cls) + new = ImmutableDictBase.__new__(cls) dict.__init__(new, *args) return new @@ -93,7 +104,7 @@ class immutabledict(ImmutableDictBase[_KT, _VT]): if not __d: return self - new = dict.__new__(self.__class__) + new = ImmutableDictBase.__new__(self.__class__) dict.__init__(new, self) dict.update(new, __d) # type: ignore return new @@ -105,7 +116,7 @@ class immutabledict(ImmutableDictBase[_KT, _VT]): if not __d and not kw: return self - new = dict.__new__(self.__class__) + new = ImmutableDictBase.__new__(self.__class__) dict.__init__(new, self) if __d: dict.update(new, __d) # type: ignore @@ -119,7 +130,7 @@ class immutabledict(ImmutableDictBase[_KT, _VT]): for d in dicts: if d: if new is None: - new = dict.__new__(self.__class__) + new = ImmutableDictBase.__new__(self.__class__) dict.__init__(new, self) dict.update(new, d) # type: ignore if new is None: |