|
1 | | -import ssl |
2 | | -import types |
3 | 1 | import urllib.request |
4 | 2 | from _socket import _Address |
5 | 3 | from _typeshed import ReadableBuffer, SupportsRead, Unused |
6 | | -from asyncio.events import AbstractEventLoop |
7 | | -from collections.abc import AsyncIterable, Awaitable, Callable, Collection, Iterable, Mapping, MutableMapping, Sequence |
| 4 | +from collections.abc import Callable, Collection, Iterable, Mapping, MutableMapping |
8 | 5 | from http.client import HTTPResponse |
9 | 6 | from http.cookiejar import CookieJar |
10 | | -from socket import socket |
11 | 7 | from subprocess import Popen |
12 | | -from typing import Any, AnyStr, Generic, Literal, TypeVar, overload |
13 | | -from typing_extensions import Self |
14 | | - |
15 | | -from websockets import ClientConnection, HeadersLike, LoggerLike, Origin, Subprotocol |
16 | | -from websockets.asyncio.client import connect |
17 | | -from websockets.extensions import ClientExtensionFactory |
| 8 | +from typing import Any, AnyStr, TypeVar |
18 | 9 |
|
19 | 10 | has_certifi: bool |
20 | 11 | has_websockets: bool |
21 | 12 | _T = TypeVar("_T") |
22 | 13 |
|
23 | | -class WebSocketsWrapper(Generic[_T]): |
24 | | - pool: _T | None |
25 | | - loop: AbstractEventLoop |
26 | | - conn: connect |
27 | | - def __init__( |
28 | | - self, |
29 | | - url: str, |
30 | | - headers: Mapping[str, str] | None = None, |
31 | | - connect: bool = True, |
32 | | - *, |
33 | | - # Passed to websockets.connect() |
34 | | - origin: Origin | None = None, |
35 | | - extensions: Sequence[ClientExtensionFactory] | None = None, |
36 | | - subprotocols: Sequence[Subprotocol] | None = None, |
37 | | - compression: str | None = "deflate", |
38 | | - additional_headers: HeadersLike | None = None, |
39 | | - user_agent_header: str | None = ..., |
40 | | - proxy: str | Literal[True] | None = True, |
41 | | - process_exception: Callable[[Exception], Exception | None] = ..., |
42 | | - open_timeout: float | None = 10, |
43 | | - ping_interval: float | None = 20, |
44 | | - ping_timeout: float | None = 20, |
45 | | - close_timeout: float | None = 10, |
46 | | - max_size: int | None = 1048576, |
47 | | - max_queue: int | None | tuple[int | None, int | None] = 16, |
48 | | - write_limit: int | tuple[int, int | None] = 32768, |
49 | | - logger: LoggerLike | None = None, |
50 | | - create_connection: type[ClientConnection] | None = None, |
51 | | - # Passed to AbstractEventLoop.connect() by websockets |
52 | | - ssl: bool | None | ssl.SSLContext = None, |
53 | | - family: int = 0, |
54 | | - proto: int = 0, |
55 | | - flags: int = 0, |
56 | | - sock: socket | None = None, |
57 | | - local_addr: None = None, |
58 | | - server_hostname: str | None = None, |
59 | | - ssl_handshake_timeout: float | None = None, |
60 | | - ssl_shutdown_timeout: float | None = None, |
61 | | - happy_eyeballs_delay: float | None = None, |
62 | | - interleave: int | None = None, |
63 | | - ) -> None: ... |
64 | | - def __enter__(self) -> Self: ... |
65 | | - def send( |
66 | | - self, message: str | bytes | Iterable[str | bytes] | AsyncIterable[str | bytes], text: bool | None = None |
67 | | - ) -> None: ... |
68 | | - @overload |
69 | | - def recv(self, decode: Literal[True]) -> str: ... |
70 | | - @overload |
71 | | - def recv(self, decode: Literal[False]) -> bytes: ... |
72 | | - @overload |
73 | | - def recv(self, decode: bool | None = None) -> str | bytes: ... |
74 | | - def __exit__( |
75 | | - self, type: type[BaseException] | None, value: BaseException | None, traceback: types.TracebackType | None |
76 | | - ) -> None: ... |
77 | | - @staticmethod |
78 | | - def run_with_loop(main: Awaitable[_T], loop: AbstractEventLoop) -> _T: ... |
79 | | - |
80 | 14 | def load_plugins(name: str, suffix: str, namespace: dict[str, Any]) -> dict[str, type[Any]]: ... |
81 | 15 | def traverse_dict(dictn: Mapping[str, Any], keys: Collection[str], casesense: bool = True) -> Any: ... |
82 | 16 | def decode_base(value: str, digits: str) -> int: ... |
|
0 commit comments