Stdlib: add many missing __hash__ and __eq__ methods (#10464)

This commit is contained in:
Alex Waygood
2023-07-17 13:21:02 +01:00
committed by GitHub
parent a04822051f
commit 03b4bb9cce
22 changed files with 78 additions and 2 deletions

View File

@@ -874,6 +874,8 @@ class memoryview(Sequence[int]):
def __contains__(self, __x: object) -> bool: ...
def __iter__(self) -> Iterator[int]: ...
def __len__(self) -> int: ...
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
@overload
def __setitem__(self, __key: slice, __value: ReadableBuffer) -> None: ...
@overload
@@ -941,6 +943,7 @@ class slice:
def __init__(self, __stop: Any) -> None: ...
@overload
def __init__(self, __start: Any, __stop: Any, __step: Any = ...) -> None: ...
def __eq__(self, __value: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def indices(self, __len: SupportsIndex) -> tuple[int, int, int]: ...
@@ -957,6 +960,8 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
def __le__(self, __value: tuple[_T_co, ...]) -> bool: ...
def __gt__(self, __value: tuple[_T_co, ...]) -> bool: ...
def __ge__(self, __value: tuple[_T_co, ...]) -> bool: ...
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
@overload
def __add__(self, __value: tuple[_T_co, ...]) -> tuple[_T_co, ...]: ...
@overload
@@ -1045,6 +1050,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __ge__(self, __value: list[_T]) -> bool: ...
def __lt__(self, __value: list[_T]) -> bool: ...
def __le__(self, __value: list[_T]) -> bool: ...
def __eq__(self, __value: object) -> bool: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
@@ -1097,6 +1103,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __setitem__(self, __key: _KT, __value: _VT) -> None: ...
def __delitem__(self, __key: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
def __eq__(self, __value: object) -> bool: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_KT]: ...
__hash__: ClassVar[None] # type: ignore[assignment]
@@ -1151,6 +1158,7 @@ class set(MutableSet[_T], Generic[_T]):
def __lt__(self, __value: AbstractSet[object]) -> bool: ...
def __ge__(self, __value: AbstractSet[object]) -> bool: ...
def __gt__(self, __value: AbstractSet[object]) -> bool: ...
def __eq__(self, __value: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
if sys.version_info >= (3, 9):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
@@ -1179,6 +1187,8 @@ class frozenset(AbstractSet[_T_co], Generic[_T_co]):
def __lt__(self, __value: AbstractSet[object]) -> bool: ...
def __ge__(self, __value: AbstractSet[object]) -> bool: ...
def __gt__(self, __value: AbstractSet[object]) -> bool: ...
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
@@ -1204,6 +1214,8 @@ class range(Sequence[int]):
def count(self, __value: int) -> int: ...
def index(self, __value: int) -> int: ... # type: ignore[override]
def __len__(self) -> int: ...
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
def __contains__(self, __key: object) -> bool: ...
def __iter__(self) -> Iterator[int]: ...
@overload