mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
changed overload order for date.__sub__ and datetime.__sub__ (#10999)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from abc import abstractmethod
|
||||
from time import struct_time
|
||||
from typing import ClassVar, Literal, NamedTuple, NoReturn, SupportsIndex, TypeVar, final, overload
|
||||
from typing import ClassVar, Literal, NamedTuple, NoReturn, SupportsIndex, final, overload
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
@@ -9,8 +9,6 @@ if sys.version_info >= (3, 11):
|
||||
elif sys.version_info >= (3, 9):
|
||||
__all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR")
|
||||
|
||||
_D = TypeVar("_D", bound=date)
|
||||
|
||||
MINYEAR: Literal[1]
|
||||
MAXYEAR: Literal[9999]
|
||||
|
||||
@@ -90,11 +88,11 @@ class date:
|
||||
def __add__(self, __value: timedelta) -> Self: ...
|
||||
def __radd__(self, __value: timedelta) -> Self: ...
|
||||
@overload
|
||||
def __sub__(self, __value: timedelta) -> Self: ...
|
||||
@overload
|
||||
def __sub__(self, __value: datetime) -> NoReturn: ...
|
||||
@overload
|
||||
def __sub__(self: _D, __value: _D) -> timedelta: ...
|
||||
def __sub__(self, __value: Self) -> timedelta: ...
|
||||
@overload
|
||||
def __sub__(self, __value: timedelta) -> Self: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def weekday(self) -> int: ...
|
||||
def isoweekday(self) -> int: ...
|
||||
@@ -292,6 +290,6 @@ class datetime(date):
|
||||
def __eq__(self, __value: object) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
@overload # type: ignore[override]
|
||||
def __sub__(self, __value: timedelta) -> Self: ...
|
||||
def __sub__(self, __value: Self) -> timedelta: ...
|
||||
@overload
|
||||
def __sub__(self: _D, __value: _D) -> timedelta: ...
|
||||
def __sub__(self, __value: timedelta) -> Self: ...
|
||||
|
||||
Reference in New Issue
Block a user