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
7 from paramiko import AuthenticationException as AuthenticationException
8 from pysftp.exceptions import (
9 ConnectionException as ConnectionException,
10 CredentialException as CredentialException,
11 HostKeysException as HostKeysException,
13 from pysftp.helpers import (
14 WTCallbacks as WTCallbacks,
17 known_hosts as known_hosts,
18 path_advance as path_advance,
19 path_retreat as path_retreat,
21 st_mode_to_int as st_mode_to_int,
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: ...
33 _Callback = Callable[[int, int], Any]
34 _Path = Union[Text, bytes]
40 username: str | None = ...,
41 private_key: str | paramiko.RSAKey | paramiko.AgentKey | None = ...,
42 password: str | None = ...,
44 private_key_pass: str | None = ...,
45 ciphers: Sequence[str] | None = ...,
47 cnopts: CnOpts | None = ...,
48 default_path: _Path | None = ...,
51 def pwd(self) -> str: ...
53 self, remotepath: _Path, localpath: _Path | None = ..., callback: _Callback | None = ..., preserve_mtime: bool = ...
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: ...
61 remotepath: _Path | None = ...,
62 callback: _Callback | None = ...,
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: ...
71 remotepath: _Path | None = ...,
73 callback: _Callback | None = ...,
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 = ...
107 def sftp_client(self) -> paramiko.SFTPClient: ...
109 def active_ciphers(self) -> tuple[str, str]: ...
111 def active_compression(self) -> tuple[str, str]: ...
113 def security_options(self) -> paramiko.SecurityOptions: ...
115 def logfile(self) -> str | Literal[False]: ...
117 def timeout(self) -> float | None: ...
119 def timeout(self, val: float | None) -> None: ...
121 def remote_server_key(self) -> paramiko.PKey: ...
122 def __del__(self) -> None: ...
123 def __enter__(self) -> "Connection": ...
125 self, etype: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None