1 from logging import Logger
2 from threading import Condition, Event, Lock
3 from typing import Any, Callable, Mapping, TypeVar
5 from paramiko.buffered_pipe import BufferedPipe
6 from paramiko.file import BufferedFile
7 from paramiko.transport import Transport
8 from paramiko.util import ClosingContextManager
10 _F = TypeVar("_F", bound=Callable[..., Any])
12 def open_only(func: _F) -> Callable[[_F], _F]: ...
14 class Channel(ClosingContextManager):
17 transport: Transport | None
21 in_buffer: BufferedPipe[Any]
22 in_stderr_buffer: BufferedPipe[Any]
27 out_buffer_cv: Condition
30 in_max_packet_size: int
31 out_max_packet_size: int
32 in_window_threshold: int
41 def __init__(self, chanid: int) -> None: ...
42 def __del__(self) -> None: ...
44 self, term: str = ..., width: int = ..., height: int = ..., width_pixels: int = ..., height_pixels: int = ...
46 def invoke_shell(self) -> None: ...
47 def exec_command(self, command: str) -> None: ...
48 def invoke_subsystem(self, subsystem: str) -> None: ...
49 def resize_pty(self, width: int = ..., height: int = ..., width_pixels: int = ..., height_pixels: int = ...) -> None: ...
50 def update_environment(self, environment: Mapping[str, str]) -> None: ...
51 def set_environment_variable(self, name: str, value: str) -> None: ...
52 def exit_status_ready(self) -> bool: ...
53 def recv_exit_status(self) -> int: ...
54 def send_exit_status(self, status: int) -> None: ...
57 screen_number: int = ...,
58 auth_protocol: str | None = ...,
59 auth_cookie: str | None = ...,
60 single_connection: bool = ...,
61 handler: Callable[[Channel, tuple[str, int]], None] | None = ...,
63 def request_forward_agent(self, handler: Callable[[Channel], None]) -> bool: ...
64 def get_transport(self) -> Transport: ...
65 def set_name(self, name: str) -> None: ...
66 def get_name(self) -> str: ...
67 def get_id(self) -> int: ...
68 def set_combine_stderr(self, combine: bool) -> bool: ...
69 def settimeout(self, timeout: float | None) -> None: ...
70 def gettimeout(self) -> float | None: ...
71 def setblocking(self, blocking: bool) -> None: ...
72 def getpeername(self) -> str: ...
73 def close(self) -> None: ...
74 def recv_ready(self) -> bool: ...
75 def recv(self, nbytes: int) -> bytes: ...
76 def recv_stderr_ready(self) -> bool: ...
77 def recv_stderr(self, nbytes: int) -> bytes: ...
78 def send_ready(self) -> bool: ...
79 def send(self, s: bytes) -> int: ...
80 def send_stderr(self, s: bytes) -> int: ...
81 def sendall(self, s: bytes) -> None: ...
82 def sendall_stderr(self, s: bytes) -> None: ...
83 def makefile(self, *params: Any) -> ChannelFile: ...
84 def makefile_stderr(self, *params: Any) -> ChannelStderrFile: ...
85 def makefile_stdin(self, *params: Any) -> ChannelStdinFile: ...
86 def fileno(self) -> int: ...
87 def shutdown(self, how: int) -> None: ...
88 def shutdown_read(self) -> None: ...
89 def shutdown_write(self) -> None: ...
91 class ChannelFile(BufferedFile[Any]):
93 def __init__(self, channel: Channel, mode: str = ..., bufsize: int = ...) -> None: ...
95 class ChannelStderrFile(ChannelFile): ...
97 class ChannelStdinFile(ChannelFile):
98 def close(self) -> None: ...