HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/websockets/__pycache__/exceptions.cpython-310.pyc
o

�h2�@s�dZddlmZddlZddlmZgd�ZGdd�de�ZGd	d
�d
e�Z	Gdd�de	�Z
Gd
d�de	�ZGdd�de�ZGdd�de�Z
Gdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd �d e�ZGd!d"�d"e�ZGd#d$�d$e�ZGd%d&�d&e�ZGd'd(�d(e�ZGd)d*�d*e�ZGd+d,�d,e�ZGd-d.�d.e�ZGd/d0�d0e�ZGd1d2�d2e�ZGd3d4�d4e�ZGd5d6�d6e�ZGd7d8�d8ee �Z!Gd9d:�d:ee"�Z#dd;l$m%Z%m&Z&ee'�d<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__�r%r%�H/usr/local/CyberCP/lib/python3.10/site-packages/websockets/exceptions.pyrI�rc@sDeZdZdZ	ddd
d�Zdd
d�Zeddd��Zeddd��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�NonecCs8||_||_||_|jdu|jdup|jduksJ�dS�N�r(r*r+)�selfr(r*r+r%r%r&�__init___s&zConnectionClosed.__init__�strcCsl|jdur|jdurdSd|j�d�S|jdurd|j�d�S|jr,d|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 r0�r1r%r%r&�__str__js


zConnectionClosed.__str__�intcCs&t�dt�|jdurtjjS|jjS)NzZConnectionClosed.code is deprecated; use Protocol.close_code or ConnectionClosed.rcvd.code)�warnings�warn�DeprecationWarningr(�frames�	CloseCode�ABNORMAL_CLOSURE�coder4r%r%r&r={s�
zConnectionClosed.codecCs"t�dt�|jdur
dS|jjS)Nz`ConnectionClosed.reason is deprecated; use Protocol.close_reason or ConnectionClosed.rcvd.reason�)r7r8r9r(�reasonr4r%r%r&r?�s�
zConnectionClosed.reasonr/)r(r)r*r)r+r,r-r.�r-r3)r-r6)	r!r"r#r$r2r5�propertyr=r?r%r%r%r&rPs�

rc@r)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%r&r�r'rc@r)rz�
    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�r'rc@�$eZdZdZddd�Zd
d	d
�ZdS)r	zL
    Raised when connecting to a URI that isn't a valid WebSocket URI.

    �urir3�msgr-r.cC�||_||_dSr/�rCrD)r1rCrDr%r%r&r2��
zInvalidURI.__init__cC�|j�d|j��S)Nz isn't a valid URI: rFr4r%r%r&r5��zInvalidURI.__str__N)rCr3rDr3r-r.r@�r!r"r#r$r2r5r%r%r%r&r	��
r	c@rB)r
z?
    Raised when connecting via a proxy that isn't valid.

    �proxyr3rDr-r.cCrEr/�rLrD)r1rLrDr%r%r&r2�rGzInvalidProxy.__init__cCrH)Nz isn't a valid proxy: rMr4r%r%r&r5�rIzInvalidProxy.__str__N)rLr3rDr3r-r.r@rJr%r%r%r&r
�rKr
c@r)rzM
    Base class for exceptions raised when the opening handshake fails.

    Nr r%r%r%r&r�r'rc@r)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�r'rc@r)r
z5
    Raised when failing to connect to a proxy.

    Nr r%r%r%r&r
�r'r
c@r)rz;
    Raised when an HTTP proxy response is malformed.

    Nr r%r%r%r&r�r'rc@�$eZdZdZddd�Zd
d	d
�ZdS)rz<
    Raised when an HTTP proxy rejects the connection.

    �response�http11.Responser-r.cC�
||_dSr/�rO�r1rOr%r%r&r2��
zInvalidProxyStatus.__init__r3cC�d|jjd��S)Nz proxy rejected connection: HTTP �d�rO�status_coder4r%r%r&r5�szInvalidProxyStatus.__str__N�rOrPr-r.r@rJr%r%r%r&r��
rc@r)rzD
    Raised when a handshake request or response is malformed.

    Nr r%r%r%r&r�r'rc@rN)rzJ
    Raised when a handshake response rejects the WebSocket upgrade.

    rOrPr-r.cCrQr/rRrSr%r%r&r2�rTzInvalidStatus.__init__r3cCrU)Nz+server rejected WebSocket connection: HTTP rVrWr4r%r%r&r5�s�zInvalidStatus.__str__NrYr@rJr%r%r%r&r�rZrc@s&eZdZdZd
dd	d
�Zddd�ZdS)rzK
    Raised when an HTTP header doesn't have a valid format or value.

    N�namer3�value�
str | Noner-r.cCrEr/�r[r\�r1r[r\r%r%r&r2
rGzInvalidHeader.__init__cCsD|jdurd|j�d�S|jdkrd|j�d�Sd|j�d|j��S)Nzmissing z headerr>zempty zinvalid z	 header: �r\r[r4r%r%r&r5s


zInvalidHeader.__str__r/�r[r3r\r]r-r.r@rJr%r%r%r&rsrcs"eZdZdZd�fd
d�Z�ZS)
rz�
    Raised when an HTTP header cannot be parsed.

    The format of the header doesn't match the grammar for that header.

    r[r3�error�header�posr6r-r.cs"t��||�d|�d|���dS)Nz at z in ��superr2)r1r[rbrcrd��	__class__r%r&r2s"zInvalidHeaderFormat.__init__)
r[r3rbr3rcr3rdr6r-r.�r!r"r#r$r2�
__classcell__r%r%rgr&rsrc@r)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%r&r#r'rcs"eZdZdZd�fdd�Z�ZS)	rzD
    Raised when the Origin header in a request isn't allowed.

    �originr]r-r.cst��d|�dS)N�Originre)r1rkrgr%r&r22rIzInvalidOrigin.__init__)rkr]r-r.rir%r%rgr&r,src@r)rzF
    Raised when the Upgrade or Connection header isn't correct.

    Nr r%r%r%r&r6r'rc@r)rzG
    Raised when negotiating an extension or a subprotocol fails.

    Nr r%r%r%r&r=r'rc@�$eZdZdZddd�Zddd	�Zd
S)
rzK
    Raised when a parameter name is repeated in an extension header.

    r[r3r-r.cCrQr/�r[�r1r[r%r%r&r2JrTzDuplicateParameter.__init__cC�d|j��S)Nzduplicate parameter: rnr4r%r%r&r5M�zDuplicateParameter.__str__N�r[r3r-r.r@rJr%r%r%r&rDrZrc@rm)
rzJ
    Raised when a parameter name in an extension header is invalid.

    r[r3r-r.cCrQr/rnror%r%r&r2WrTzInvalidParameterName.__init__cCrp)Nzinvalid parameter name: rnr4r%r%r&r5ZrqzInvalidParameterName.__str__Nrrr@rJr%r%r%r&rQrZrc@s$eZdZdZd
dd	�Zdd
d�ZdS)rzK
    Raised when a parameter value in an extension header is invalid.

    r[r3r\r]r-r.cCrEr/r^r_r%r%r&r2drGzInvalidParameterValue.__init__cCs@|jdurd|j��S|jdkrd|j��Sd|j�d|j��S)Nzmissing value for parameter r>zempty value for parameter zinvalid value for parameter z: r`r4r%r%r&r5hs


zInvalidParameterValue.__str__Nrar@rJr%r%r%r&r^rKrc@r)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%r&rqr'rc@s4eZdZdZ		ddd
d�Zdd
d�Zddd�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_sizer-r.cCsjt|t�r|dusJ�|dusJ�t�dt�||_dSd|_||_|dus(J�||_d|_|�	|�dS)NzMPayloadTooBig(message) is deprecated; change to PayloadTooBig(size, max_size))
�
isinstancer3r7r8r9�message�sizerurw�set_current_size)r1rsrurwr%r%r&r2�s
�
zPayloadTooBig.__init__r3cCsb|jdur|jSd}|jdur|d|j�d�7}|jdur&|d|j�d�7}|d|j�d�7}|S)Nzframe zwith z bytes zafter reading zexceeds limit of z bytes)ryrzrwru)r1ryr%r%r&r5�s


zPayloadTooBig.__str__cCs2|jdusJ�|dur|j|7_||_dSdSr/)rwru)r1rwr%r%r&r{�s

�zPayloadTooBig.set_current_size)NN)rsrtrurvrwrvr-r.r@)rwrvr-r.)r!r"r#r$r2r5r{r%r%r%r&r}s�
rc@r)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%r&r�r'rc@r)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%r&r�r'r)r:�http11z.legacy.exceptions)�AbortHandshake�InvalidStatusCode�RedirectHandshake�WebSocketProtocolError)�deprecated_aliases)(r$�
__future__rr7�importsr�__all__�	Exceptionrrrrr	r
rrr
rrrrrrrrrrrrrrr�AssertionErrorr�RuntimeErrorrr>r:r|�globalsr%r%r%r&�<module>sP#B



	


6�
�