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
+2 -1
View File
@@ -3,10 +3,11 @@ from _typeshed import StrOrBytesPath
from asyncio.events import AbstractEventLoop
from os import stat_result
from typing import Any, Sequence, overload
from typing_extensions import TypeAlias
from . import ospath as path
_FdOrAnyPath = int | StrOrBytesPath
_FdOrAnyPath: TypeAlias = int | StrOrBytesPath
async def stat(
path: _FdOrAnyPath, # noqa: F811
@@ -8,14 +8,14 @@ from _typeshed import (
)
from asyncio import AbstractEventLoop
from typing import Any, Callable, overload
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias
from ..base import AiofilesContextManager
from .binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO, _UnknownAsyncBinaryIO
from .text import AsyncTextIOWrapper
_OpenFile = StrOrBytesPath | int
_Opener = Callable[[str, int], int]
_OpenFile: TypeAlias = StrOrBytesPath | int
_Opener: TypeAlias = Callable[[str, int], int]
# Text mode: always returns AsyncTextIOWrapper
@overload