�
<��g=T � � � d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dl m
Z
mZ d dlm
Z
mZmZ ddlmZmZ ddlmZmZmZmZmZmZmZ ddlmZmZ dd lmZm Z m!Z!m"Z"m#Z# dd
l$m%Z%m&Z& ddl'm(Z( ddl)m*Z*m+Z+m,Z,m-Z-m.Z. dd
lm/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5 ddl6m7Z7 dgZ8 G d� de-� � Z9 G d� de9� � Z: e( e;� � dddddd��� � dS )� )�annotationsN)� Generator�Sequence)�Any�Callable�cast� )�Headers�MultipleValuesError)�InvalidHandshake�
InvalidHeader�InvalidHeaderValue�InvalidMessage�
InvalidOrigin�InvalidUpgrade�NegotiationError)� Extension�ServerExtensionFactory)�build_extension�parse_connection�parse_extension�parse_subprotocol�
parse_upgrade)�Request�Response)�lazy_import)�
CONNECTING�OPEN�SERVER�Protocol�State)�ConnectionOption�ExtensionHeader�
LoggerLike�Origin�
StatusLike�Subprotocol�UpgradeProtocol)�
accept_key�ServerProtocolc � � � e Zd ZdZddddeddd�d/� fd�Zd0d�Zd1d�Zd2d�Zd3d!�Z d4d#�Z
d5d%�Zd6d*�Zd7d,�Z
d8� fd.�Z� xZS )9r* a-
Sans-I/O implementation of a WebSocket server connection.
Args:
origins: Acceptable values of the ``Origin`` header. Values can be
:class:`str` to test for an exact match or regular expressions
compiled by :func:`re.compile` to test against a pattern. Include
:obj:`None` in the list if the lack of an origin is acceptable.
This is useful for defending against Cross-Site WebSocket
Hijacking attacks.
extensions: List of supported extensions, in order in which they
should be tried.
subprotocols: List of supported subprotocols, in order of decreasing
preference.
select_subprotocol: Callback for selecting a subprotocol among
those supported by the client and the server. It has the same
signature as the :meth:`select_subprotocol` method, including a
:class:`ServerProtocol` instance as first argument.
state: Initial state of the WebSocket connection.
max_size: Maximum size of incoming messages in bytes;
:obj:`None` disables the limit.
logger: Logger for this connection;
defaults to ``logging.getLogger("websockets.server")``;
see the :doc:`logging guide <../../topics/logging>` for details.
Ni )�origins�
extensions�subprotocols�select_subprotocol�state�max_size�loggerr, �0Sequence[Origin | re.Pattern[str] | None] | Noner- �'Sequence[ServerExtensionFactory] | Noner. �Sequence[Subprotocol] | Noner/ �LCallable[[ServerProtocol, Sequence[Subprotocol]], Subprotocol | None] | Noner0 r! r1 �
int | Noner2 �LoggerLike | None�return�Nonec �� �� t � � � t |||�� � || _ || _ || _ |�,t
| d|� | | j � � � � d S d S )N)�sider0 r1 r2 r/ ) �super�__init__r r, �available_extensions�available_subprotocols�setattr�__get__� __class__) �selfr, r- r. r/ r0 r1 r2 rC s ��a/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/websockets/server.pyr>