
    vKg-              	      6   S r SSKJr  SSKrSSKJr  / SQr " S S\5      r " S	 S
\5      r	 " S S\	5      r
 " S S\	5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S \5      r " S! S"\5      r " S# S$\5      r " S% S&\5      r " S' S(\5      r " S) S*\5      r " S+ S,\5      r " S- S.\\5      r " S/ S0\\5      rSS1KJ r J!r!  \" \"" 5       S2S2S2S2S2S3.S49  g)5a  
:mod:`websockets.exceptions` defines the following hierarchy of exceptions.

* :exc:`WebSocketException`
    * :exc:`ConnectionClosed`
        * :exc:`ConnectionClosedOK`
        * :exc:`ConnectionClosedError`
    * :exc:`InvalidURI`
    * :exc:`InvalidHandshake`
        * :exc:`SecurityError`
        * :exc:`InvalidMessage` (legacy)
        * :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InvalidHandshakeSecurityErrorInvalidStatusInvalidHeaderInvalidHeaderFormatInvalidHeaderValueInvalidOriginInvalidUpgradeNegotiationErrorDuplicateParameterInvalidParameterNameInvalidParameterValueProtocolErrorPayloadTooBigInvalidStateConcurrencyErrorc                      \ rS rSrSrSrg)r   @   z7
Base class for all exceptions defined by websockets.

 N__name__
__module____qualname____firstlineno____doc____static_attributes__r       U/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/websockets/exceptions.pyr   r   @       r%   r   c                  h    \ rS rSrSr S	       S
S jjrSS jr\SS j5       r\SS j5       r	Sr
g)r   G   a  
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.

Nc                    Xl         X l        X0l        U R                  S L U R                   S L =(       d    U R                  S L :X  d   eg Nrcvdsentrcvd_then_sent)selfr-   r.   r/   s       r&   __init__ConnectionClosed.__init__V   sE     		,##t+d1B1WdiiSWFWXXXr%   c                $   U R                   c  U R                  c  gSU R                   S3$ U R                  c  SU R                    S3$ U R                  (       a  SU R                    SU R                   3$ SU R                   SU R                    3$ )Nzno close frame received or sentzsent z; no close frame receivedz	received z; no close frame sentz; then sent z; then received r,   r0   s    r&   __str__ConnectionClosed.__str__a   s    99yy 8tyyk)BCCyy "499+-BCC&&&tyykdii[II"499+-=dii[IIr%   c                    [         R                  " S[        5        U R                  c  [        R
                  R                  $ U R                  R                  $ )NzZConnectionClosed.code is deprecated; use Protocol.close_code or ConnectionClosed.rcvd.code)warningswarnDeprecationWarningr-   frames	CloseCodeABNORMAL_CLOSUREcoder4   s    r&   r>   ConnectionClosed.coder   sC    D	

 99##444yy~~r%   c                    [         R                  " S[        5        U R                  c  gU R                  R                  $ )Nz`ConnectionClosed.reason is deprecated; use Protocol.close_reason or ConnectionClosed.rcvd.reason )r8   r9   r:   r-   reasonr4   s    r&   rB   ConnectionClosed.reason}   s6    H	

 99yyr%   )r-   r/   r.   r+   )r-   frames.Close | Noner.   rD   r/   zbool | NonereturnNonerE   str)rE   int)r   r    r!   r"   r#   r1   r5   propertyr>   rB   r$   r   r%   r&   r   r   G   sj    $ '+		Y!	Y "	Y $		Y
 
	YJ"      r%   r   c                      \ rS rSrSrSrg)r      z
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.

r   Nr   r   r%   r&   r   r          r%   r   c                      \ rS rSrSrSrg)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.

r   Nr   r   r%   r&   r	   r	      rM   r%   r	   c                  ,    \ rS rSrSrSS jrSS jrSrg)	r
      zD
Raised when connecting to a URI that isn't a valid WebSocket URI.

c                    Xl         X l        g r+   urimsg)r0   rT   rU   s      r&   r1   InvalidURI.__init__   s    r%   c                8    U R                    SU R                   3$ )Nz isn't a valid URI: rS   r4   s    r&   r5   InvalidURI.__str__   s    ((/z::r%   )rU   rT   N)rT   rH   rU   rH   rE   rF   rG   r   r    r!   r"   r#   r1   r5   r$   r   r%   r&   r
   r
      s    
;r%   r
   c                      \ rS rSrSrSrg)r      zE
Base class for exceptions raised when the opening handshake fails.

r   Nr   r   r%   r&   r   r      r'   r%   r   c                      \ rS rSrSrSrg)r      z
Raised when a handshake request or response breaks a security rule.

Security limits can be configured with :doc:`environment variables
<../reference/variables>`.

r   Nr   r   r%   r&   r   r      rM   r%   r   c                  ,    \ rS rSrSrSS jrSS jrSrg)	r      zB
Raised when a handshake response rejects the WebSocket upgrade.

c                    Xl         g r+   response)r0   rb   s     r&   r1   InvalidStatus.__init__   s     r%   c                6    SU R                   R                  S 3$ )Nz+server rejected WebSocket connection: HTTP d)rb   status_coder4   s    r&   r5   InvalidStatus.__str__   s#    MM--a02	
r%   ra   N)rb   zhttp11.ResponserE   rF   rG   rY   r   r%   r&   r   r      s    
!
r%   r   c                  0    \ rS rSrSrSSS jjrS	S jrSrg)
r      zC
Raised when an HTTP header doesn't have a valid format or value.

Nc                    Xl         X l        g r+   namevaluer0   rl   rm   s      r&   r1   InvalidHeader.__init__       	
r%   c                    U R                   c  SU R                   S3$ U R                   S:X  a  SU R                   S3$ SU R                   SU R                    3$ )Nzmissing z headerrA   zempty zinvalid z	 header: rm   rl   r4   s    r&   r5   InvalidHeader.__str__   sY    ::dii[00ZZ2DII;g..dii[	$**>>r%   rk   r+   rl   rH   rm   
str | NonerE   rF   rG   rY   r   r%   r&   r   r      s    
?r%   r   c                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r      zt
Raised when an HTTP header cannot be parsed.

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

c                4   > [         TU ]  X SU SU 35        g )Nz at z in superr1   )r0   rl   errorheaderpos	__class__s        r&   r1   InvalidHeaderFormat.__init__   s!    SEfX>?r%   r   )
rl   rH   r{   rH   r|   rH   r}   rI   rE   rF   r   r    r!   r"   r#   r1   r$   __classcell__r~   s   @r&   r   r      s    @ @r%   r   c                      \ rS rSrSrSrg)r      zu
Raised when an HTTP header has a wrong value.

The format of the header is correct but the value isn't acceptable.

r   Nr   r   r%   r&   r   r      s    r%   r   c                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r      z<
Raised when the Origin header in a request isn't allowed.

c                &   > [         TU ]  SU5        g )NOriginry   )r0   originr~   s     r&   r1   InvalidOrigin.__init__   s    6*r%   r   )r   ru   rE   rF   r   r   s   @r&   r   r      s    
+ +r%   r   c                      \ rS rSrSrSrg)r      z>
Raised when the Upgrade or Connection header isn't correct.

r   Nr   r   r%   r&   r   r      r'   r%   r   c                      \ rS rSrSrSrg)r   i  z?
Raised when negotiating an extension or a subprotocol fails.

r   Nr   r   r%   r&   r   r     r'   r%   r   c                  ,    \ rS rSrSrSS jrSS jrSrg)	r   i  zC
Raised when a parameter name is repeated in an extension header.

c                    Xl         g r+   rl   r0   rl   s     r&   r1   DuplicateParameter.__init__      	r%   c                     SU R                    3$ )Nzduplicate parameter: r   r4   s    r&   r5   DuplicateParameter.__str__  s    &tyyk22r%   r   Nrl   rH   rE   rF   rG   rY   r   r%   r&   r   r     s    
3r%   r   c                  ,    \ rS rSrSrSS jrSS jrSrg)	r   i  zB
Raised when a parameter name in an extension header is invalid.

c                    Xl         g r+   r   r   s     r&   r1   InvalidParameterName.__init__  r   r%   c                     SU R                    3$ )Nzinvalid parameter name: r   r4   s    r&   r5   InvalidParameterName.__str__"  s    )$))55r%   r   Nr   rG   rY   r   r%   r&   r   r     s    
6r%   r   c                  ,    \ rS rSrSrSS jrSS jrSrg)	r   i&  zC
Raised when a parameter value in an extension header is invalid.

c                    Xl         X l        g r+   rk   rn   s      r&   r1   InvalidParameterValue.__init__,  rp   r%   c                    U R                   c  SU R                   3$ U R                   S:X  a  SU R                   3$ SU R                   SU R                    3$ )Nzmissing value for parameter rA   zempty value for parameter zinvalid value for parameter z: rr   r4   s    r&   r5   InvalidParameterValue.__str__0  sU    ::1$))==ZZ2/		{;;1$))BtzzlKKr%   rk   Nrt   rG   rY   r   r%   r&   r   r   &  s    
Lr%   r   c                      \ rS rSrSrSrg)r   i9  z
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.

r   Nr   r   r%   r&   r   r   9  s    r%   r   c                  L    \ rS rSrSr  S       S	S jjrS
S jrSS jrSrg)r   iE  a=  
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.

Nc                    [        U[        5      (       a,  Ub   eUb   e[        R                  " S[        5        Xl        g S U l        Xl        Uc   eX l        S U l        U R                  U5        g )NzMPayloadTooBig(message) is deprecated; change to PayloadTooBig(size, max_size))

isinstancerH   r8   r9   r:   messagesizemax_sizecur_sizeset_current_size)r0   size_or_messager   r   s       r&   r1   PayloadTooBig.__init__Q  sv     os++######MM:"
 (7LDL$3I'''!)M(,DM!!(+r%   c                    U R                   b  U R                   $ SnU R                  b  USU R                   S3-  nU R                  b  USU R                   S3-  nUSU R                   S3-  nU$ )Nzframe zwith z bytes zafter reading zexceeds limit of z bytes)r   r   r   r   )r0   r   s     r&   r5   PayloadTooBig.__str__h  sz    <<#<<Gyy$U499+W55}}(^DMM?'BB*4==/@@GNr%   c                `    U R                   b   eUb  U =R                  U-  sl        Xl         g g r+   )r   r   )r0   r   s     r&   r   PayloadTooBig.set_current_sizet  s0    }}$$$MMX%M$M  r%   )r   r   r   r   )NN)r   zint | None | strr   
int | Noner   r   rE   rF   rG   )r   r   rE   rF   )	r   r    r!   r"   r#   r1   r5   r   r$   r   r%   r&   r   r   E  sD    	  $#	,), , 	,
 
,.
%r%   r   c                      \ rS rSrSrSrg)r   i{  a~  
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`.

r   Nr   r   r%   r&   r   r   {  s    r%   r   c                      \ rS rSrSrSrg)r   i  z
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.

r   Nr   r   r%   r&   r   r     rM   r%   r   )r;   http11z.legacy.exceptions)AbortHandshakeInvalidMessageInvalidStatusCodeRedirectHandshakeWebSocketProtocolError)deprecated_aliases)#r#   
__future__r   r8   importsr   __all__	Exceptionr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   AssertionErrorr   RuntimeErrorr   rA   r;   r   globalsr   r%   r&   <module>r      s\  > #   2 ? ) ? D) , ;# ;) $ 
$ 
 ?$ ?&	@- 	@ +M +] ' 
3) 
3
6+ 
6L, L&	& 	3%& 3%l%~ )<   I /.11"6
r%   