massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / pysftp / pysftp / __init__.pyi
1 from stat import S_IMODE as S_IMODE
2 from types import TracebackType
3 from typing import IO, Any, Callable, ContextManager, Sequence, Text, Type, Union
4 from typing_extensions import Literal
5
6 import paramiko
7 from paramiko import AuthenticationException as AuthenticationException
8 from pysftp.exceptions import (
9     ConnectionException as ConnectionException,
10     CredentialException as CredentialException,
11     HostKeysException as HostKeysException,
12 )
13 from pysftp.helpers import (
14     WTCallbacks as WTCallbacks,
15     _PathCallback,
16     cd as cd,
17     known_hosts as known_hosts,
18     path_advance as path_advance,
19     path_retreat as path_retreat,
20     reparent as reparent,
21     st_mode_to_int as st_mode_to_int,
22     walktree as walktree,
23 )
24
25 class CnOpts:
26     log: bool = ...
27     compression: bool = ...
28     ciphers: Sequence[str] | None = ...
29     hostkeys: paramiko.HostKeys = ...
30     def __init__(self, knownhosts: str | None = ...) -> None: ...
31     def get_hostkey(self, host: str) -> paramiko.PKey: ...
32
33 _Callback = Callable[[int, int], Any]
34 _Path = Union[Text, bytes]
35
36 class Connection:
37     def __init__(
38         self,
39         host: str,
40         username: str | None = ...,
41         private_key: str | paramiko.RSAKey | paramiko.AgentKey | None = ...,
42         password: str | None = ...,
43         port: int = ...,
44         private_key_pass: str | None = ...,
45         ciphers: Sequence[str] | None = ...,
46         log: bool = ...,
47         cnopts: CnOpts | None = ...,
48         default_path: _Path | None = ...,
49     ) -> None: ...
50     @property
51     def pwd(self) -> str: ...
52     def get(
53         self, remotepath: _Path, localpath: _Path | None = ..., callback: _Callback | None = ..., preserve_mtime: bool = ...
54     ) -> None: ...
55     def get_d(self, remotedir: _Path, localdir: _Path, preserve_mtime: bool = ...) -> None: ...
56     def get_r(self, remotedir: _Path, localdir: _Path, preserve_mtime: bool = ...) -> None: ...
57     def getfo(self, remotepath: _Path, flo: IO[bytes], callback: _Callback | None = ...) -> int: ...
58     def put(
59         self,
60         localpath: _Path,
61         remotepath: _Path | None = ...,
62         callback: _Callback | None = ...,
63         confirm: bool = ...,
64         preserve_mtime: bool = ...,
65     ) -> paramiko.SFTPAttributes: ...
66     def put_d(self, localpath: _Path, remotepath: _Path, confirm: bool = ..., preserve_mtime: bool = ...) -> None: ...
67     def put_r(self, localpath: _Path, remotepath: _Path, confirm: bool = ..., preserve_mtime: bool = ...) -> None: ...
68     def putfo(
69         self,
70         flo: IO[bytes],
71         remotepath: _Path | None = ...,
72         file_size: int = ...,
73         callback: _Callback | None = ...,
74         confirm: bool = ...,
75     ) -> paramiko.SFTPAttributes: ...
76     def execute(self, command: str) -> list[str]: ...
77     def cd(self, remotepath: _Path | None = ...) -> ContextManager[None]: ...  # noqa: F811
78     def chdir(self, remotepath: _Path) -> None: ...
79     def cwd(self, remotepath: _Path) -> None: ...
80     def chmod(self, remotepath: _Path, mode: int = ...) -> None: ...
81     def chown(self, remotepath: _Path, uid: int | None = ..., gid: int | None = ...) -> None: ...
82     def getcwd(self) -> str: ...
83     def listdir(self, remotepath: _Path = ...) -> list[str]: ...
84     def listdir_attr(self, remotepath: _Path = ...) -> list[paramiko.SFTPAttributes]: ...
85     def mkdir(self, remotepath: _Path, mode: int = ...) -> None: ...
86     def normalize(self, remotepath: _Path) -> str: ...
87     def isdir(self, remotepath: _Path) -> bool: ...
88     def isfile(self, remotepath: _Path) -> bool: ...
89     def makedirs(self, remotedir: _Path, mode: int = ...) -> None: ...
90     def readlink(self, remotelink: _Path) -> str: ...
91     def remove(self, remotefile: _Path) -> None: ...
92     def unlink(self, remotefile: _Path) -> None: ...
93     def rmdir(self, remotepath: _Path) -> None: ...
94     def rename(self, remote_src: _Path, remote_dest: _Path) -> None: ...
95     def stat(self, remotepath: _Path) -> paramiko.SFTPAttributes: ...
96     def lstat(self, remotepath: _Path) -> paramiko.SFTPAttributes: ...
97     def close(self) -> None: ...
98     def open(self, remote_file: _Path, mode: str = ..., bufsize: int = ...) -> paramiko.SFTPFile: ...
99     def exists(self, remotepath: _Path) -> bool: ...
100     def lexists(self, remotepath: _Path) -> bool: ...
101     def symlink(self, remote_src: _Path, remote_dest: _Path) -> None: ...
102     def truncate(self, remotepath: _Path, size: int) -> int: ...
103     def walktree(  # noqa: F811
104         self, remotepath: _Path, fcallback: _PathCallback, dcallback: _PathCallback, ucallback: _PathCallback, recurse: bool = ...
105     ) -> None: ...
106     @property
107     def sftp_client(self) -> paramiko.SFTPClient: ...
108     @property
109     def active_ciphers(self) -> tuple[str, str]: ...
110     @property
111     def active_compression(self) -> tuple[str, str]: ...
112     @property
113     def security_options(self) -> paramiko.SecurityOptions: ...
114     @property
115     def logfile(self) -> str | Literal[False]: ...
116     @property
117     def timeout(self) -> float | None: ...
118     @timeout.setter
119     def timeout(self, val: float | None) -> None: ...
120     @property
121     def remote_server_key(self) -> paramiko.PKey: ...
122     def __del__(self) -> None: ...
123     def __enter__(self) -> "Connection": ...
124     def __exit__(
125         self, etype: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
126     ) -> None: ...