Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add __hash__ stub to classes that are hashable and define __eq__
  • Loading branch information
TheTripleV committed Jul 9, 2023
commit 80510def6db49e8c645887036ce62a169d8d18fa
5 changes: 5 additions & 0 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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: ...

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: ...

Expand Down