mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-24 03:51:52 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from time import struct_time
|
||||
from typing import ClassVar, NamedTuple, Optional, SupportsAbs, Tuple, Type, TypeVar, overload
|
||||
from typing import ClassVar, NamedTuple, SupportsAbs, Tuple, Type, TypeVar, overload
|
||||
|
||||
_S = TypeVar("_S")
|
||||
|
||||
@@ -8,9 +8,9 @@ MINYEAR: int
|
||||
MAXYEAR: int
|
||||
|
||||
class tzinfo:
|
||||
def tzname(self, dt: Optional[datetime]) -> Optional[str]: ...
|
||||
def utcoffset(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
|
||||
def dst(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
|
||||
def tzname(self, dt: datetime | None) -> str | None: ...
|
||||
def utcoffset(self, dt: datetime | None) -> timedelta | None: ...
|
||||
def dst(self, dt: datetime | None) -> timedelta | None: ...
|
||||
def fromutc(self, dt: datetime) -> datetime: ...
|
||||
|
||||
# Alias required to avoid name conflicts with date(time).tzinfo.
|
||||
@@ -91,7 +91,7 @@ class time:
|
||||
minute: int = ...,
|
||||
second: int = ...,
|
||||
microsecond: int = ...,
|
||||
tzinfo: Optional[_tzinfo] = ...,
|
||||
tzinfo: _tzinfo | None = ...,
|
||||
*,
|
||||
fold: int = ...,
|
||||
) -> _S: ...
|
||||
@@ -104,7 +104,7 @@ class time:
|
||||
@property
|
||||
def microsecond(self) -> int: ...
|
||||
@property
|
||||
def tzinfo(self) -> Optional[_tzinfo]: ...
|
||||
def tzinfo(self) -> _tzinfo | None: ...
|
||||
@property
|
||||
def fold(self) -> int: ...
|
||||
def __le__(self, other: time) -> bool: ...
|
||||
@@ -118,16 +118,16 @@ class time:
|
||||
def fromisoformat(cls: Type[_S], time_string: str) -> _S: ...
|
||||
def strftime(self, fmt: str) -> str: ...
|
||||
def __format__(self, fmt: str) -> str: ...
|
||||
def utcoffset(self) -> Optional[timedelta]: ...
|
||||
def tzname(self) -> Optional[str]: ...
|
||||
def dst(self) -> Optional[timedelta]: ...
|
||||
def utcoffset(self) -> timedelta | None: ...
|
||||
def tzname(self) -> str | None: ...
|
||||
def dst(self) -> timedelta | None: ...
|
||||
def replace(
|
||||
self,
|
||||
hour: int = ...,
|
||||
minute: int = ...,
|
||||
second: int = ...,
|
||||
microsecond: int = ...,
|
||||
tzinfo: Optional[_tzinfo] = ...,
|
||||
tzinfo: _tzinfo | None = ...,
|
||||
*,
|
||||
fold: int = ...,
|
||||
) -> time: ...
|
||||
@@ -195,7 +195,7 @@ class datetime(date):
|
||||
minute: int = ...,
|
||||
second: int = ...,
|
||||
microsecond: int = ...,
|
||||
tzinfo: Optional[_tzinfo] = ...,
|
||||
tzinfo: _tzinfo | None = ...,
|
||||
*,
|
||||
fold: int = ...,
|
||||
) -> _S: ...
|
||||
@@ -214,11 +214,11 @@ class datetime(date):
|
||||
@property
|
||||
def microsecond(self) -> int: ...
|
||||
@property
|
||||
def tzinfo(self) -> Optional[_tzinfo]: ...
|
||||
def tzinfo(self) -> _tzinfo | None: ...
|
||||
@property
|
||||
def fold(self) -> int: ...
|
||||
@classmethod
|
||||
def fromtimestamp(cls: Type[_S], t: float, tz: Optional[_tzinfo] = ...) -> _S: ...
|
||||
def fromtimestamp(cls: Type[_S], t: float, tz: _tzinfo | None = ...) -> _S: ...
|
||||
@classmethod
|
||||
def utcfromtimestamp(cls: Type[_S], t: float) -> _S: ...
|
||||
@classmethod
|
||||
@@ -227,7 +227,7 @@ class datetime(date):
|
||||
def fromordinal(cls: Type[_S], n: int) -> _S: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@classmethod
|
||||
def now(cls: Type[_S], tz: Optional[_tzinfo] = ...) -> _S: ...
|
||||
def now(cls: Type[_S], tz: _tzinfo | None = ...) -> _S: ...
|
||||
else:
|
||||
@overload
|
||||
@classmethod
|
||||
@@ -238,7 +238,7 @@ class datetime(date):
|
||||
@classmethod
|
||||
def utcnow(cls: Type[_S]) -> _S: ...
|
||||
@classmethod
|
||||
def combine(cls, date: _date, time: _time, tzinfo: Optional[_tzinfo] = ...) -> datetime: ...
|
||||
def combine(cls, date: _date, time: _time, tzinfo: _tzinfo | None = ...) -> datetime: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
@classmethod
|
||||
def fromisoformat(cls: Type[_S], date_string: str) -> _S: ...
|
||||
@@ -260,21 +260,21 @@ class datetime(date):
|
||||
minute: int = ...,
|
||||
second: int = ...,
|
||||
microsecond: int = ...,
|
||||
tzinfo: Optional[_tzinfo] = ...,
|
||||
tzinfo: _tzinfo | None = ...,
|
||||
*,
|
||||
fold: int = ...,
|
||||
) -> datetime: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def astimezone(self: _S, tz: Optional[_tzinfo] = ...) -> _S: ...
|
||||
def astimezone(self: _S, tz: _tzinfo | None = ...) -> _S: ...
|
||||
else:
|
||||
def astimezone(self, tz: Optional[_tzinfo] = ...) -> datetime: ...
|
||||
def astimezone(self, tz: _tzinfo | None = ...) -> datetime: ...
|
||||
def ctime(self) -> str: ...
|
||||
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
|
||||
@classmethod
|
||||
def strptime(cls, date_string: str, format: str) -> datetime: ...
|
||||
def utcoffset(self) -> Optional[timedelta]: ...
|
||||
def tzname(self) -> Optional[str]: ...
|
||||
def dst(self) -> Optional[timedelta]: ...
|
||||
def utcoffset(self) -> timedelta | None: ...
|
||||
def tzname(self) -> str | None: ...
|
||||
def dst(self) -> timedelta | None: ...
|
||||
def __le__(self, other: datetime) -> bool: ... # type: ignore
|
||||
def __lt__(self, other: datetime) -> bool: ... # type: ignore
|
||||
def __ge__(self, other: datetime) -> bool: ... # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user