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

@@ -3,16 +3,16 @@ import socket
import sys
from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer
from typing import Any, Callable, Iterable, NamedTuple, Union, overload
from typing_extensions import Literal, TypedDict, final
from typing_extensions import Literal, TypeAlias, TypedDict, final
_PCTRTT = tuple[tuple[str, str], ...]
_PCTRTTT = tuple[_PCTRTT, ...]
_PeerCertRetDictType = dict[str, str | _PCTRTTT | _PCTRTT]
_PeerCertRetType = _PeerCertRetDictType | bytes | None
_EnumRetType = list[tuple[bytes, str, set[str] | bool]]
_PasswordType = Union[Callable[[], str | bytes], str, bytes]
_PCTRTT: TypeAlias = tuple[tuple[str, str], ...]
_PCTRTTT: TypeAlias = tuple[_PCTRTT, ...]
_PeerCertRetDictType: TypeAlias = dict[str, str | _PCTRTTT | _PCTRTT]
_PeerCertRetType: TypeAlias = _PeerCertRetDictType | bytes | None
_EnumRetType: TypeAlias = list[tuple[bytes, str, set[str] | bool]]
_PasswordType: TypeAlias = Union[Callable[[], str | bytes], str, bytes]
_SrvnmeCbType = Callable[[SSLSocket | SSLObject, str | None, SSLSocket], int | None]
_SrvnmeCbType: TypeAlias = Callable[[SSLSocket | SSLObject, str | None, SSLSocket], int | None]
class _Cipher(TypedDict):
aead: bool