mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from time import struct_time
|
||||
from typing import AnyStr, ClassVar, SupportsAbs, Tuple, Type, TypeVar, Union, overload
|
||||
from typing import AnyStr, ClassVar, SupportsAbs, TypeVar, Union, overload
|
||||
|
||||
_S = TypeVar("_S")
|
||||
|
||||
@@ -20,13 +20,13 @@ class date:
|
||||
min: ClassVar[date]
|
||||
max: ClassVar[date]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(cls: Type[_S], year: int, month: int, day: int) -> _S: ...
|
||||
def __new__(cls: type[_S], year: int, month: int, day: int) -> _S: ...
|
||||
@classmethod
|
||||
def fromtimestamp(cls: Type[_S], __timestamp: float) -> _S: ...
|
||||
def fromtimestamp(cls: type[_S], __timestamp: float) -> _S: ...
|
||||
@classmethod
|
||||
def today(cls: Type[_S]) -> _S: ...
|
||||
def today(cls: type[_S]) -> _S: ...
|
||||
@classmethod
|
||||
def fromordinal(cls: Type[_S], n: int) -> _S: ...
|
||||
def fromordinal(cls: type[_S], n: int) -> _S: ...
|
||||
@property
|
||||
def year(self) -> int: ...
|
||||
@property
|
||||
@@ -53,14 +53,14 @@ class date:
|
||||
def __hash__(self) -> int: ...
|
||||
def weekday(self) -> int: ...
|
||||
def isoweekday(self) -> int: ...
|
||||
def isocalendar(self) -> Tuple[int, int, int]: ...
|
||||
def isocalendar(self) -> tuple[int, int, int]: ...
|
||||
|
||||
class time:
|
||||
min: ClassVar[time]
|
||||
max: ClassVar[time]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(
|
||||
cls: Type[_S], hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: _tzinfo | None = ...
|
||||
cls: type[_S], hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: _tzinfo | None = ...
|
||||
) -> _S: ...
|
||||
@property
|
||||
def hour(self) -> int: ...
|
||||
@@ -95,7 +95,7 @@ class timedelta(SupportsAbs[timedelta]):
|
||||
max: ClassVar[timedelta]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(
|
||||
cls: Type[_S],
|
||||
cls: type[_S],
|
||||
days: float = ...,
|
||||
seconds: float = ...,
|
||||
microseconds: float = ...,
|
||||
@@ -139,7 +139,7 @@ class datetime(date):
|
||||
max: ClassVar[datetime]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(
|
||||
cls: Type[_S],
|
||||
cls: type[_S],
|
||||
year: int,
|
||||
month: int,
|
||||
day: int,
|
||||
@@ -166,21 +166,21 @@ class datetime(date):
|
||||
@property
|
||||
def tzinfo(self) -> _tzinfo | None: ...
|
||||
@classmethod
|
||||
def fromtimestamp(cls: Type[_S], t: float, tz: _tzinfo | None = ...) -> _S: ...
|
||||
def fromtimestamp(cls: type[_S], t: float, tz: _tzinfo | None = ...) -> _S: ...
|
||||
@classmethod
|
||||
def utcfromtimestamp(cls: Type[_S], t: float) -> _S: ...
|
||||
def utcfromtimestamp(cls: type[_S], t: float) -> _S: ...
|
||||
@classmethod
|
||||
def today(cls: Type[_S]) -> _S: ...
|
||||
def today(cls: type[_S]) -> _S: ...
|
||||
@classmethod
|
||||
def fromordinal(cls: Type[_S], n: int) -> _S: ...
|
||||
def fromordinal(cls: type[_S], n: int) -> _S: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def now(cls: Type[_S], tz: None = ...) -> _S: ...
|
||||
def now(cls: type[_S], tz: None = ...) -> _S: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def now(cls, tz: _tzinfo) -> datetime: ...
|
||||
@classmethod
|
||||
def utcnow(cls: Type[_S]) -> _S: ...
|
||||
def utcnow(cls: type[_S]) -> _S: ...
|
||||
@classmethod
|
||||
def combine(cls, date: _date, time: _time) -> datetime: ...
|
||||
def strftime(self, fmt: _Text) -> str: ...
|
||||
@@ -223,4 +223,4 @@ class datetime(date):
|
||||
def __hash__(self) -> int: ...
|
||||
def weekday(self) -> int: ...
|
||||
def isoweekday(self) -> int: ...
|
||||
def isocalendar(self) -> Tuple[int, int, int]: ...
|
||||
def isocalendar(self) -> tuple[int, int, int]: ...
|
||||
|
||||
Reference in New Issue
Block a user