mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Added 'shutil' API changes between 3.3 and 3.5 (#915)
As of Python 3.3, copymode, copystat, copy and copy2 take an optional argument, 'follow_symlinks'. As of Python 3.3, copytree and move return the destination. As of Python 3.5, move takes an optional copy function. As of Python 3.3, disk_usage, chown, which and get_terminal_size were added.
This commit is contained in:
committed by
Guido van Rossum
parent
c9e992ea8d
commit
31d4a4277b
@@ -7,25 +7,67 @@ import sys
|
||||
# sometimes they only work partially (broken exception messages), and the test
|
||||
# cases don't use them.
|
||||
|
||||
from typing import List, Iterable, Callable, Any, Tuple, Sequence, IO, AnyStr, Optional
|
||||
from typing import (
|
||||
List, Iterable, Callable, Any, Tuple, Sequence, NamedTuple, IO,
|
||||
AnyStr, Optional
|
||||
)
|
||||
|
||||
def copyfileobj(fsrc: IO[AnyStr], fdst: IO[AnyStr],
|
||||
length: int = ...) -> None: ...
|
||||
|
||||
def copyfile(src: str, dst: str) -> None: ...
|
||||
def copymode(src: str, dst: str) -> None: ...
|
||||
def copystat(src: str, dst: str) -> None: ...
|
||||
def copy(src: str, dst: str) -> None: ...
|
||||
def copy2(src: str, dst: str) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
def copymode(src: str, dst: str, *,
|
||||
follow_symlinks: bool = ...) -> None: ...
|
||||
def copystat(src: str, dst: str, *,
|
||||
follow_symlinks: bool = ...) -> None: ...
|
||||
def copy(src: str, dst: str, *,
|
||||
follow_symlinks: bool = ...) -> None: ...
|
||||
def copy2(src: str, dst: str, *,
|
||||
follow_symlinks: bool = ...) -> None: ...
|
||||
else:
|
||||
def copymode(src: str, dst: str) -> None: ...
|
||||
def copystat(src: str, dst: str) -> None: ...
|
||||
def copy(src: str, dst: str) -> None: ...
|
||||
def copy2(src: str, dst: str) -> None: ...
|
||||
|
||||
def ignore_patterns(*patterns: str) -> Callable[[str, List[str]],
|
||||
Iterable[str]]: ...
|
||||
def copytree(src: str, dst: str, symlinks: bool = ...,
|
||||
ignore: Optional[Callable[[str, List[str]], Iterable[str]]] = ...,
|
||||
copy_function: Callable[[str, str], None] = ...,
|
||||
ignore_dangling_symlinks: bool = ...) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
def copytree(src: str, dst: str, symlinks: bool = ...,
|
||||
ignore: Optional[Callable[[str, List[str]],
|
||||
Iterable[str]]] = ...,
|
||||
copy_function: Callable[[str, str], None] = ...,
|
||||
ignore_dangling_symlinks: bool = ...) -> str: ...
|
||||
else:
|
||||
def copytree(src: str, dst: str, symlinks: bool = ...,
|
||||
ignore: Optional[Callable[[str, List[str]],
|
||||
Iterable[str]]] = ...,
|
||||
copy_function: Callable[[str, str], None] = ...,
|
||||
ignore_dangling_symlinks: bool = ...) -> None: ...
|
||||
|
||||
def rmtree(path: str, ignore_errors: bool = ...,
|
||||
onerror: Callable[[Any, str, Any], None] = ...) -> None: ...
|
||||
def move(src: str, dst: str) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
def move(src: str, dst: str,
|
||||
copy_function: Callable[[str, str], None] = ...) -> str: ...
|
||||
elif sys.version_info >= (3, 3):
|
||||
def move(src: str, dst: str) -> str: ...
|
||||
else:
|
||||
def move(src: str, dst: str) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
_ntuple_diskusage = NamedTuple('usage', [('total', int),
|
||||
('used', int),
|
||||
('free', int)])
|
||||
def disk_usage(path: str) -> _ntuple_diskusage: ...
|
||||
def chown(path: str, user: Optional[str] = ...,
|
||||
group: Optional[str] = ...) -> None: ...
|
||||
def which(cmd: str, mode: int = ...,
|
||||
path: Optional[str] = ...) -> Optional[str]: ...
|
||||
|
||||
class Error(Exception): ...
|
||||
if sys.version_info >= (3, 4):
|
||||
@@ -48,4 +90,5 @@ def register_unpack_format(name: str, extensions: List[str], function: Any,
|
||||
def unregister_unpack_format(name: str) -> None: ...
|
||||
def get_unpack_formats() -> List[Tuple[str, List[str], str]]: ...
|
||||
|
||||
def which(cmd: str, mode: int = ..., path: str = ...) -> Optional[str]: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def get_terminal_size(fallback: Tuple[int, int] = ...) -> Tuple[int, int]: ...
|
||||
|
||||
Reference in New Issue
Block a user