
    9h3                       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 " S1 S2\5      r " S3 S4\5      r " S5 S6\5      r " S7 S8\\ 5      r! " S9 S:\\"5      r#SS;K$J%r%J&r&  \" \'" 5       S<S<S<S<S=.S>9  g)?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                      \ rS rSrSrSrg)r   I   z7
Base class for all exceptions defined by websockets.

 N__name__
__module____qualname____firstlineno____doc____static_attributes__r"       ZC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\websockets/exceptions.pyr   r   I       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   P   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)selfr2   r3   r4   s       r+   __init__ConnectionClosed.__init___   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 r1   r5   s    r+   __str__ConnectionClosed.__str__j   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DeprecationWarningr2   frames	CloseCodeABNORMAL_CLOSUREcoder9   s    r+   rC   ConnectionClosed.code{   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 )r=   r>   r?   r2   reasonr9   s    r+   rG   ConnectionClosed.reason   s6    H	

 99yyr*   )r2   r4   r3   r0   )r2   frames.Close | Noner3   rI   r4   zbool | NonereturnNonerJ   str)rJ   int)r$   r%   r&   r'   r(   r6   r:   propertyrC   rG   r)   r"   r*   r+   r   r   P   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	      rR   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 r0   urimsg)r5   rY   rZ   s      r+   r6   InvalidURI.__init__   s    r*   c                8    U R                    SU R                   3$ )Nz isn't a valid URI: rX   r9   s    r+   r:   InvalidURI.__str__   s    ((/z::r*   )rZ   rY   N)rY   rM   rZ   rM   rJ   rK   rL   r$   r%   r&   r'   r(   r6   r:   r)   r"   r*   r+   r
   r
      s    
;r*   r
   c                  ,    \ rS rSrSrSS jrSS jrSrg)	r      z7
Raised when connecting via a proxy that isn't valid.

c                    Xl         X l        g r0   proxyrZ   )r5   rc   rZ   s      r+   r6   InvalidProxy.__init__   s    
r*   c                8    U R                    SU R                   3$ )Nz isn't a valid proxy: rb   r9   s    r+   r:   InvalidProxy.__str__   s    **3DHH:>>r*   )rZ   rc   N)rc   rM   rZ   rM   rJ   rK   rL   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      rR   r*   r   c                      \ rS rSrSrSrg)r      z-
Raised when failing to connect to a proxy.

r"   Nr#   r"   r*   r+   r   r      r,   r*   r   c                      \ rS rSrSrSrg)r      z3
Raised when an HTTP proxy response is malformed.

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      z4
Raised when an HTTP proxy rejects the connection.

c                    Xl         g r0   responser5   rs   s     r+   r6   InvalidProxyStatus.__init__        r*   c                6    SU R                   R                  S 3$ )Nz proxy rejected connection: HTTP drs   status_coder9   s    r+   r:   InvalidProxyStatus.__str__   s    1$--2K2KA1NOOr*   rr   Nrs   zhttp11.ResponserJ   rK   rL   r^   r"   r*   r+   r   r      s    
!Pr*   r   c                      \ rS rSrSrSrg)r      z<
Raised when a handshake request or response is malformed.

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      zB
Raised when a handshake response rejects the WebSocket upgrade.

c                    Xl         g r0   rr   rt   s     r+   r6   InvalidStatus.__init__   rv   r*   c                6    SU R                   R                  S 3$ )Nz+server rejected WebSocket connection: HTTP rx   ry   r9   s    r+   r:   InvalidStatus.__str__   s    9$--:S:STU9VW	
r*   rr   Nr|   rL   r^   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   i  zC
Raised when an HTTP header doesn't have a valid format or value.

Nc                    Xl         X l        g r0   namevaluer5   r   r   s      r+   r6   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 headerrF   zempty zinvalid z	 header: r   r   r9   s    r+   r:   InvalidHeader.__str__  sY    ::dii[00ZZ2DII;g..dii[	$**>>r*   r   r0   r   rM   r   
str | NonerJ   rK   rL   r^   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   i  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 superr6   )r5   r   errorheaderpos	__class__s        r+   r6   InvalidHeaderFormat.__init__  s!    SEfX>?r*   r"   )
r   rM   r   rM   r   rM   r   rN   rJ   rK   r$   r%   r&   r'   r(   r6   r)   __classcell__r   s   @r+   r   r     s    @ @r*   r   c                      \ rS rSrSrSrg)r   i#  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   i,  z<
Raised when the Origin header in a request isn't allowed.

c                &   > [         TU ]  SU5        g )NOriginr   )r5   originr   s     r+   r6   InvalidOrigin.__init__2  s    6*r*   r"   )r   r   rJ   rK   r   r   s   @r+   r   r   ,  s    
+ +r*   r   c                      \ rS rSrSrSrg)r   i6  z>
Raised when the Upgrade or Connection header isn't correct.

r"   Nr#   r"   r*   r+   r   r   6  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   iD  zC
Raised when a parameter name is repeated in an extension header.

c                    Xl         g r0   r   r5   r   s     r+   r6   DuplicateParameter.__init__J      	r*   c                     SU R                    3$ )Nzduplicate parameter: r   r9   s    r+   r:   DuplicateParameter.__str__M  s    &tyyk22r*   r   Nr   rM   rJ   rK   rL   r^   r"   r*   r+   r   r   D  s    
3r*   r   c                  ,    \ rS rSrSrSS jrSS jrSrg)	r   iQ  zB
Raised when a parameter name in an extension header is invalid.

c                    Xl         g r0   r   r   s     r+   r6   InvalidParameterName.__init__W  r   r*   c                     SU R                    3$ )Nzinvalid parameter name: r   r9   s    r+   r:   InvalidParameterName.__str__Z  s    )$))55r*   r   Nr   rL   r^   r"   r*   r+   r   r   Q  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 r0   r   r   s      r+   r6   InvalidParameterValue.__init__d  r   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 rF   zempty value for parameter zinvalid value for parameter z: r   r9   s    r+   r:   InvalidParameterValue.__str__h  sU    ::1$))==ZZ2/		{;;1$))BtzzlKKr*   r   Nr   rL   r^   r"   r*   r+   r   r   ^  s    
Lr*   r   c                      \ rS rSrSrSrg)r   iq  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   q  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   i}  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))

isinstancerM   r=   r>   r?   messagesizemax_sizecur_sizeset_current_size)r5   size_or_messager   r   s       r+   r6   PayloadTooBig.__init__  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   )r5   r   s     r+   r:   PayloadTooBig.__str__  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 r0   )r   r   )r5   r   s     r+   r   PayloadTooBig.set_current_size  s0    }}$$$MMX%M$M  r*   )r   r   r   r   )NN)r   zint | None | strr   
int | Noner   r   rJ   rK   rL   )r   r   rJ   rK   )	r$   r%   r&   r'   r(   r6   r:   r   r)   r"   r*   r+   r   r   }  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     rR   r*   r   )r@   http11z.legacy.exceptions)AbortHandshakeInvalidStatusCodeRedirectHandshakeWebSocketProtocolError)deprecated_aliases)(r(   
__future__r   r=   importsr   __all__	Exceptionr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   AssertionErrorr   RuntimeErrorr   rF   r@   r   globalsr"   r*   r+   <module>r      s  !F #   < ? ) ? D) , ;# ;?% ?) $ ! * 
P 
P% 
$ 
?$ ?&	@- 	@ +M +] ' 
3) 
3
6+ 
6L, L&	& 	3%& 3%l%~ )<   I /11"6	r*   