Skip to content

Commit

Permalink
changed overload order for date.__sub__ and datetime.__sub__ (#10999
Browse files Browse the repository at this point in the history
)
  • Loading branch information
randolf-scholz authored Feb 19, 2024
1 parent df409a2 commit 601587e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions stdlib/datetime.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
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):
__all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR", "UTC")
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]

Expand Down Expand Up @@ -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: ...
Expand Down Expand Up @@ -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: ...

0 comments on commit 601587e

Please sign in to comment.