Use TypeAlias where possible for type aliases (#7630)

This commit is contained in:
Alex Waygood
2022-04-16 02:01:00 +01:00
committed by GitHub
parent c0e6dd3f3f
commit 740193a8fc
218 changed files with 760 additions and 625 deletions

View File

@@ -4,7 +4,7 @@ from _typeshed import Self, StrOrBytesPath, StrPath
from os import PathLike
from types import TracebackType
from typing import IO, Any, Callable, Iterable, Iterator, Protocol, Sequence, overload
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias
if sys.version_info >= (3, 8):
__all__ = [
@@ -38,10 +38,10 @@ else:
"LargeZipFile",
]
_DateTuple = tuple[int, int, int, int, int, int]
_ReadWriteMode = Literal["r", "w"]
_ReadWriteBinaryMode = Literal["r", "w", "rb", "wb"]
_ZipFileMode = Literal["r", "w", "x", "a"]
_DateTuple: TypeAlias = tuple[int, int, int, int, int, int]
_ReadWriteMode: TypeAlias = Literal["r", "w"]
_ReadWriteBinaryMode: TypeAlias = Literal["r", "w", "rb", "wb"]
_ZipFileMode: TypeAlias = Literal["r", "w", "x", "a"]
class BadZipFile(Exception): ...