Skip to content

Commit 64bc059

Browse files
authored
Remove un-needed __hash__ methods from stdlib (#8465)
1 parent ac86def commit 64bc059

12 files changed

+0
-21
lines changed

stdlib/_decimal.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class Decimal:
7474
def from_float(cls: type[Self], __f: float) -> Self: ...
7575
def __bool__(self) -> bool: ...
7676
def compare(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
77-
def __hash__(self) -> int: ...
7877
def as_tuple(self) -> DecimalTuple: ...
7978
def as_integer_ratio(self) -> tuple[int, int]: ...
8079
def to_eng_string(self, context: Context | None = ...) -> str: ...

stdlib/_weakref.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class ReferenceType(Generic[_T]):
2323
__callback__: Callable[[ReferenceType[_T]], Any]
2424
def __new__(cls: type[Self], o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> Self: ...
2525
def __call__(self) -> _T | None: ...
26-
def __hash__(self) -> int: ...
2726
if sys.version_info >= (3, 9):
2827
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
2928

stdlib/asyncio/events.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ class TimerHandle(Handle):
8585
loop: AbstractEventLoop,
8686
context: Context | None = ...,
8787
) -> None: ...
88-
def __hash__(self) -> int: ...
8988
def when(self) -> float: ...
9089
def __lt__(self, other: TimerHandle) -> bool: ...
9190
def __le__(self, other: TimerHandle) -> bool: ...

stdlib/builtins.pyi

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ class int:
296296
def __float__(self) -> float: ...
297297
def __int__(self) -> int: ...
298298
def __abs__(self) -> int: ...
299-
def __hash__(self) -> int: ...
300299
def __bool__(self) -> bool: ...
301300
def __index__(self) -> int: ...
302301

@@ -360,7 +359,6 @@ class float:
360359
def __int__(self) -> int: ...
361360
def __float__(self) -> float: ...
362361
def __abs__(self) -> float: ...
363-
def __hash__(self) -> int: ...
364362
def __bool__(self) -> bool: ...
365363

366364
class complex:
@@ -402,7 +400,6 @@ class complex:
402400
def __neg__(self) -> complex: ...
403401
def __pos__(self) -> complex: ...
404402
def __abs__(self) -> float: ...
405-
def __hash__(self) -> int: ...
406403
def __bool__(self) -> bool: ...
407404
if sys.version_info >= (3, 11):
408405
def __complex__(self) -> complex: ...
@@ -564,7 +561,6 @@ class str(Sequence[str]):
564561
def __ge__(self, __x: str) -> bool: ...
565562
def __getitem__(self, __i: SupportsIndex | slice) -> str: ...
566563
def __gt__(self, __x: str) -> bool: ...
567-
def __hash__(self) -> int: ...
568564
@overload
569565
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
570566
@overload
@@ -674,7 +670,6 @@ class bytes(ByteString):
674670
def maketrans(__frm: ReadableBuffer, __to: ReadableBuffer) -> bytes: ...
675671
def __len__(self) -> int: ...
676672
def __iter__(self) -> Iterator[int]: ...
677-
def __hash__(self) -> int: ...
678673
@overload
679674
def __getitem__(self, __i: SupportsIndex) -> int: ...
680675
@overload

stdlib/datetime.pyi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class timezone(tzinfo):
2929
min: ClassVar[timezone]
3030
max: ClassVar[timezone]
3131
def __init__(self, offset: timedelta, name: str = ...) -> None: ...
32-
def __hash__(self) -> int: ...
3332

3433
if sys.version_info >= (3, 11):
3534
UTC: timezone
@@ -94,7 +93,6 @@ class date:
9493
@overload
9594
def __sub__(self, __other: date) -> timedelta: ...
9695

97-
def __hash__(self) -> int: ...
9896
def weekday(self) -> int: ...
9997
def isoweekday(self) -> int: ...
10098
if sys.version_info >= (3, 9):
@@ -132,7 +130,6 @@ class time:
132130
def __lt__(self, __other: time) -> bool: ...
133131
def __ge__(self, __other: time) -> bool: ...
134132
def __gt__(self, __other: time) -> bool: ...
135-
def __hash__(self) -> int: ...
136133
def isoformat(self, timespec: str = ...) -> str: ...
137134
@classmethod
138135
def fromisoformat(cls: type[Self], __time_string: str) -> Self: ...
@@ -200,7 +197,6 @@ class timedelta(SupportsAbs[timedelta]):
200197
def __ge__(self, __other: timedelta) -> bool: ...
201198
def __gt__(self, __other: timedelta) -> bool: ...
202199
def __bool__(self) -> bool: ...
203-
def __hash__(self) -> int: ...
204200

205201
class datetime(date):
206202
min: ClassVar[datetime]

stdlib/doctest.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ class Example:
8585
indent: int = ...,
8686
options: dict[int, bool] | None = ...,
8787
) -> None: ...
88-
def __hash__(self) -> int: ...
8988
def __eq__(self, other: object) -> bool: ...
9089

9190
class DocTest:
@@ -104,7 +103,6 @@ class DocTest:
104103
lineno: int | None,
105104
docstring: str | None,
106105
) -> None: ...
107-
def __hash__(self) -> int: ...
108106
def __lt__(self, other: DocTest) -> bool: ...
109107
def __eq__(self, other: object) -> bool: ...
110108

@@ -211,7 +209,6 @@ class DocTestCase(unittest.TestCase):
211209
def format_failure(self, err: str) -> str: ...
212210
def debug(self) -> None: ...
213211
def id(self) -> str: ...
214-
def __hash__(self) -> int: ...
215212
def __eq__(self, other: object) -> bool: ...
216213
def shortDescription(self) -> str: ...
217214

stdlib/ipaddress.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class _IPAddressBase:
3131
class _BaseAddress(_IPAddressBase, SupportsInt):
3232
def __init__(self, address: object) -> None: ...
3333
def __add__(self: Self, other: int) -> Self: ...
34-
def __hash__(self) -> int: ...
3534
def __int__(self) -> int: ...
3635
def __sub__(self: Self, other: int) -> Self: ...
3736
def __format__(self, fmt: str) -> str: ...

stdlib/pathlib.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class PurePath(PathLike[str]):
3838
@property
3939
def stem(self) -> str: ...
4040
def __new__(cls: type[Self], *args: StrPath) -> Self: ...
41-
def __hash__(self) -> int: ...
4241
def __eq__(self, other: object) -> bool: ...
4342
def __fspath__(self) -> str: ...
4443
def __lt__(self, other: PurePath) -> bool: ...

stdlib/plistlib.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ if sys.version_info >= (3, 8):
9999
def __init__(self, data: int) -> None: ...
100100
def __index__(self) -> int: ...
101101
def __reduce__(self: Self) -> tuple[type[Self], tuple[int]]: ...
102-
def __hash__(self) -> int: ...
103102
def __eq__(self, other: object) -> bool: ...
104103

105104
class InvalidFileException(ValueError):

stdlib/sqlite3/dbapi2.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,6 @@ class Row:
420420
def __getitem__(self, __index: int | str) -> Any: ...
421421
@overload
422422
def __getitem__(self, __index: slice) -> tuple[Any, ...]: ...
423-
def __hash__(self) -> int: ...
424423
def __iter__(self) -> Iterator[Any]: ...
425424
def __len__(self) -> int: ...
426425
# These return NotImplemented for anything that is not a Row.

stdlib/statistics.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ if sys.version_info >= (3, 8):
113113
__radd__ = __add__
114114
def __rsub__(self, x2: float | NormalDist) -> NormalDist: ...
115115
__rmul__ = __mul__
116-
def __hash__(self) -> int: ...
117116

118117
if sys.version_info >= (3, 10):
119118
def correlation(__x: Sequence[_Number], __y: Sequence[_Number]) -> float: ...

stdlib/typing.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@ class ForwardRef:
813813

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

0 commit comments

Comments
 (0)