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

@@ -71,6 +71,7 @@ class _Cell:
if sys.version_info >= (3, 8):
def __init__(self, __contents: object = ...) -> None: ...
def __eq__(self, __value: object) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
cell_contents: Any
@@ -113,6 +114,8 @@ LambdaType = FunctionType
@final
class CodeType:
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
@property
def co_argcount(self) -> int: ...
if sys.version_info >= (3, 8):
@@ -326,6 +329,7 @@ class MappingProxyType(Mapping[_KT, _VT_co], Generic[_KT, _VT_co]):
class SimpleNamespace:
__hash__: ClassVar[None] # type: ignore[assignment]
def __init__(self, **kwargs: Any) -> None: ...
def __eq__(self, __value: object) -> bool: ...
def __getattribute__(self, __name: str) -> Any: ...
def __setattr__(self, __name: str, __value: Any) -> None: ...
def __delattr__(self, __name: str) -> None: ...
@@ -442,6 +446,8 @@ class MethodType:
def __qualname__(self) -> str: ... # inherited from the added function
def __init__(self, __func: Callable[..., Any], __obj: object) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
@final
class BuiltinFunctionType:
@@ -452,6 +458,8 @@ class BuiltinFunctionType:
@property
def __qualname__(self) -> str: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
BuiltinMethodType = BuiltinFunctionType
@@ -479,6 +487,7 @@ class MethodWrapperType:
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def __eq__(self, __value: object) -> bool: ...
def __ne__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
@final
class MethodDescriptorType:
@@ -603,6 +612,8 @@ if sys.version_info >= (3, 9):
def __parameters__(self) -> tuple[Any, ...]: ...
def __init__(self, origin: type, args: Any) -> None: ...
def __getitem__(self, __typeargs: Any) -> GenericAlias: ...
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 11):
@property
def __unpacked__(self) -> bool: ...
@@ -626,3 +637,5 @@ if sys.version_info >= (3, 10):
def __args__(self) -> tuple[Any, ...]: ...
def __or__(self, __value: Any) -> UnionType: ...
def __ror__(self, __value: Any) -> UnionType: ...
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...