mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-24 03:51:52 +08:00
AnyStr cleanup (#5487)
* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs. * Add StrOrBytesPath as preferred alias for AnyPath. * Replace all remaining AnyPath instances with StrOrBytesPath. * Mark AnyPath as obsolete. Part of #5470
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from _typeshed import StrPath, SupportsRead, SupportsWrite
|
||||
from typing import Any, AnyStr, Callable, Iterable, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union
|
||||
from _typeshed import SupportsRead, SupportsWrite
|
||||
from typing import Any, AnyStr, Callable, Iterable, List, Optional, Sequence, Set, Text, Tuple, Type, TypeVar, Union
|
||||
|
||||
_AnyStr = TypeVar("_AnyStr", str, unicode)
|
||||
_AnyPath = TypeVar("_AnyPath", str, unicode)
|
||||
@@ -10,25 +10,25 @@ class SpecialFileError(EnvironmentError): ...
|
||||
class ExecError(EnvironmentError): ...
|
||||
|
||||
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ...
|
||||
def copyfile(src: StrPath, dst: StrPath) -> None: ...
|
||||
def copymode(src: StrPath, dst: StrPath) -> None: ...
|
||||
def copystat(src: StrPath, dst: StrPath) -> None: ...
|
||||
def copy(src: StrPath, dst: StrPath) -> _PathReturn: ...
|
||||
def copy2(src: StrPath, dst: StrPath) -> _PathReturn: ...
|
||||
def ignore_patterns(*patterns: StrPath) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
|
||||
def copyfile(src: Text, dst: Text) -> None: ...
|
||||
def copymode(src: Text, dst: Text) -> None: ...
|
||||
def copystat(src: Text, dst: Text) -> None: ...
|
||||
def copy(src: Text, dst: Text) -> _PathReturn: ...
|
||||
def copy2(src: Text, dst: Text) -> _PathReturn: ...
|
||||
def ignore_patterns(*patterns: Text) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
|
||||
def copytree(
|
||||
src: AnyStr, dst: AnyStr, symlinks: bool = ..., ignore: Union[None, Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]]] = ...
|
||||
) -> _PathReturn: ...
|
||||
def rmtree(path: _AnyPath, ignore_errors: bool = ..., onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...) -> None: ...
|
||||
|
||||
_CopyFn = Union[Callable[[str, str], None], Callable[[StrPath, StrPath], None]]
|
||||
_CopyFn = Union[Callable[[str, str], None], Callable[[Text, Text], None]]
|
||||
|
||||
def move(src: StrPath, dst: StrPath) -> _PathReturn: ...
|
||||
def move(src: Text, dst: Text) -> _PathReturn: ...
|
||||
def make_archive(
|
||||
base_name: _AnyStr,
|
||||
format: str,
|
||||
root_dir: Optional[StrPath] = ...,
|
||||
base_dir: Optional[StrPath] = ...,
|
||||
root_dir: Optional[Text] = ...,
|
||||
base_dir: Optional[Text] = ...,
|
||||
verbose: bool = ...,
|
||||
dry_run: bool = ...,
|
||||
owner: Optional[str] = ...,
|
||||
|
||||
Reference in New Issue
Block a user