|
1 | 1 | import sys
|
2 | 2 | from abc import abstractmethod
|
3 | 3 | from time import struct_time
|
4 |
| -from typing import ClassVar, Literal, NamedTuple, NoReturn, SupportsIndex, TypeVar, final, overload |
| 4 | +from typing import ClassVar, Literal, NamedTuple, NoReturn, SupportsIndex, final, overload |
5 | 5 | from typing_extensions import Self, TypeAlias, deprecated
|
6 | 6 |
|
7 | 7 | if sys.version_info >= (3, 11):
|
8 | 8 | __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR", "UTC")
|
9 | 9 | elif sys.version_info >= (3, 9):
|
10 | 10 | __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR")
|
11 | 11 |
|
12 |
| -_D = TypeVar("_D", bound=date) |
13 |
| - |
14 | 12 | MINYEAR: Literal[1]
|
15 | 13 | MAXYEAR: Literal[9999]
|
16 | 14 |
|
@@ -90,11 +88,11 @@ class date:
|
90 | 88 | def __add__(self, __value: timedelta) -> Self: ...
|
91 | 89 | def __radd__(self, __value: timedelta) -> Self: ...
|
92 | 90 | @overload
|
93 |
| - def __sub__(self, __value: timedelta) -> Self: ... |
94 |
| - @overload |
95 | 91 | def __sub__(self, __value: datetime) -> NoReturn: ...
|
96 | 92 | @overload
|
97 |
| - def __sub__(self: _D, __value: _D) -> timedelta: ... |
| 93 | + def __sub__(self, __value: Self) -> timedelta: ... |
| 94 | + @overload |
| 95 | + def __sub__(self, __value: timedelta) -> Self: ... |
98 | 96 | def __hash__(self) -> int: ...
|
99 | 97 | def weekday(self) -> int: ...
|
100 | 98 | def isoweekday(self) -> int: ...
|
@@ -292,6 +290,6 @@ class datetime(date):
|
292 | 290 | def __eq__(self, __value: object) -> bool: ...
|
293 | 291 | def __hash__(self) -> int: ...
|
294 | 292 | @overload # type: ignore[override]
|
295 |
| - def __sub__(self, __value: timedelta) -> Self: ... |
| 293 | + def __sub__(self, __value: Self) -> timedelta: ... |
296 | 294 | @overload
|
297 |
| - def __sub__(self: _D, __value: _D) -> timedelta: ... |
| 295 | + def __sub__(self, __value: timedelta) -> Self: ... |
0 commit comments