Use TypeAlias for type aliases where possible, part II (#7667)

This commit is contained in:
Alex Waygood
2022-04-20 20:02:47 +01:00
committed by GitHub
parent c653be73b8
commit b093c90a94
41 changed files with 91 additions and 90 deletions

View File

@@ -2,7 +2,7 @@ import sys
from _typeshed import Self
from time import struct_time
from typing import ClassVar, NamedTuple, NoReturn, SupportsAbs, TypeVar, overload
from typing_extensions import Literal, final
from typing_extensions import Literal, TypeAlias, final
if sys.version_info >= (3, 9):
__all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR")
@@ -19,7 +19,7 @@ class tzinfo:
def fromutc(self, __dt: datetime) -> datetime: ...
# Alias required to avoid name conflicts with date(time).tzinfo.
_tzinfo = tzinfo
_tzinfo: TypeAlias = tzinfo
@final
class timezone(tzinfo):
@@ -150,8 +150,8 @@ class time:
fold: int = ...,
) -> Self: ...
_date = date
_time = time
_date: TypeAlias = date
_time: TypeAlias = time
class timedelta(SupportsAbs[timedelta]):
min: ClassVar[timedelta]