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

@@ -1,5 +1,5 @@
from typing import Callable, Mapping, Sequence
from typing_extensions import Final
from typing_extensions import Final, TypeAlias
paFloat32: Final[int]
paInt32: Final[int]
@@ -67,10 +67,10 @@ paPrimingOutput: Final[int]
paMacCoreStreamInfo: PaMacCoreStreamInfo
# Auxiliary types
_ChannelMap = Sequence[int]
_PaHostApiInfo = Mapping[str, str | int]
_PaDeviceInfo = Mapping[str, str | int | float]
_StreamCallback = Callable[[bytes | None, int, Mapping[str, float], int], tuple[bytes | None, int]]
_ChannelMap: TypeAlias = Sequence[int]
_PaHostApiInfo: TypeAlias = Mapping[str, str | int]
_PaDeviceInfo: TypeAlias = Mapping[str, str | int | float]
_StreamCallback: TypeAlias = Callable[[bytes | None, int, Mapping[str, float], int], tuple[bytes | None, int]]
def get_format_from_width(width: int, unsigned: bool = ...) -> int: ...
def get_portaudio_version() -> int: ...