mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Add __eq__ to types.MappingProxyType (#9580)
The type has a custom __eq__: https://github.com/python/cpython/blob/v3.11.1/Objects/descrobject.c#L1906 This helps fix this mypy false positive when using `--strict-equality`: ``` from types import MappingProxyType p = MappingProxyType({'x': 1}) d = {'x': 1} print(p == d) # error: Non-overlapping equality check ``` The fragment prints `True` so the comparison is valid.
This commit is contained in:
@@ -310,6 +310,7 @@ class MappingProxyType(Mapping[_KT, _VT_co], Generic[_KT, _VT_co]):
|
||||
def __getitem__(self, __key: _KT) -> _VT_co: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def copy(self) -> dict[_KT, _VT_co]: ...
|
||||
def keys(self) -> KeysView[_KT]: ...
|
||||
def values(self) -> ValuesView[_VT_co]: ...
|
||||
|
||||
Reference in New Issue
Block a user