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

@@ -2,6 +2,7 @@ import os
import sys
from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsRead, SupportsWrite
from typing import Any, AnyStr, Callable, Iterable, NamedTuple, Sequence, TypeVar, overload
from typing_extensions import TypeAlias
__all__ = [
"copyfileobj",
@@ -82,7 +83,7 @@ else:
def rmtree(path: StrOrBytesPath, ignore_errors: bool = ..., onerror: Callable[[Any, Any, Any], Any] | None = ...) -> None: ...
_CopyFn = Callable[[str, str], None] | Callable[[StrPath, StrPath], None]
_CopyFn: TypeAlias = Callable[[str, str], None] | Callable[[StrPath, StrPath], None]
# N.B. shutil.move appears to take bytes arguments, however,
# this does not work when dst is (or is within) an existing directory.