massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / paramiko / paramiko / transport.pyi
1 from logging import Logger
2 from socket import socket
3 from threading import Condition, Event, Lock, Thread
4 from types import ModuleType
5 from typing import Any, Callable, Iterable, Protocol, Sequence, Tuple, Type
6
7 from paramiko.auth_handler import AuthHandler, _InteractiveCallback
8 from paramiko.channel import Channel
9 from paramiko.message import Message
10 from paramiko.packet import Packetizer
11 from paramiko.pkey import PKey
12 from paramiko.server import ServerInterface, SubsystemHandler
13 from paramiko.sftp_client import SFTPClient
14 from paramiko.ssh_gss import _SSH_GSSAuth
15 from paramiko.util import ClosingContextManager
16
17 _Addr = Tuple[str, int]
18
19 class _KexEngine(Protocol):
20     def start_kex(self) -> None: ...
21     def parse_next(self, ptype: int, m: Message) -> None: ...
22
23 class Transport(Thread, ClosingContextManager):
24     active: bool
25     hostname: str | None
26     sock: socket
27     packetizer: Packetizer
28     local_version: str
29     remote_version: str
30     local_cipher: str
31     local_kex_init: bytes | None
32     local_mac: str | None
33     local_compression: str | None
34     session_id: bytes | None
35     host_key_type: str | None
36     host_key: PKey | None
37     use_gss_kex: bool
38     gss_kex_used: bool
39     kexgss_ctxt: _SSH_GSSAuth | None
40     gss_host: str
41     kex_engine: _KexEngine | None
42     H: bytes | None
43     K: int | None
44     initial_kex_done: bool
45     in_kex: bool
46     authenticated: bool
47     lock: Lock
48     channel_events: dict[int, Event]
49     channels_seen: dict[int, bool]
50     default_max_packet_size: int
51     default_window_size: int
52     saved_exception: Exception | None
53     clear_to_send: Event
54     clear_to_send_lock: Lock
55     clear_to_send_timeout: float
56     log_name: str
57     logger: Logger
58     auth_handler: AuthHandler | None
59     global_response: Message | None
60     completion_event: Event | None
61     banner_timeout: float
62     handshake_timeout: float
63     auth_timeout: float
64     disabled_algorithms: dict[str, Iterable[str]] | None
65     server_mode: bool
66     server_object: ServerInterface | None
67     server_key_dict: dict[str, PKey]
68     server_accepts: list[Channel]
69     server_accept_cv: Condition
70     subsystem_table: dict[str, tuple[Type[SubsystemHandler], Tuple[Any, ...], dict[str, Any]]]
71     sys: ModuleType
72     def __init__(
73         self,
74         sock: str | tuple[str, int] | socket,
75         default_window_size: int = ...,
76         default_max_packet_size: int = ...,
77         gss_kex: bool = ...,
78         gss_deleg_creds: bool = ...,
79         disabled_algorithms: dict[str, Iterable[str]] | None = ...,
80     ) -> None: ...
81     @property
82     def preferred_ciphers(self) -> Sequence[str]: ...
83     @property
84     def preferred_macs(self) -> Sequence[str]: ...
85     @property
86     def preferred_keys(self) -> Sequence[str]: ...
87     @property
88     def preferred_kex(self) -> Sequence[str]: ...
89     @property
90     def preferred_compression(self) -> Sequence[str]: ...
91     def atfork(self) -> None: ...
92     def get_security_options(self) -> SecurityOptions: ...
93     def set_gss_host(self, gss_host: str | None, trust_dns: bool = ..., gssapi_requested: bool = ...) -> None: ...
94     def start_client(self, event: Event | None = ..., timeout: float | None = ...) -> None: ...
95     def start_server(self, event: Event = ..., server: ServerInterface | None = ...) -> None: ...
96     def add_server_key(self, key: PKey) -> None: ...
97     def get_server_key(self) -> PKey | None: ...
98     @staticmethod
99     def load_server_moduli(filename: str | None = ...) -> bool: ...
100     def close(self) -> None: ...
101     def get_remote_server_key(self) -> PKey: ...
102     def is_active(self) -> bool: ...
103     def open_session(
104         self, window_size: int | None = ..., max_packet_size: int | None = ..., timeout: float | None = ...
105     ) -> Channel: ...
106     def open_x11_channel(self, src_addr: _Addr = ...) -> Channel: ...
107     def open_forward_agent_channel(self) -> Channel: ...
108     def open_forwarded_tcpip_channel(self, src_addr: _Addr, dest_addr: _Addr) -> Channel: ...
109     def open_channel(
110         self,
111         kind: str,
112         dest_addr: _Addr | None = ...,
113         src_addr: _Addr | None = ...,
114         window_size: int | None = ...,
115         max_packet_size: int | None = ...,
116         timeout: float | None = ...,
117     ) -> Channel: ...
118     def request_port_forward(
119         self, address: str, port: int, handler: Callable[[Channel, _Addr, _Addr], None] | None = ...
120     ) -> int: ...
121     def cancel_port_forward(self, address: str, port: int) -> None: ...
122     def open_sftp_client(self) -> SFTPClient | None: ...
123     def send_ignore(self, byte_count: int = ...) -> None: ...
124     def renegotiate_keys(self) -> None: ...
125     def set_keepalive(self, interval: int) -> None: ...
126     def global_request(self, kind: str, data: Iterable[Any] | None = ..., wait: bool = ...) -> Message | None: ...
127     def accept(self, timeout: float | None = ...) -> Channel | None: ...
128     def connect(
129         self,
130         hostkey: PKey | None = ...,
131         username: str = ...,
132         password: str | None = ...,
133         pkey: PKey | None = ...,
134         gss_host: str | None = ...,
135         gss_auth: bool = ...,
136         gss_kex: bool = ...,
137         gss_deleg_creds: bool = ...,
138         gss_trust_dns: bool = ...,
139     ) -> None: ...
140     def get_exception(self) -> Exception | None: ...
141     def set_subsystem_handler(self, name: str, handler: Type[SubsystemHandler], *larg: Any, **kwarg: Any) -> None: ...
142     def is_authenticated(self) -> bool: ...
143     def get_username(self) -> str | None: ...
144     def get_banner(self) -> bytes | None: ...
145     def auth_none(self, username: str) -> list[str]: ...
146     def auth_password(self, username: str, password: str, event: Event | None = ..., fallback: bool = ...) -> list[str]: ...
147     def auth_publickey(self, username: str, key: PKey, event: Event | None = ...) -> list[str]: ...
148     def auth_interactive(self, username: str, handler: _InteractiveCallback, submethods: str = ...) -> list[str]: ...
149     def auth_interactive_dumb(
150         self, username: str, handler: _InteractiveCallback | None = ..., submethods: str = ...
151     ) -> list[str]: ...
152     def auth_gssapi_with_mic(self, username: str, gss_host: str, gss_deleg_creds: bool) -> list[str]: ...
153     def auth_gssapi_keyex(self, username: str) -> list[str]: ...
154     def set_log_channel(self, name: str) -> None: ...
155     def get_log_channel(self) -> str: ...
156     def set_hexdump(self, hexdump: bool) -> None: ...
157     def get_hexdump(self) -> bool: ...
158     def use_compression(self, compress: bool = ...) -> None: ...
159     def getpeername(self) -> tuple[str, int]: ...
160     def stop_thread(self) -> None: ...
161     def run(self) -> None: ...
162
163 class SecurityOptions:
164     def __init__(self, transport: Transport) -> None: ...
165     @property
166     def ciphers(self) -> Sequence[str]: ...
167     @ciphers.setter
168     def ciphers(self, x: Sequence[str]) -> None: ...
169     @property
170     def digests(self) -> Sequence[str]: ...
171     @digests.setter
172     def digests(self, x: Sequence[str]) -> None: ...
173     @property
174     def key_types(self) -> Sequence[str]: ...
175     @key_types.setter
176     def key_types(self, x: Sequence[str]) -> None: ...
177     @property
178     def kex(self) -> Sequence[str]: ...
179     @kex.setter
180     def kex(self, x: Sequence[str]) -> None: ...
181     @property
182     def compression(self) -> Sequence[str]: ...
183     @compression.setter
184     def compression(self, x: Sequence[str]) -> None: ...
185
186 class ChannelMap:
187     def __init__(self) -> None: ...
188     def put(self, chanid: int, chan: Channel) -> None: ...
189     def get(self, chanid: int) -> Channel: ...
190     def delete(self, chanid: int) -> None: ...
191     def values(self) -> list[Channel]: ...
192     def __len__(self) -> int: ...