mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Use PEP 570 syntax in stdlib (#11250)
This commit is contained in:
@@ -14,12 +14,12 @@ MAXYEAR: Literal[9999]
|
||||
|
||||
class tzinfo:
|
||||
@abstractmethod
|
||||
def tzname(self, __dt: datetime | None) -> str | None: ...
|
||||
def tzname(self, dt: datetime | None, /) -> str | None: ...
|
||||
@abstractmethod
|
||||
def utcoffset(self, __dt: datetime | None) -> timedelta | None: ...
|
||||
def utcoffset(self, dt: datetime | None, /) -> timedelta | None: ...
|
||||
@abstractmethod
|
||||
def dst(self, __dt: datetime | None) -> timedelta | None: ...
|
||||
def fromutc(self, __dt: datetime) -> datetime: ...
|
||||
def dst(self, dt: datetime | None, /) -> timedelta | None: ...
|
||||
def fromutc(self, dt: datetime, /) -> datetime: ...
|
||||
|
||||
# Alias required to avoid name conflicts with date(time).tzinfo.
|
||||
_TzInfo: TypeAlias = tzinfo
|
||||
@@ -30,11 +30,11 @@ class timezone(tzinfo):
|
||||
min: ClassVar[timezone]
|
||||
max: ClassVar[timezone]
|
||||
def __init__(self, offset: timedelta, name: str = ...) -> None: ...
|
||||
def tzname(self, __dt: datetime | None) -> str: ...
|
||||
def utcoffset(self, __dt: datetime | None) -> timedelta: ...
|
||||
def dst(self, __dt: datetime | None) -> None: ...
|
||||
def tzname(self, dt: datetime | None, /) -> str: ...
|
||||
def utcoffset(self, dt: datetime | None, /) -> timedelta: ...
|
||||
def dst(self, dt: datetime | None, /) -> None: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __eq__(self, __value: object) -> bool: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
UTC: timezone
|
||||
@@ -51,13 +51,13 @@ class date:
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(cls, year: SupportsIndex, month: SupportsIndex, day: SupportsIndex) -> Self: ...
|
||||
@classmethod
|
||||
def fromtimestamp(cls, __timestamp: float) -> Self: ...
|
||||
def fromtimestamp(cls, timestamp: float, /) -> Self: ...
|
||||
@classmethod
|
||||
def today(cls) -> Self: ...
|
||||
@classmethod
|
||||
def fromordinal(cls, __n: int) -> Self: ...
|
||||
def fromordinal(cls, n: int, /) -> Self: ...
|
||||
@classmethod
|
||||
def fromisoformat(cls, __date_string: str) -> Self: ...
|
||||
def fromisoformat(cls, date_string: str, /) -> Self: ...
|
||||
@classmethod
|
||||
def fromisocalendar(cls, year: int, week: int, day: int) -> Self: ...
|
||||
@property
|
||||
@@ -73,26 +73,26 @@ class date:
|
||||
if sys.version_info >= (3, 12):
|
||||
def strftime(self, format: str) -> str: ...
|
||||
else:
|
||||
def strftime(self, __format: str) -> str: ...
|
||||
def strftime(self, format: str, /) -> str: ...
|
||||
|
||||
def __format__(self, __fmt: str) -> str: ...
|
||||
def __format__(self, fmt: str, /) -> str: ...
|
||||
def isoformat(self) -> str: ...
|
||||
def timetuple(self) -> struct_time: ...
|
||||
def toordinal(self) -> int: ...
|
||||
def replace(self, year: SupportsIndex = ..., month: SupportsIndex = ..., day: SupportsIndex = ...) -> Self: ...
|
||||
def __le__(self, __value: date) -> bool: ...
|
||||
def __lt__(self, __value: date) -> bool: ...
|
||||
def __ge__(self, __value: date) -> bool: ...
|
||||
def __gt__(self, __value: date) -> bool: ...
|
||||
def __eq__(self, __value: object) -> bool: ...
|
||||
def __add__(self, __value: timedelta) -> Self: ...
|
||||
def __radd__(self, __value: timedelta) -> Self: ...
|
||||
def __le__(self, value: date, /) -> bool: ...
|
||||
def __lt__(self, value: date, /) -> bool: ...
|
||||
def __ge__(self, value: date, /) -> bool: ...
|
||||
def __gt__(self, value: date, /) -> bool: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __add__(self, value: timedelta, /) -> Self: ...
|
||||
def __radd__(self, value: timedelta, /) -> Self: ...
|
||||
@overload
|
||||
def __sub__(self, __value: datetime) -> NoReturn: ...
|
||||
def __sub__(self, value: datetime, /) -> NoReturn: ...
|
||||
@overload
|
||||
def __sub__(self, __value: Self) -> timedelta: ...
|
||||
def __sub__(self, value: Self, /) -> timedelta: ...
|
||||
@overload
|
||||
def __sub__(self, __value: timedelta) -> Self: ...
|
||||
def __sub__(self, value: timedelta, /) -> Self: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def weekday(self) -> int: ...
|
||||
def isoweekday(self) -> int: ...
|
||||
@@ -127,24 +127,24 @@ class time:
|
||||
def tzinfo(self) -> _TzInfo | None: ...
|
||||
@property
|
||||
def fold(self) -> int: ...
|
||||
def __le__(self, __value: time) -> bool: ...
|
||||
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 __le__(self, value: time, /) -> bool: ...
|
||||
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
|
||||
def fromisoformat(cls, __time_string: str) -> Self: ...
|
||||
def fromisoformat(cls, time_string: str, /) -> Self: ...
|
||||
# On <3.12, the name of the parameter in the pure-Python implementation
|
||||
# didn't match the name in the C implementation,
|
||||
# meaning it is only *safe* to pass it as a keyword argument on 3.12+
|
||||
if sys.version_info >= (3, 12):
|
||||
def strftime(self, format: str) -> str: ...
|
||||
else:
|
||||
def strftime(self, __format: str) -> str: ...
|
||||
def strftime(self, format: str, /) -> str: ...
|
||||
|
||||
def __format__(self, __fmt: str) -> str: ...
|
||||
def __format__(self, fmt: str, /) -> str: ...
|
||||
def utcoffset(self) -> timedelta | None: ...
|
||||
def tzname(self) -> str | None: ...
|
||||
def dst(self) -> timedelta | None: ...
|
||||
@@ -183,30 +183,30 @@ class timedelta:
|
||||
@property
|
||||
def microseconds(self) -> int: ...
|
||||
def total_seconds(self) -> float: ...
|
||||
def __add__(self, __value: timedelta) -> timedelta: ...
|
||||
def __radd__(self, __value: timedelta) -> timedelta: ...
|
||||
def __sub__(self, __value: timedelta) -> timedelta: ...
|
||||
def __rsub__(self, __value: timedelta) -> timedelta: ...
|
||||
def __add__(self, value: timedelta, /) -> timedelta: ...
|
||||
def __radd__(self, value: timedelta, /) -> timedelta: ...
|
||||
def __sub__(self, value: timedelta, /) -> timedelta: ...
|
||||
def __rsub__(self, value: timedelta, /) -> timedelta: ...
|
||||
def __neg__(self) -> timedelta: ...
|
||||
def __pos__(self) -> timedelta: ...
|
||||
def __abs__(self) -> timedelta: ...
|
||||
def __mul__(self, __value: float) -> timedelta: ...
|
||||
def __rmul__(self, __value: float) -> timedelta: ...
|
||||
def __mul__(self, value: float, /) -> timedelta: ...
|
||||
def __rmul__(self, value: float, /) -> timedelta: ...
|
||||
@overload
|
||||
def __floordiv__(self, __value: timedelta) -> int: ...
|
||||
def __floordiv__(self, value: timedelta, /) -> int: ...
|
||||
@overload
|
||||
def __floordiv__(self, __value: int) -> timedelta: ...
|
||||
def __floordiv__(self, value: int, /) -> timedelta: ...
|
||||
@overload
|
||||
def __truediv__(self, __value: timedelta) -> float: ...
|
||||
def __truediv__(self, value: timedelta, /) -> float: ...
|
||||
@overload
|
||||
def __truediv__(self, __value: float) -> timedelta: ...
|
||||
def __mod__(self, __value: timedelta) -> timedelta: ...
|
||||
def __divmod__(self, __value: timedelta) -> tuple[int, timedelta]: ...
|
||||
def __le__(self, __value: timedelta) -> bool: ...
|
||||
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 __truediv__(self, value: float, /) -> timedelta: ...
|
||||
def __mod__(self, value: timedelta, /) -> timedelta: ...
|
||||
def __divmod__(self, value: timedelta, /) -> tuple[int, timedelta]: ...
|
||||
def __le__(self, value: timedelta, /) -> bool: ...
|
||||
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: ...
|
||||
|
||||
@@ -246,11 +246,11 @@ class datetime(date):
|
||||
def fromtimestamp(cls, timestamp: float, tz: _TzInfo | None = ...) -> Self: ...
|
||||
else:
|
||||
@classmethod
|
||||
def fromtimestamp(cls, __timestamp: float, tz: _TzInfo | None = ...) -> Self: ...
|
||||
def fromtimestamp(cls, timestamp: float, /, tz: _TzInfo | None = ...) -> Self: ...
|
||||
|
||||
@classmethod
|
||||
@deprecated("Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.UTC)")
|
||||
def utcfromtimestamp(cls, __t: float) -> Self: ...
|
||||
def utcfromtimestamp(cls, t: float, /) -> Self: ...
|
||||
@classmethod
|
||||
def now(cls, tz: _TzInfo | None = None) -> Self: ...
|
||||
@classmethod
|
||||
@@ -279,17 +279,17 @@ class datetime(date):
|
||||
def astimezone(self, tz: _TzInfo | None = ...) -> Self: ...
|
||||
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
|
||||
@classmethod
|
||||
def strptime(cls, __date_string: str, __format: str) -> Self: ...
|
||||
def strptime(cls, date_string: str, format: str, /) -> Self: ...
|
||||
def utcoffset(self) -> timedelta | None: ...
|
||||
def tzname(self) -> str | None: ...
|
||||
def dst(self) -> timedelta | None: ...
|
||||
def __le__(self, __value: datetime) -> bool: ... # type: ignore[override]
|
||||
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 __le__(self, value: datetime, /) -> bool: ... # type: ignore[override]
|
||||
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: ...
|
||||
@overload # type: ignore[override]
|
||||
def __sub__(self, __value: Self) -> timedelta: ...
|
||||
def __sub__(self, value: Self, /) -> timedelta: ...
|
||||
@overload
|
||||
def __sub__(self, __value: timedelta) -> Self: ...
|
||||
def __sub__(self, value: timedelta, /) -> Self: ...
|
||||
|
||||
Reference in New Issue
Block a user