Remove compatibility aliases (#5464)

* Remove compatibility aliases

Remove a few instances of Text

Use aliases from _typeshed

* Remove unused imports
This commit is contained in:
Sebastian Rittau
2021-05-15 19:49:20 +02:00
committed by GitHub
parent 056981b957
commit 841a365284
26 changed files with 483 additions and 585 deletions

View File

@@ -3,8 +3,7 @@ import sys
from _typeshed import StrPath, SupportsRead, SupportsWrite
from typing import Any, AnyStr, Callable, Iterable, List, NamedTuple, Optional, Sequence, Set, Tuple, TypeVar, Union, overload
_AnyStr = str
_AnyPath = TypeVar("_AnyPath", str, os.PathLike[str])
_PathT = TypeVar("_PathT", str, os.PathLike[str])
# Return value of some functions that may either return a path-like object that was passed in or
# a string
_PathReturn = Any
@@ -17,12 +16,12 @@ class ReadError(OSError): ...
class RegistryError(Exception): ...
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ...
def copyfile(src: StrPath, dst: _AnyPath, *, follow_symlinks: bool = ...) -> _AnyPath: ...
def copyfile(src: StrPath, dst: _PathT, *, follow_symlinks: bool = ...) -> _PathT: ...
def copymode(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
def copystat(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
def copy(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...
def copy2(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...
def ignore_patterns(*patterns: StrPath) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
def ignore_patterns(*patterns: StrPath) -> Callable[[Any, List[str]], Set[str]]: ...
if sys.version_info >= (3, 8):
def copytree(
@@ -76,7 +75,7 @@ else:
def which(cmd: StrPath, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[str]: ...
def make_archive(
base_name: _AnyStr,
base_name: str,
format: str,
root_dir: Optional[StrPath] = ...,
base_dir: Optional[StrPath] = ...,
@@ -85,7 +84,7 @@ def make_archive(
owner: Optional[str] = ...,
group: Optional[str] = ...,
logger: Optional[Any] = ...,
) -> _AnyStr: ...
) -> str: ...
def get_archive_formats() -> List[Tuple[str, str]]: ...
def register_archive_format(
name: str,