massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / shutil.pyi
1 import os
2 import sys
3 from _typeshed import StrOrBytesPath, StrPath, SupportsRead, SupportsWrite
4 from typing import Any, AnyStr, Callable, Iterable, NamedTuple, Sequence, TypeVar, Union, overload
5
6 _PathT = TypeVar("_PathT", str, os.PathLike[str])
7 # Return value of some functions that may either return a path-like object that was passed in or
8 # a string
9 _PathReturn = Any
10
11 class Error(OSError): ...
12 class SameFileError(Error): ...
13 class SpecialFileError(OSError): ...
14 class ExecError(OSError): ...
15 class ReadError(OSError): ...
16 class RegistryError(Exception): ...
17
18 def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ...
19 def copyfile(src: StrPath, dst: _PathT, *, follow_symlinks: bool = ...) -> _PathT: ...
20 def copymode(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
21 def copystat(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
22 def copy(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...
23 def copy2(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...
24 def ignore_patterns(*patterns: StrPath) -> Callable[[Any, list[str]], set[str]]: ...
25
26 if sys.version_info >= (3, 8):
27     def copytree(
28         src: StrPath,
29         dst: StrPath,
30         symlinks: bool = ...,
31         ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = ...,
32         copy_function: Callable[[str, str], None] = ...,
33         ignore_dangling_symlinks: bool = ...,
34         dirs_exist_ok: bool = ...,
35     ) -> _PathReturn: ...
36
37 else:
38     def copytree(
39         src: StrPath,
40         dst: StrPath,
41         symlinks: bool = ...,
42         ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = ...,
43         copy_function: Callable[[str, str], None] = ...,
44         ignore_dangling_symlinks: bool = ...,
45     ) -> _PathReturn: ...
46
47 def rmtree(path: bytes | StrPath, ignore_errors: bool = ..., onerror: Callable[[Any, Any, Any], Any] | None = ...) -> None: ...
48
49 _CopyFn = Union[Callable[[str, str], None], Callable[[StrPath, StrPath], None]]
50
51 if sys.version_info >= (3, 9):
52     def move(src: StrPath, dst: StrPath, copy_function: _CopyFn = ...) -> _PathReturn: ...
53
54 else:
55     # See https://bugs.python.org/issue32689
56     def move(src: str, dst: StrPath, copy_function: _CopyFn = ...) -> _PathReturn: ...
57
58 class _ntuple_diskusage(NamedTuple):
59     total: int
60     used: int
61     free: int
62
63 def disk_usage(path: int | StrOrBytesPath) -> _ntuple_diskusage: ...
64 def chown(path: StrPath, user: str | int | None = ..., group: str | int | None = ...) -> None: ...
65
66 if sys.version_info >= (3, 8):
67     @overload
68     def which(cmd: StrPath, mode: int = ..., path: StrPath | None = ...) -> str | None: ...
69     @overload
70     def which(cmd: bytes, mode: int = ..., path: StrPath | None = ...) -> bytes | None: ...
71
72 else:
73     def which(cmd: StrPath, mode: int = ..., path: StrPath | None = ...) -> str | None: ...
74
75 def make_archive(
76     base_name: str,
77     format: str,
78     root_dir: StrPath | None = ...,
79     base_dir: StrPath | None = ...,
80     verbose: bool = ...,
81     dry_run: bool = ...,
82     owner: str | None = ...,
83     group: str | None = ...,
84     logger: Any | None = ...,
85 ) -> str: ...
86 def get_archive_formats() -> list[tuple[str, str]]: ...
87 def register_archive_format(
88     name: str,
89     function: Callable[..., Any],
90     extra_args: Sequence[tuple[str, Any] | list[Any]] | None = ...,
91     description: str = ...,
92 ) -> None: ...
93 def unregister_archive_format(name: str) -> None: ...
94
95 if sys.version_info >= (3, 7):
96     def unpack_archive(filename: StrPath, extract_dir: StrPath | None = ..., format: str | None = ...) -> None: ...
97
98 else:
99     # See http://bugs.python.org/issue30218
100     def unpack_archive(filename: str, extract_dir: StrPath | None = ..., format: str | None = ...) -> None: ...
101
102 def register_unpack_format(
103     name: str, extensions: list[str], function: Any, extra_args: Sequence[tuple[str, Any]] | None = ..., description: str = ...
104 ) -> None: ...
105 def unregister_unpack_format(name: str) -> None: ...
106 def get_unpack_formats() -> list[tuple[str, list[str], str]]: ...
107 def get_terminal_size(fallback: tuple[int, int] = ...) -> os.terminal_size: ...