4 from _typeshed import Self
5 from typing import Any, Iterable, Tuple, Type, Union
7 if sys.version_info >= (3, 8):
8 from typing import SupportsIndex
10 # https://docs.python.org/3/library/multiprocessing.html#address-formats
11 _Address = Union[str, Tuple[str, int]]
13 class _ConnectionBase:
14 if sys.version_info >= (3, 8):
15 def __init__(self, handle: SupportsIndex, readable: bool = ..., writable: bool = ...) -> None: ...
17 def __init__(self, handle: int, readable: bool = ..., writable: bool = ...) -> None: ...
19 def closed(self) -> bool: ... # undocumented
21 def readable(self) -> bool: ... # undocumented
23 def writable(self) -> bool: ... # undocumented
24 def fileno(self) -> int: ...
25 def close(self) -> None: ...
26 def send_bytes(self, buf: bytes, offset: int = ..., size: int | None = ...) -> None: ...
27 def send(self, obj: Any) -> None: ...
28 def recv_bytes(self, maxlength: int | None = ...) -> bytes: ...
29 def recv_bytes_into(self, buf: Any, offset: int = ...) -> int: ...
30 def recv(self) -> Any: ...
31 def poll(self, timeout: float | None = ...) -> bool: ...
32 def __enter__(self: Self) -> Self: ...
34 self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None
37 class Connection(_ConnectionBase): ...
39 if sys.platform == "win32":
40 class PipeConnection(_ConnectionBase): ...
44 self, address: _Address | None = ..., family: str | None = ..., backlog: int = ..., authkey: bytes | None = ...
46 def accept(self) -> Connection: ...
47 def close(self) -> None: ...
49 def address(self) -> _Address: ...
51 def last_accepted(self) -> _Address | None: ...
52 def __enter__(self: Self) -> Self: ...
54 self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None
57 def deliver_challenge(connection: Connection, authkey: bytes) -> None: ...
58 def answer_challenge(connection: Connection, authkey: bytes) -> None: ...
60 object_list: Iterable[Connection | socket.socket | int], timeout: float | None = ...
61 ) -> list[Connection | socket.socket | int]: ...
62 def Client(address: _Address, family: str | None = ..., authkey: bytes | None = ...) -> Connection: ...
63 def Pipe(duplex: bool = ...) -> tuple[Connection, Connection]: ...