massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / multiprocessing / connection.pyi
1 import socket
2 import sys
3 import types
4 from _typeshed import Self
5 from typing import Any, Iterable, Tuple, Type, Union
6
7 if sys.version_info >= (3, 8):
8     from typing import SupportsIndex
9
10 # https://docs.python.org/3/library/multiprocessing.html#address-formats
11 _Address = Union[str, Tuple[str, int]]
12
13 class _ConnectionBase:
14     if sys.version_info >= (3, 8):
15         def __init__(self, handle: SupportsIndex, readable: bool = ..., writable: bool = ...) -> None: ...
16     else:
17         def __init__(self, handle: int, readable: bool = ..., writable: bool = ...) -> None: ...
18     @property
19     def closed(self) -> bool: ...  # undocumented
20     @property
21     def readable(self) -> bool: ...  # undocumented
22     @property
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: ...
33     def __exit__(
34         self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None
35     ) -> None: ...
36
37 class Connection(_ConnectionBase): ...
38
39 if sys.platform == "win32":
40     class PipeConnection(_ConnectionBase): ...
41
42 class Listener:
43     def __init__(
44         self, address: _Address | None = ..., family: str | None = ..., backlog: int = ..., authkey: bytes | None = ...
45     ) -> None: ...
46     def accept(self) -> Connection: ...
47     def close(self) -> None: ...
48     @property
49     def address(self) -> _Address: ...
50     @property
51     def last_accepted(self) -> _Address | None: ...
52     def __enter__(self: Self) -> Self: ...
53     def __exit__(
54         self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None
55     ) -> None: ...
56
57 def deliver_challenge(connection: Connection, authkey: bytes) -> None: ...
58 def answer_challenge(connection: Connection, authkey: bytes) -> None: ...
59 def wait(
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]: ...