� <��g 2��R�dZddlmZddlZddlmZgd�ZGd�de��ZGd �d e��Z Gd �d e ��Z Gd �de ��Z Gd�de��Z Gd�de��Z Gd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�d e��ZGd!�d"e��ZGd#�d$e��ZGd%�d&e��ZGd'�d(e��ZGd)�d*e��ZGd+�d,e��ZGd-�d.e��ZGd/�d0e��ZGd1�d2e��ZGd3�d4e��ZGd5�d6e��ZGd7�d8ee ��Z!Gd9�d:ee"��Z#dd;l$m%Z%m&Z&ee'��d<d<d<d<d=��>��dS)?aU :mod:`websockets.exceptions` defines the following hierarchy of exceptions. * :exc:`WebSocketException` * :exc:`ConnectionClosed` * :exc:`ConnectionClosedOK` * :exc:`ConnectionClosedError` * :exc:`InvalidURI` * :exc:`InvalidProxy` * :exc:`InvalidHandshake` * :exc:`SecurityError` * :exc:`ProxyError` * :exc:`InvalidProxyMessage` * :exc:`InvalidProxyStatus` * :exc:`InvalidMessage` * :exc:`InvalidStatus` * :exc:`InvalidStatusCode` (legacy) * :exc:`InvalidHeader` * :exc:`InvalidHeaderFormat` * :exc:`InvalidHeaderValue` * :exc:`InvalidOrigin` * :exc:`InvalidUpgrade` * :exc:`NegotiationError` * :exc:`DuplicateParameter` * :exc:`InvalidParameterName` * :exc:`InvalidParameterValue` * :exc:`AbortHandshake` (legacy) * :exc:`RedirectHandshake` (legacy) * :exc:`ProtocolError` (Sans-I/O) * :exc:`PayloadTooBig` (Sans-I/O) * :exc:`InvalidState` (Sans-I/O) * :exc:`ConcurrencyError` �)� annotationsN�)� lazy_import)�WebSocketException�ConnectionClosed�ConnectionClosedOK�ConnectionClosedError� InvalidURI� InvalidProxy�InvalidHandshake� SecurityError� ProxyError�InvalidProxyMessage�InvalidProxyStatus�InvalidMessage� InvalidStatus� InvalidHeader�InvalidHeaderFormat�InvalidHeaderValue� InvalidOrigin�InvalidUpgrade�NegotiationError�DuplicateParameter�InvalidParameterName�InvalidParameterValue� ProtocolError� PayloadTooBig� InvalidState�ConcurrencyErrorc��eZdZdZdS)rz? Base class for all exceptions defined by websockets. N��__name__� __module__� __qualname__�__doc__���e/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/websockets/exceptions.pyrrI����������r'rc�V�eZdZdZ ddd �Zdd �Zedd���Zedd���ZdS)ra Raised when trying to interact with a closed connection. Attributes: rcvd: If a close frame was received, its code and reason are available in ``rcvd.code`` and ``rcvd.reason``. sent: If a close frame was sent, its code and reason are available in ``sent.code`` and ``sent.reason``. rcvd_then_sent: If close frames were received and sent, this attribute tells in which order this happened, from the perspective of this side of the connection. N�rcvd�frames.Close | None�sent�rcvd_then_sent� bool | None�return�Nonec�n�||_||_||_|jdu|jdup|jduksJ�dS�N�r+r-r.)�selfr+r-r.s r(�__init__zConnectionClosed.__init___sM�� �� ��� �,����#�t�+���d�1B�1W�d�i�SW�FW�X�X�X�X�X�Xr'�strc��|j�|j�dSd|j�d�S|j� d|j�d�S|jrd|j�d|j��Sd|j�d|j��S)Nzno close frame received or sentzsent z; no close frame receivedz received z; no close frame sentz ; then sent z; then received r4�r5s r(�__str__zConnectionClosed.__str__js��� �9� ��y� �8�8�C�t�y�C�C�C�C��y� �C�4�9�C�C�C�C��&�J�I�t�y�I�I�d�i�I�I�I�I�4�9�I�I�d�i�I�I�Ir'�intc�~�tjdt��|j�tjjS|jjS)NzZConnectionClosed.code is deprecated; use Protocol.close_code or ConnectionClosed.rcvd.code)�warnings�warn�DeprecationWarningr+�frames� CloseCode�ABNORMAL_CLOSURE�coder9s r(rCzConnectionClosed.code{s?��� � D� � � � � �9� ��#�4� 4��y�~�r'c�`�tjdt��|j�dS|jjS)Nz`ConnectionClosed.reason is deprecated; use Protocol.close_reason or ConnectionClosed.rcvd.reason�)r=r>r?r+�reasonr9s r(rFzConnectionClosed.reason�s9��� � H� � � � � �9� ��2��y��r'r3)r+r,r-r,r.r/r0r1�r0r7)r0r;) r"r#r$r%r6r:�propertyrCrFr&r'r(rrPs������� � �$'+� Y� Y� Y� Y� Y� J� J� J� J�"�����X��� � � ��X� � � r'rc��eZdZdZdS)rz� Like :exc:`ConnectionClosed`, when the connection terminated properly. A close code with code 1000 (OK) or 1001 (going away) or without a code was received and sent. Nr!r&r'r(rr�����������r'rc��eZdZdZdS)r z� Like :exc:`ConnectionClosed`, when the connection terminated with an error. A close frame with a code other than 1000 (OK) or 1001 (going away) was received or sent, or the closing handshake didn't complete properly. Nr!r&r'r(r r �rJr'r c�"�eZdZdZd d�Zd d�Zd S) r zL Raised when connecting to a URI that isn't a valid WebSocket URI. �urir7�msgr0r1c�"�||_||_dSr3�rMrN)r5rMrNs r(r6zInvalidURI.__init__�s���������r'c�$�|j�d|j��S)Nz isn't a valid URI: rPr9s r(r:zInvalidURI.__str__�s���(�:�:���:�:�:r'N)rMr7rNr7r0r1rG�r"r#r$r%r6r:r&r'r(r r �sF�������� ����;�;�;�;�;�;r'r c�"�eZdZdZd d�Zd d�Zd S) r z? Raised when connecting via a proxy that isn't valid. �proxyr7rNr0r1c�"�||_||_dSr3�rTrN)r5rTrNs r(r6zInvalidProxy.__init__�s���� �����r'c�$�|j�d|j��S)Nz isn't a valid proxy: rVr9s r(r:zInvalidProxy.__str__�s���*�>�>�D�H�>�>�>r'N)rTr7rNr7r0r1rGrRr&r'r(r r �sF�������� ����?�?�?�?�?�?r'r c��eZdZdZdS)r zM Base class for exceptions raised when the opening handshake fails. Nr!r&r'r(r r �r)r'r c��eZdZdZdS)r z� Raised when a handshake request or response breaks a security rule. Security limits can be configured with :doc:`environment variables <../reference/variables>`. Nr!r&r'r(r r �rJr'r c��eZdZdZdS)rz5 Raised when failing to connect to a proxy. Nr!r&r'r(rr�r)r'rc��eZdZdZdS)rz; Raised when an HTTP proxy response is malformed. Nr!r&r'r(rr�r)r'rc�"�eZdZdZd d�Zd d�Zd S) rz< Raised when an HTTP proxy rejects the connection. �response�http11.Responser0r1c��||_dSr3�r]�r5r]s r(r6zInvalidProxyStatus.__init__�� �� �� � � r'r7c�"�d|jjd��S)Nz proxy rejected connection: HTTP �d�r]� status_coder9s r(r:zInvalidProxyStatus.__str__�s��O�$�-�2K�O�O�O�Or'N�r]r^r0r1rGrRr&r'r(rr�sL�������� !�!�!�!�P�P�P�P�P�Pr'rc��eZdZdZdS)rzD Raised when a handshake request or response is malformed. Nr!r&r'r(rr�r)r'rc�"�eZdZdZd d�Zd d�Zd S) rzJ Raised when a handshake response rejects the WebSocket upgrade. r]r^r0r1c��||_dSr3r`ras r(r6zInvalidStatus.__init__�rbr'r7c�"�d|jjd��S)Nz+server rejected WebSocket connection: HTTP rdrer9s r(r:zInvalidStatus.__str__�s�� W�$�-�:S� W� W� W� r'NrgrGrRr&r'r(rr�sF�������� !�!�!�!� � � � � � r'rc�$�eZdZdZd d d �Zd d �ZdS)rzK Raised when an HTTP header doesn't have a valid format or value. N�namer7�value� str | Noner0r1c�"�||_||_dSr3�rmrn�r5rmrns r(r6zInvalidHeader.__init__ ����� ��� � � r'c�v�|j� d|j�d�S|jdkr d|j�d�Sd|j�d|j��S)Nzmissing z headerrEzempty zinvalid z header: �rnrmr9s r(r:zInvalidHeader.__str__sW�� �:� �0�d�i�0�0�0� 0� �Z�2� � �.�D�I�.�.�.� .�>�d�i�>�>�$�*�>�>� >r'r3�rmr7rnror0r1rGrRr&r'r(rrsK�������� �����?�?�?�?�?�?r'rc�$��eZdZdZd �fd � Z�xZS) rz� Raised when an HTTP header cannot be parsed. The format of the header doesn't match the grammar for that header. rmr7�error�header�posr;r0r1c�\��t���||�d|�d|����dS)Nz at z in ��superr6)r5rmrxryrz� __class__s �r(r6zInvalidHeaderFormat.__init__s9��� ������%�>�>�S�>�>�f�>�>�?�?�?�?�?r') rmr7rxr7ryr7rzr;r0r1�r"r#r$r%r6� __classcell__�r~s@r(rrsQ���������@�@�@�@�@�@�@�@�@�@r'rc��eZdZdZdS)rz� Raised when an HTTP header has a wrong value. The format of the header is correct but the value isn't acceptable. Nr!r&r'r(rr#s���������r'rc�$��eZdZdZd�fd� Z�xZS)rzD Raised when the Origin header in a request isn't allowed. �originror0r1c�L��t���d|��dS)N�Originr|)r5r�r~s �r(r6zInvalidOrigin.__init__2s#��� ������6�*�*�*�*�*r')r�ror0r1rr�s@r(rr,sG��������� +�+�+�+�+�+�+�+�+�+r'rc��eZdZdZdS)rzF Raised when the Upgrade or Connection header isn't correct. Nr!r&r'r(rr6r)r'rc��eZdZdZdS)rzG Raised when negotiating an extension or a subprotocol fails. Nr!r&r'r(rr=r)r'rc�"�eZdZdZd d�Zd d�ZdS) rzK Raised when a parameter name is repeated in an extension header. rmr7r0r1c��||_dSr3�rm�r5rms r(r6zDuplicateParameter.__init__J� ���� � � r'c��d|j��S)Nzduplicate parameter: r�r9s r(r:zDuplicateParameter.__str__Ms��2�t�y�2�2�2r'N�rmr7r0r1rGrRr&r'r(rrDsF�������� ����3�3�3�3�3�3r'rc�"�eZdZdZd d�Zd d�ZdS) rzJ Raised when a parameter name in an extension header is invalid. rmr7r0r1c��||_dSr3r�r�s r(r6zInvalidParameterName.__init__Wr�r'c��d|j��S)Nzinvalid parameter name: r�r9s r(r:zInvalidParameterName.__str__Zs��5�$�)�5�5�5r'Nr�rGrRr&r'r(rrQsF�������� ����6�6�6�6�6�6r'rc�"�eZdZdZd d�Zd d �Zd S) rzK Raised when a parameter value in an extension header is invalid. rmr7rnror0r1c�"�||_||_dSr3rqrrs r(r6zInvalidParameterValue.__init__drsr'c�r�|j� d|j��S|jdkr d|j��Sd|j�d|j��S)Nzmissing value for parameter rEzempty value for parameter zinvalid value for parameter z: rur9s r(r:zInvalidParameterValue.__str__hsQ�� �:� �=�$�)�=�=� =� �Z�2� � �;�� �;�;� ;�K�$�)�K�K�t�z�K�K� Kr'NrvrGrRr&r'r(rr^sL�������� ����L�L�L�L�L�Lr'rc��eZdZdZdS)ra Raised when receiving or sending a frame that breaks the protocol. The Sans-I/O implementation raises this exception when: * receiving or sending a frame that contains invalid data; * receiving or sending an invalid sequence of frames. Nr!r&r'r(rrqs���������r'rc�0�eZdZdZ ddd �Zdd �Zdd �ZdS)raU Raised when parsing a frame with a payload that exceeds the maximum size. The Sans-I/O layer uses this exception internally. It doesn't bubble up to the I/O layer. The :meth:`~websockets.extensions.Extension.decode` method of extensions must raise :exc:`PayloadTooBig` if decoding a frame would exceed the limit. N�size_or_message�int | None | str�max_size� int | None�cur_sizer0r1c���t|t��r+|�J�|�J�tjdt��||_dSd|_||_|�J�||_d|_|� |��dS)NzMPayloadTooBig(message) is deprecated; change to PayloadTooBig(size, max_size)) � isinstancer7r=r>r?�message�sizer�r��set_current_size)r5r�r�r�s r(r6zPayloadTooBig.__init__�s��� �o�s� +� +� ,��#�#�#��#�#�#� �M�:�"� � � � (7�D�L�L�L��D�L�$3�D�I��'�'�'�!)�D�M�(,�D�M� � !� !�(� +� +� +� +� +r'r7c��|j�|jSd}|j�|d|j�d�z }|j�|d|j�d�z }|d|j�d�z }|S)Nzframe zwith z bytes zafter reading zexceeds limit of z bytes)r�r�r�r�)r5r�s r(r:zPayloadTooBig.__str__�st�� �<� #��<� ��G��y�$��5�4�9�5�5�5�5���}�(��B�D�M�B�B�B�B�� �@�4�=�@�@�@� @�G��Nr'c�N�|j�J�|�|xj|z c_||_dSdSr3)r�r�)r5r�s r(r�zPayloadTooBig.set_current_size�s9���}�$�$�$� � � �M�M�X� %�M�M�$�D�M�M�M� � r')NN)r�r�r�r�r�r�r0r1rG)r�r�r0r1)r"r#r$r%r6r:r�r&r'r(rr}sg������ � � $�#� ,�,�,�,�,�. � � � �%�%�%�%�%�%r'rc��eZdZdZdS)ra� Raised when sending a frame is forbidden in the current state. Specifically, the Sans-I/O layer raises this exception when: * sending a data frame to a connection in a state other :attr:`~websockets.protocol.State.OPEN`; * sending a control frame to a connection in a state other than :attr:`~websockets.protocol.State.OPEN` or :attr:`~websockets.protocol.State.CLOSING`. Nr!r&r'r(rr�s������ � � � r'rc��eZdZdZdS)rz� Raised when receiving or sending messages concurrently. WebSocket is a connection-oriented protocol. Reads must be serialized; so must be writes. However, reading and writing concurrently is possible. Nr!r&r'r(rr�rJr'r)r@�http11z.legacy.exceptions)�AbortHandshake�InvalidStatusCode�RedirectHandshake�WebSocketProtocolError)�deprecated_aliases)(r%� __future__rr=�importsr�__all__� Exceptionrrrr r r r r rrrrrrrrrrrrrrrr�AssertionErrorr� RuntimeErrorrrEr@r��globalsr&r'r(�<module>r�s%��!�!�F#�"�"�"�"�"����� � � � � � � � � ��<���������? �? �? �? �? �)�? �? �? �D�����)���������,���� ;� ;� ;� ;� ;�#� ;� ;� ;� ?� ?� ?� ?� ?�%� ?� ?� ?������)���������$���������!���������*���� P� P� P� P� P�� P� P� P������%����  �  �  �  �  �$�  �  �  �?�?�?�?�?�$�?�?�?�& @� @� @� @� @�-� @� @� @����������+�+�+�+�+�M�+�+�+������]���������'���� 3� 3� 3� 3� 3�)� 3� 3� 3� 6� 6� 6� 6� 6�+� 6� 6� 6�L�L�L�L�L�,�L�L�L�& � � � � �&� � � �3%�3%�3%�3%�3%�&�3%�3%�3%�l � � � � �%�~� � � ������)�<������������ � � �G�I�I�/�1�1�"6� �� � � � � � r'
Memory