From 80510def6db49e8c645887036ce62a169d8d18fa Mon Sep 17 00:00:00 2001 From: Vasista Vovveti Date: Sun, 9 Jul 2023 07:31:47 +0000 Subject: [PATCH 1/2] Add __hash__ stub to classes that are hashable and define __eq__ --- stdlib/builtins.pyi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 45a17b33d979..5e33c320ef58 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -318,6 +318,7 @@ class int: def __abs__(self) -> int: ... def __bool__(self) -> bool: ... def __index__(self) -> int: ... + def __hash__(self) -> int: ... class float: def __new__(cls, __x: SupportsFloat | SupportsIndex | str | ReadableBuffer = ...) -> Self: ... @@ -380,6 +381,7 @@ class float: def __float__(self) -> float: ... def __abs__(self) -> float: ... def __bool__(self) -> bool: ... + def __hash__(self) -> int: ... class complex: if sys.version_info >= (3, 8): @@ -419,6 +421,7 @@ class complex: def __pos__(self) -> complex: ... def __abs__(self) -> float: ... def __bool__(self) -> bool: ... + def __hash__(self) -> int: ... if sys.version_info >= (3, 11): def __complex__(self) -> complex: ... @@ -606,6 +609,7 @@ class str(Sequence[str]): @overload def __rmul__(self, __value: SupportsIndex) -> str: ... # type: ignore[misc] def __getnewargs__(self) -> tuple[str]: ... + def __hash__(self) -> int: ... class bytes(Sequence[int]): @overload @@ -709,6 +713,7 @@ class bytes(Sequence[int]): def __getnewargs__(self) -> tuple[bytes]: ... if sys.version_info >= (3, 11): def __bytes__(self) -> bytes: ... + def __hash__(self) -> int: ... def __buffer__(self, __flags: int) -> memoryview: ... From 4b400d6a5dea66ba0cde702c212e8b50d417b621 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 9 Jul 2023 07:45:29 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/builtins.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 5e33c320ef58..0c71b709d98c 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -713,8 +713,8 @@ class bytes(Sequence[int]): def __getnewargs__(self) -> tuple[bytes]: ... if sys.version_info >= (3, 11): def __bytes__(self) -> bytes: ... - def __hash__(self) -> int: ... + def __hash__(self) -> int: ... def __buffer__(self, __flags: int) -> memoryview: ... class bytearray(MutableSequence[int]):