Remove compatibility aliases (#5464)

* Remove compatibility aliases

Remove a few instances of Text

Use aliases from _typeshed

* Remove unused imports
This commit is contained in:
Sebastian Rittau
2021-05-15 19:49:20 +02:00
committed by GitHub
parent 056981b957
commit 841a365284
26 changed files with 483 additions and 585 deletions

View File

@@ -4,7 +4,6 @@ from typing import ClassVar, NamedTuple, Optional, SupportsAbs, Tuple, Type, Typ
_S = TypeVar("_S")
_Text = str
MINYEAR: int
MAXYEAR: int
@@ -14,6 +13,9 @@ class tzinfo:
def dst(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
def fromutc(self, dt: datetime) -> datetime: ...
# Alias required to avoid name conflicts with date(time).tzinfo.
_tzinfo = tzinfo
class timezone(tzinfo):
utc: ClassVar[timezone]
min: ClassVar[timezone]
@@ -27,8 +29,6 @@ if sys.version_info >= (3, 9):
week: int
weekday: int
_tzinfo = tzinfo
class date:
min: ClassVar[date]
max: ClassVar[date]
@@ -53,7 +53,7 @@ class date:
@property
def day(self) -> int: ...
def ctime(self) -> str: ...
def strftime(self, fmt: _Text) -> str: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: str) -> str: ...
def isoformat(self) -> str: ...
def timetuple(self) -> struct_time: ...
@@ -116,7 +116,7 @@ class time:
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], time_string: str) -> _S: ...
def strftime(self, fmt: _Text) -> str: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: str) -> str: ...
def utcoffset(self) -> Optional[timedelta]: ...
def tzname(self) -> Optional[str]: ...
@@ -243,7 +243,7 @@ class datetime(date):
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], date_string: str) -> _S: ...
def strftime(self, fmt: _Text) -> str: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: str) -> str: ...
def toordinal(self) -> int: ...
def timetuple(self) -> struct_time: ...
@@ -272,7 +272,7 @@ class datetime(date):
def ctime(self) -> str: ...
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
@classmethod
def strptime(cls, date_string: _Text, format: _Text) -> datetime: ...
def strptime(cls, date_string: str, format: str) -> datetime: ...
def utcoffset(self) -> Optional[timedelta]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[timedelta]: ...