Skip to content

Remove un-needed __hash__ methods from stdlib #8465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion stdlib/_decimal.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class Decimal:
def from_float(cls: type[Self], __f: float) -> Self: ...
def __bool__(self) -> bool: ...
def compare(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
def __hash__(self) -> int: ...
def as_tuple(self) -> DecimalTuple: ...
def as_integer_ratio(self) -> tuple[int, int]: ...
def to_eng_string(self, context: Context | None = ...) -> str: ...
Expand Down
1 change: 0 additions & 1 deletion stdlib/_weakref.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class ReferenceType(Generic[_T]):
__callback__: Callable[[ReferenceType[_T]], Any]
def __new__(cls: type[Self], o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> Self: ...
def __call__(self) -> _T | None: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

Expand Down
1 change: 0 additions & 1 deletion stdlib/asyncio/events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class TimerHandle(Handle):
loop: AbstractEventLoop,
context: Context | None = ...,
) -> None: ...
def __hash__(self) -> int: ...
def when(self) -> float: ...
def __lt__(self, other: TimerHandle) -> bool: ...
def __le__(self, other: TimerHandle) -> bool: ...
Expand Down
5 changes: 0 additions & 5 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ class int:
def __float__(self) -> float: ...
def __int__(self) -> int: ...
def __abs__(self) -> int: ...
def __hash__(self) -> int: ...
def __bool__(self) -> bool: ...
def __index__(self) -> int: ...

Expand Down Expand Up @@ -360,7 +359,6 @@ class float:
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __abs__(self) -> float: ...
def __hash__(self) -> int: ...
def __bool__(self) -> bool: ...

class complex:
Expand Down Expand Up @@ -388,7 +386,6 @@ class complex:
def __neg__(self) -> complex: ...
def __pos__(self) -> complex: ...
def __abs__(self) -> float: ...
def __hash__(self) -> int: ...
def __bool__(self) -> bool: ...
if sys.version_info >= (3, 11):
def __complex__(self) -> complex: ...
Expand Down Expand Up @@ -550,7 +547,6 @@ class str(Sequence[str]):
def __ge__(self, __x: str) -> bool: ...
def __getitem__(self, __i: SupportsIndex | slice) -> str: ...
def __gt__(self, __x: str) -> bool: ...
def __hash__(self) -> int: ...
@overload
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
@overload
Expand Down Expand Up @@ -660,7 +656,6 @@ class bytes(ByteString):
def maketrans(__frm: ReadableBuffer, __to: ReadableBuffer) -> bytes: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[int]: ...
def __hash__(self) -> int: ...
@overload
def __getitem__(self, __i: SupportsIndex) -> int: ...
@overload
Expand Down
4 changes: 0 additions & 4 deletions stdlib/datetime.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class timezone(tzinfo):
min: ClassVar[timezone]
max: ClassVar[timezone]
def __init__(self, offset: timedelta, name: str = ...) -> None: ...
def __hash__(self) -> int: ...

if sys.version_info >= (3, 11):
UTC: timezone
Expand Down Expand Up @@ -94,7 +93,6 @@ class date:
@overload
def __sub__(self, __other: date) -> timedelta: ...

def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...
if sys.version_info >= (3, 9):
Expand Down Expand Up @@ -132,7 +130,6 @@ class time:
def __lt__(self, __other: time) -> bool: ...
def __ge__(self, __other: time) -> bool: ...
def __gt__(self, __other: time) -> bool: ...
def __hash__(self) -> int: ...
def isoformat(self, timespec: str = ...) -> str: ...
@classmethod
def fromisoformat(cls: type[Self], __time_string: str) -> Self: ...
Expand Down Expand Up @@ -200,7 +197,6 @@ class timedelta(SupportsAbs[timedelta]):
def __ge__(self, __other: timedelta) -> bool: ...
def __gt__(self, __other: timedelta) -> bool: ...
def __bool__(self) -> bool: ...
def __hash__(self) -> int: ...

class datetime(date):
min: ClassVar[datetime]
Expand Down
3 changes: 0 additions & 3 deletions stdlib/doctest.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class Example:
indent: int = ...,
options: dict[int, bool] | None = ...,
) -> None: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...

class DocTest:
Expand All @@ -104,7 +103,6 @@ class DocTest:
lineno: int | None,
docstring: str | None,
) -> None: ...
def __hash__(self) -> int: ...
def __lt__(self, other: DocTest) -> bool: ...
def __eq__(self, other: object) -> bool: ...

Expand Down Expand Up @@ -211,7 +209,6 @@ class DocTestCase(unittest.TestCase):
def format_failure(self, err: str) -> str: ...
def debug(self) -> None: ...
def id(self) -> str: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def shortDescription(self) -> str: ...

Expand Down
1 change: 0 additions & 1 deletion stdlib/ipaddress.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class _IPAddressBase:
class _BaseAddress(_IPAddressBase, SupportsInt):
def __init__(self, address: object) -> None: ...
def __add__(self: Self, other: int) -> Self: ...
def __hash__(self) -> int: ...
def __int__(self) -> int: ...
def __sub__(self: Self, other: int) -> Self: ...
def __format__(self, fmt: str) -> str: ...
Expand Down
1 change: 0 additions & 1 deletion stdlib/pathlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class PurePath(PathLike[str]):
@property
def stem(self) -> str: ...
def __new__(cls: type[Self], *args: StrPath) -> Self: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __fspath__(self) -> str: ...
def __lt__(self, other: PurePath) -> bool: ...
Expand Down
1 change: 0 additions & 1 deletion stdlib/plistlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ if sys.version_info >= (3, 8):
def __init__(self, data: int) -> None: ...
def __index__(self) -> int: ...
def __reduce__(self: Self) -> tuple[type[Self], tuple[int]]: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...

class InvalidFileException(ValueError):
Expand Down
1 change: 0 additions & 1 deletion stdlib/sqlite3/dbapi2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ class Row:
def __getitem__(self, __index: int | str) -> Any: ...
@overload
def __getitem__(self, __index: slice) -> tuple[Any, ...]: ...
def __hash__(self) -> int: ...
def __iter__(self) -> Iterator[Any]: ...
def __len__(self) -> int: ...
# These return NotImplemented for anything that is not a Row.
Expand Down
1 change: 0 additions & 1 deletion stdlib/statistics.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ if sys.version_info >= (3, 8):
__radd__ = __add__
def __rsub__(self, x2: float | NormalDist) -> NormalDist: ...
__rmul__ = __mul__
def __hash__(self) -> int: ...

if sys.version_info >= (3, 10):
def correlation(__x: Sequence[_Number], __y: Sequence[_Number]) -> float: ...
Expand Down
1 change: 0 additions & 1 deletion stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,6 @@ class ForwardRef:

def _evaluate(self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None) -> Any | None: ...
def __eq__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 11):
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...
Expand Down