|
from __future__ import annotations |
|
|
|
|
|
from typing import TYPE_CHECKING |
|
|
|
from .imports import lazy_import |
|
from .version import version as __version__ |
|
|
|
|
|
__all__ = [ |
|
|
|
"connect", |
|
"unix_connect", |
|
"ClientConnection", |
|
|
|
"route", |
|
"unix_route", |
|
"Router", |
|
|
|
"basic_auth", |
|
"broadcast", |
|
"serve", |
|
"unix_serve", |
|
"ServerConnection", |
|
"Server", |
|
|
|
"ClientProtocol", |
|
|
|
"Headers", |
|
"HeadersLike", |
|
"MultipleValuesError", |
|
|
|
"ConcurrencyError", |
|
"ConnectionClosed", |
|
"ConnectionClosedError", |
|
"ConnectionClosedOK", |
|
"DuplicateParameter", |
|
"InvalidHandshake", |
|
"InvalidHeader", |
|
"InvalidHeaderFormat", |
|
"InvalidHeaderValue", |
|
"InvalidMessage", |
|
"InvalidOrigin", |
|
"InvalidParameterName", |
|
"InvalidParameterValue", |
|
"InvalidProxy", |
|
"InvalidProxyMessage", |
|
"InvalidProxyStatus", |
|
"InvalidState", |
|
"InvalidStatus", |
|
"InvalidUpgrade", |
|
"InvalidURI", |
|
"NegotiationError", |
|
"PayloadTooBig", |
|
"ProtocolError", |
|
"ProxyError", |
|
"SecurityError", |
|
"WebSocketException", |
|
|
|
"Close", |
|
"CloseCode", |
|
"Frame", |
|
"Opcode", |
|
|
|
"Request", |
|
"Response", |
|
|
|
"Protocol", |
|
"Side", |
|
"State", |
|
|
|
"ServerProtocol", |
|
|
|
"Data", |
|
"ExtensionName", |
|
"ExtensionParameter", |
|
"LoggerLike", |
|
"StatusLike", |
|
"Origin", |
|
"Subprotocol", |
|
] |
|
|
|
|
|
if TYPE_CHECKING: |
|
from .asyncio.client import ClientConnection, connect, unix_connect |
|
from .asyncio.router import Router, route, unix_route |
|
from .asyncio.server import ( |
|
Server, |
|
ServerConnection, |
|
basic_auth, |
|
broadcast, |
|
serve, |
|
unix_serve, |
|
) |
|
from .client import ClientProtocol |
|
from .datastructures import Headers, HeadersLike, MultipleValuesError |
|
from .exceptions import ( |
|
ConcurrencyError, |
|
ConnectionClosed, |
|
ConnectionClosedError, |
|
ConnectionClosedOK, |
|
DuplicateParameter, |
|
InvalidHandshake, |
|
InvalidHeader, |
|
InvalidHeaderFormat, |
|
InvalidHeaderValue, |
|
InvalidMessage, |
|
InvalidOrigin, |
|
InvalidParameterName, |
|
InvalidParameterValue, |
|
InvalidProxy, |
|
InvalidProxyMessage, |
|
InvalidProxyStatus, |
|
InvalidState, |
|
InvalidStatus, |
|
InvalidUpgrade, |
|
InvalidURI, |
|
NegotiationError, |
|
PayloadTooBig, |
|
ProtocolError, |
|
ProxyError, |
|
SecurityError, |
|
WebSocketException, |
|
) |
|
from .frames import Close, CloseCode, Frame, Opcode |
|
from .http11 import Request, Response |
|
from .protocol import Protocol, Side, State |
|
from .server import ServerProtocol |
|
from .typing import ( |
|
Data, |
|
ExtensionName, |
|
ExtensionParameter, |
|
LoggerLike, |
|
Origin, |
|
StatusLike, |
|
Subprotocol, |
|
) |
|
else: |
|
lazy_import( |
|
globals(), |
|
aliases={ |
|
|
|
"connect": ".asyncio.client", |
|
"unix_connect": ".asyncio.client", |
|
"ClientConnection": ".asyncio.client", |
|
|
|
"route": ".asyncio.router", |
|
"unix_route": ".asyncio.router", |
|
"Router": ".asyncio.router", |
|
|
|
"basic_auth": ".asyncio.server", |
|
"broadcast": ".asyncio.server", |
|
"serve": ".asyncio.server", |
|
"unix_serve": ".asyncio.server", |
|
"ServerConnection": ".asyncio.server", |
|
"Server": ".asyncio.server", |
|
|
|
"ClientProtocol": ".client", |
|
|
|
"Headers": ".datastructures", |
|
"HeadersLike": ".datastructures", |
|
"MultipleValuesError": ".datastructures", |
|
|
|
"ConcurrencyError": ".exceptions", |
|
"ConnectionClosed": ".exceptions", |
|
"ConnectionClosedError": ".exceptions", |
|
"ConnectionClosedOK": ".exceptions", |
|
"DuplicateParameter": ".exceptions", |
|
"InvalidHandshake": ".exceptions", |
|
"InvalidHeader": ".exceptions", |
|
"InvalidHeaderFormat": ".exceptions", |
|
"InvalidHeaderValue": ".exceptions", |
|
"InvalidMessage": ".exceptions", |
|
"InvalidOrigin": ".exceptions", |
|
"InvalidParameterName": ".exceptions", |
|
"InvalidParameterValue": ".exceptions", |
|
"InvalidProxy": ".exceptions", |
|
"InvalidProxyMessage": ".exceptions", |
|
"InvalidProxyStatus": ".exceptions", |
|
"InvalidState": ".exceptions", |
|
"InvalidStatus": ".exceptions", |
|
"InvalidUpgrade": ".exceptions", |
|
"InvalidURI": ".exceptions", |
|
"NegotiationError": ".exceptions", |
|
"PayloadTooBig": ".exceptions", |
|
"ProtocolError": ".exceptions", |
|
"ProxyError": ".exceptions", |
|
"SecurityError": ".exceptions", |
|
"WebSocketException": ".exceptions", |
|
|
|
"Close": ".frames", |
|
"CloseCode": ".frames", |
|
"Frame": ".frames", |
|
"Opcode": ".frames", |
|
|
|
"Request": ".http11", |
|
"Response": ".http11", |
|
|
|
"Protocol": ".protocol", |
|
"Side": ".protocol", |
|
"State": ".protocol", |
|
|
|
"ServerProtocol": ".server", |
|
|
|
"Data": ".typing", |
|
"ExtensionName": ".typing", |
|
"ExtensionParameter": ".typing", |
|
"LoggerLike": ".typing", |
|
"Origin": ".typing", |
|
"StatusLike": ".typing", |
|
"Subprotocol": ".typing", |
|
}, |
|
deprecated_aliases={ |
|
|
|
"framing": ".legacy", |
|
"handshake": ".legacy", |
|
"parse_uri": ".uri", |
|
"WebSocketURI": ".uri", |
|
|
|
|
|
"BasicAuthWebSocketServerProtocol": ".legacy.auth", |
|
"basic_auth_protocol_factory": ".legacy.auth", |
|
|
|
"WebSocketClientProtocol": ".legacy.client", |
|
|
|
"AbortHandshake": ".legacy.exceptions", |
|
"InvalidStatusCode": ".legacy.exceptions", |
|
"RedirectHandshake": ".legacy.exceptions", |
|
"WebSocketProtocolError": ".legacy.exceptions", |
|
|
|
"WebSocketCommonProtocol": ".legacy.protocol", |
|
|
|
"WebSocketServer": ".legacy.server", |
|
"WebSocketServerProtocol": ".legacy.server", |
|
}, |
|
) |
|
|