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

@@ -36,6 +36,7 @@ class timezone(tzinfo):
def utcoffset(self, __dt: datetime | None) -> timedelta: ...
def dst(self, __dt: datetime | None) -> None: ...
def __hash__(self) -> int: ...
def __eq__(self, __value: object) -> bool: ...
if sys.version_info >= (3, 11):
UTC: timezone
@@ -87,6 +88,7 @@ class date:
def __lt__(self, __value: date) -> bool: ...
def __ge__(self, __value: date) -> bool: ...
def __gt__(self, __value: date) -> bool: ...
def __eq__(self, __value: object) -> bool: ...
if sys.version_info >= (3, 8):
def __add__(self, __value: timedelta) -> Self: ...
def __radd__(self, __value: timedelta) -> Self: ...
@@ -145,6 +147,7 @@ class time:
def __lt__(self, __value: time) -> bool: ...
def __ge__(self, __value: time) -> bool: ...
def __gt__(self, __value: time) -> bool: ...
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
def isoformat(self, timespec: str = ...) -> str: ...
@classmethod
@@ -219,6 +222,7 @@ class timedelta:
def __lt__(self, __value: timedelta) -> bool: ...
def __ge__(self, __value: timedelta) -> bool: ...
def __gt__(self, __value: timedelta) -> bool: ...
def __eq__(self, __value: object) -> bool: ...
def __bool__(self) -> bool: ...
def __hash__(self) -> int: ...
@@ -310,6 +314,8 @@ class datetime(date):
def __lt__(self, __value: datetime) -> bool: ... # type: ignore[override]
def __ge__(self, __value: datetime) -> bool: ... # type: ignore[override]
def __gt__(self, __value: datetime) -> bool: ... # type: ignore[override]
def __eq__(self, __value: object) -> bool: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 8):
@overload # type: ignore[override]
def __sub__(self, __value: timedelta) -> Self: ...