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

@@ -7,7 +7,7 @@ from string import Template
from time import struct_time
from types import FrameType, TracebackType
from typing import Any, ClassVar, Generic, Pattern, TextIO, TypeVar, Union, overload
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias
__all__ = [
"BASIC_FORMAT",
@@ -54,12 +54,12 @@ __all__ = [
"raiseExceptions",
]
_SysExcInfoType = Union[tuple[type[BaseException], BaseException, TracebackType | None], tuple[None, None, None]]
_ExcInfoType = None | bool | _SysExcInfoType | BaseException
_ArgsType = tuple[object, ...] | Mapping[str, object]
_FilterType = Filter | Callable[[LogRecord], int]
_Level = int | str
_FormatStyle = Literal["%", "{", "$"]
_SysExcInfoType: TypeAlias = Union[tuple[type[BaseException], BaseException, TracebackType | None], tuple[None, None, None]]
_ExcInfoType: TypeAlias = None | bool | _SysExcInfoType | BaseException
_ArgsType: TypeAlias = tuple[object, ...] | Mapping[str, object]
_FilterType: TypeAlias = Filter | Callable[[LogRecord], int]
_Level: TypeAlias = int | str
_FormatStyle: TypeAlias = Literal["%", "{", "$"]
raiseExceptions: bool
logThreads: bool