+
    XjA                       a  0 t $ ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
Ht ^ RIHt ^RIHtHt ^RIHt  ^RIHt . R$Ot ! R R]P.                  4      t]P2                  t]P6                  t]P:                  t]P>                  t ]PB                  t"]PF                  t$]]]3t%] ]"]$3t& ! R R	]P.                  4      t']'PP                  R]'PR                  R]'PT                  R]'PV                  R]'PX                  R]'PZ                  R]'P\                  R]'P^                  R]'P`                  R]'Pb                  R]'Pd                  R]'Pf                  R]'Ph                  R]'Pj                  R]'Pl                  R/t7R]8R&   ]'PP                  ]'PR                  ]'PT                  ]'PV                  ]'P\                  ]'P^                  ]'P`                  ]'Pb                  ]'Pd                  ]'Pf                  ]'Ph                  ]'Pj                  0t9]'PP                  ]'PR                  ]'PX                  0t:]Pv                   ! R R
4      4       t<]Pv                   ! R  R4      4       t=R%R! R" llt>^R#I?H@t@ R#   ] d    ^RIHt  EL6i ; i)&    )annotationsN)	GeneratorSequence)Callable)PayloadTooBigProtocolError)	BytesLike)
apply_maskOpcode	CloseCodeFrameClosec                  6    ] tR t^&tRt^ ^^uttt^^	^
utt	t
RtR# )r   z#Opcode values for WebSocket frames. N)__name__
__module____qualname____firstlineno____doc__CONTTEXTBINARYCLOSEPINGPONG__static_attributes__r       m   /Users/wind/Downloads/Coruna-main学习资料A/backend/venv/lib/python3.14/site-packages/websockets/frames.pyr   r   &   s%    -tTD$dDE4r   c                  V    ] tR t^8tRtRtRtRtRtRt	Rt
RtR	tR
tRtRtRtRtRtRtRtR# )r   z-Close code values for WebSocket close frames.i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  r   N)r   r   r   r   r   NORMAL_CLOSURE
GOING_AWAYPROTOCOL_ERRORUNSUPPORTED_DATANO_STATUS_RCVDABNORMAL_CLOSUREINVALID_DATAPOLICY_VIOLATIONMESSAGE_TOO_BIGMANDATORY_EXTENSIONINTERNAL_ERRORSERVICE_RESTARTTRY_AGAIN_LATERBAD_GATEWAYTLS_HANDSHAKEr   r   r   r   r   r   8   sT    7NJNNLONOOKMr   OKz
going awayzprotocol errorzunsupported datazno status received [internal]zabnormal closure [internal]zinvalid frame payload datazpolicy violationzmessage too bigzmandatory extensionzinternal errorzservice restartztry again laterzbad gatewayz TLS handshake failure [internal]zdict[int, str]CLOSE_CODE_EXPLANATIONSc                     ] tR t^zt$ RtR]R&   R]R&   RtR]R&   R	tR]R
&   R	tR]R&   R	t	R]R&   ]
! ]P                  P                  RR4      4      t]R]R	]R/tR R ltR R lt]RRRR/R R ll4       tRR/R R lltR R ltRtR# )r   a"  
WebSocket frame.

Attributes:
    opcode: Opcode.
    data: Payload data.
    fin: FIN bit.
    rsv1: RSV1 bit.
    rsv2: RSV2 bit.
    rsv3: RSV3 bit.

Only these fields are needed. The MASK bit, payload length and masking-key
are handled on the fly when parsing and serializing frames.

r   opcoder	   dataTboolfinFrsv1rsv2rsv3WEBSOCKETS_MAX_LOG_SIZE75c                   V ^8  d   QhRR/#    returnstrr   )formats   "r   __annotate__Frame.__annotate__   s     > > >r   c                   V P                   P                  V P                  4      pV P                  4       w  r#W8X  d   RMV'       d   RMRp\	        V P
                  4       R\	        V P
                  4      ^8X  d   RMR 2pV P                  '       d   RMRpRP                  \        RWEV.4      4      pV P                  P                   R	V R
V R2# )a(  
Return a human-readable representation of a frame.

This function is intended for logging and debugging. It doesn't aim to
support round-tripping because payloads can be too long for displaying
conveniently. Instead, it shows the beginning and the end. It's robust
to incorrect data.

It attempts to decode UTF-8 payloads whenever possible, even for binary
frames and control frames, because those frequently contain UTF-8 data.
It applies the same logic to continuation frames, because we don't know
if they continue a text frame or a binary frame.

 textbinaryz bytes	continuedz, N z [])
DEFAULT_IS_TEXTgetr2   
_data_reprlenr3   r5   joinfiltername)selfexpect_text	data_repris_text	data_typelength	non_finalmetadatas   &       r   __str__Frame.__str__   s     **..t{{;!__.	%0Bvh			N#5s499~/B(LM(((B	99VD9i*HIJ++""#1YKr(1==r   c                   V ^8  d   QhRR/# )r=   r>   ztuple[str, bool | None]r   )r@   s   "r   rA   rB      s     F" F"3 F"r   c                   V P                   '       g(   RV P                  P                  V P                  4      3# V P                  \        J d,    \        \        P                  V P                   4      4      R3# \        V P                   4      ^V P                  ,          8  d   \        V P                   R^V P                  ,          ^,           4      p\        V P                   RV P                  ,          ^,          R 4      p\        VV P                  \        8g  R7      ;'       d    \        VV P                  R7      pV'       d"   \!        W,           P#                  RR7      4      pMa\        V P                   4      p\        VV P                  \        8g  V P                  R7      pV'       d   \!        VP#                  RR7      4      pV'       g   V P                   p\        V4      V P                  ^,          8  dC   V P                  ^,          ^,
          ^,          pR	P%                  VR^V,           R
Wg) R .4      pRP%                  R V 4       4      p\        X4      V P                  8  d8   V P                  ^,          ^,
          pVR^V,           R,           WG) R ,           pWC3#   \        \        3 d     ELJi ; i)z
Return a human-readable representation of the payload.

Also returns whether the payload is text.

The representation is elided to fit ``MAX_LOG_SIZE``.

This is a helper for the __str__ method.

z''TN)must_start_clean)must_end_cleanreplace)errors)r^   r_   r   s     rI   c              3  (   "   T F  qR  x  K
  	  R# 5i)02xNr   ).0bytes   & r   	<genexpr>#Frame._data_repr.<locals>.<genexpr>   s      B64:6s   z...)r3   rK   rL   r2   OP_CLOSEr?   r   parser   UnicodeDecodeErrorrN   MAX_LOG_SIZEbytesis_utf8_fragmentOP_CONTr5   reprdecoderO   )rR   
data_startdata_endrU   rT   r3   rF   cuts   &       r   rM   Frame._data_repr   sT    yyy--11$++>>>
 ;;("5;;tyy12D88 tyy>A 1 111 tyy)E1t/@/@+@A+EFGJTYYrD,=,='='B'DEFH&!%!7   ##xx   *"7!?!?y!?!QR	 #D&!%!7#xxG
  I!>?	
 YYF6{T..!33((A-1a76)AG#4k6$%="QR B6 BBI y>D---##q(1,C!)AG,u4y7GGI!!e "#56 s   )J/ /KKmax_sizeN
extensionsc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r=   
read_exactz9Callable[[int], Generator[None, None, bytes | bytearray]]maskr4   rv   z
int | Nonerw   %Sequence[extensions.Extension] | Noner>   zGenerator[None, None, Frame]r   )r@   s   "r   rA   rB      sC     G GMG 	G
 G :G 
&Gr   c             #    "   V! ^4       Rj  xL
 p\         P                  ! RV4      w  rgV^,          '       d   RMRpV^@,          '       d   RMRp	V^ ,          '       d   RMRp
V^,          '       d   RMRp \        V^,          4      pT^,          '       d   RMRT8w  d   \	        R4      hT^,          pT^~8X  d+   T! ^4       Rj  xL
 p\         P                  ! RT4      w  pM0T^8X  d*   T! ^4       Rj  xL
 p\         P                  ! RT4      w  pTe   Y8  d   \        Y4      hT'       d   T! ^4       Rj  xL
 pT! T4       Rj  xL
 pT'       d   \        TX4      pT ! YYY4      pTf   . p\        T4       F  pTP                  TTR	7      pK  	  TP                  4        T#  EL  \         d   p\	        R4      ThRp?ii ; i EL	 L L L5i)
aq  
Parse a WebSocket frame.

This is a generator-based coroutine.

Args:
    read_exact: Generator-based coroutine that reads the requested
        bytes or raises an exception if there isn't enough data.
    mask: Whether the frame should be masked i.e. whether the read
        happens on the server side.
    max_size: Maximum payload size in bytes.
    extensions: List of extensions, applied in reverse order.

Raises:
    EOFError: If the connection is closed without a full WebSocket frame.
    PayloadTooBig: If the frame's payload size exceeds ``max_size``.
    ProtocolError: If the frame contains incorrect values.

N!BBTFzinvalid opcodezincorrect masking!Hz!Q)rv   )
structunpackr   
ValueErrorr   r   r
   reversedrq   check)clsry   rz   rv   rw   r3   head1head2r5   r6   r7   r8   r2   excrW   
mask_bytesframe	extensions   &&$$$             r   rj   Frame.parse   s    : %Q-'}}UD1 j((dez))tuz))tuz))tu	;EJ./F J&&DEd: 344#S=(m+DdD1IVs](m+DdD1IVF$511$.qM1J %V,,dJ/DF#T8J!*-I$$UX$>E . 	W (  	; 01s:	; , ,
 2 -s   GF0>GG!G4G9F3 G/G	G
0G:G;9G5G GGGGAG3G>G

GGGGGc               $    V ^8  d   QhRRRRRR/# )r=   rz   r4   rw   r{   r>   rm   r   )r@   s   "r   rA   rB   C  s*     :! :! :! :	:!
 
:!r   c                  V P                  4        Vf   . pV F  pVP                  V 4      p K  	  \        P                  ! 4       pV P                  '       d   ^M^ V P
                  '       d   ^@M^ ,          V P                  '       d   ^ M^ ,          V P                  '       d   ^M^ ,          V P                  ,          pV'       d   ^M^ p\        V P                  4      pV^~8  d/   VP                  \        P                  ! RWVV,          4      4       MdVR8  d0   VP                  \        P                  ! RWV^~,          V4      4       M.VP                  \        P                  ! RWV^,          V4      4       V'       d(   \        P                  ! ^4      pVP                  V4       V'       d   \!        V P                  X4      p	MV P                  p	VP                  V	4       VP#                  4       # )a  
Serialize a WebSocket frame.

Args:
    mask: Whether the frame should be masked i.e. whether the write
        happens on the client side.
    extensions: List of extensions, applied in order.

Raises:
    ProtocolError: If the frame contains incorrect values.

r}   i   z!BBHz!BBQ)r   encodeioBytesIOr5   r6   r7   r8   r2   rN   r3   writer   packsecretstoken_bytesr
   getvalue)
rR   rz   rw   r   outputr   r   rW   r   r3   s
   &$$       r   	serializeFrame.serializeC  sj   $ 	

J#I##D)D $   888Z!YYYzA/!YYYzA/ "YYYzA/ kk	 	 #
TYYC<LLUE6>BCe^LLVUCKHILLVUCKHI ,,Q/JLL$ dii4D99DT  r   c                   V ^8  d   QhRR/# r=   r>   Noner   )r@   s   "r   rA   rB     s     @ @t @r   c                :   V P                   '       g%   V P                  '       g   V P                  '       d   \        R4      hV P                  \
        9   dE   \        V P                  4      ^}8  d   \        R4      hV P                  '       g   \        R4      hR# R# )z
Check that reserved bits and opcode have acceptable values.

Raises:
    ProtocolError: If a reserved bit or the opcode is invalid.

zreserved bits must be 0zcontrol frame too longzfragmented control frameN)	r6   r7   r8   r   r2   CTRL_OPCODESrN   r3   r5   rR   s   &r   r   Frame.check  sp     999			TYYY 9::;;,&499~##$<==888#$>??  'r   r   )r   r   r   r   r   __annotations__r5   r6   r7   r8   intosenvironrL   rl   OP_TEXT	OP_BINARYri   rK   rZ   rM   classmethodrj   r   r   r   r   r   r   r   r   z   s      N
OCD$D$D$ rzz~~&?FGLi$GO>2F"P G
  $G =AG GR:! =A	:!x@ @r   c                  j    ] tR tRt$ RtR]R&   R]R&   R R lt]R	 R
 l4       tR R lt	R R lt
RtR# )r   i  zk
Code and reason for WebSocket close frames.

Attributes:
    code: Close code.
    reason: Close reason.

zCloseCode | intcoder?   reasonc                   V ^8  d   QhRR/# r<   r   )r@   s   "r   rA   Close.__annotate__  s       r   c                ,   RV P                   u;8:  d   R8  d   M MRpM?RV P                   u;8:  d   R8  d   M MRpM \        P                  V P                   R4      pV P                    RV R2pV P                  '       d   V R	V P                   2pV# )
zE
Return a human-readable representation of a close code and reason.

  i  
registered  zprivate useunknownz ()rI   )r   r0   rL   r   )rR   explanationresults   &  r   rZ   Close.__str__  s~    
 499#t#&KTYY%%'K155diiKKII;bQ/;;;xq.Fr   c                    V ^8  d   QhRRRR/# )r=   r3   r	   r>   r   r   )r@   s   "r   rA   r     s     9 9 9u 9r   c                j   \        V\        4      '       d   \        R4      h\        V4      ^8  dR   \        P
                  ! RVR,          4      w  pVR,          P                  4       pV ! W#4      pVP                  4        V# \        V4      ^ 8X  d   V ! \        P                  R4      # \        R4      h)z
Parse the payload of a close frame.

Args:
    data: Payload of the close frame.

Raises:
    ProtocolError: If data is ill-formed.
    UnicodeDecodeError: If the reason isn't valid UTF-8.

z.only compressed outgoing frames use memoryviewr~   :Nr=   N:r=   NNrD   zclose frame too short)
isinstance
memoryviewAssertionErrorrN   r   r   rq   r   r   r$   r   )r   r3   r   r   closes   &&   r   rj   Close.parse  s     dJ'' !QRRt9>mmD$r(3GT"X__&F%EKKMLY!^y//44 788r   c                   V ^8  d   QhRR/# )r=   r>   rm   r   )r@   s   "r   rA   r     s     C C5 Cr   c                    V P                  4        \        P                  ! RV P                  4      V P                  P                  4       ,           # )z*
Serialize the payload of a close frame.

r~   )r   r   r   r   r   r   r   s   &r   r   Close.serialize  s4    
 	

{{4+dkk.@.@.BBBr   c                   V ^8  d   QhRR/# r   r   )r@   s   "r   rA   r     s     	7 	7t 	7r   c                    V P                   \        9   g)   RV P                   u;8:  d   R8  g   M \        R4      hR# R# )z{
Check that the close code has a valid value for a close frame.

Raises:
    ProtocolError: If the close code is invalid.

r   r   zinvalid status codeN)r   EXTERNAL_CLOSE_CODESr   r   s   &r   r   Close.check  s6     		11TTYY5M5M 566 6N1r   r   N)r   r   r   r   r   r   rZ   r   rj   r   r   r   r   r   r   r   r     s=     K$ 9 92C	7 	7r   c               (    V ^8  d   QhRRRRRRRR/# )r=   r3   rm   r^   r4   r_   r>   r   )r@   s   "r   rA   rA     s6     E' E'
E'E' E' 
	E'r   c                   ^ \        V 4      rCV'       g>   \        ^\        V 4      4      pW58  d#   W,          pV^,          ^8X  d   V^,          pK'   V'       g   V^,          p\        \        V 4      ^,
          V4      pWG8  d   W,          pV^,          ^8X  d   V^,          pK'  V^,          ^ 8X  d   ^pM5V^,          ^8X  d   ^pM$V^,          ^8X  d   ^pMV^,          ^8X  d   ^pM^ pV\        V 4      V,
          8:  d   \        V 4      p  WV P                  4       p	R\	        V	4      9  #   \
         d     R# i ; i)z*Guess if data is a fragment of UTF-8 text.z\xF)rN   minmaxrq   rp   rk   )
r3   r^   r_   startend	max_startre   min_endseq_lenrE   s
   &&&       r   rn   rn     s=    CI33t9%	;D j J.
qc$i!mU+n9Dj J.q j J.
"j0
"j0
"j0  #d)c/)$i'#%%'
 DJ&&	  s   D0 0D?>D?)rw   )r   ro   r   r   ri   OP_PINGOP_PONGDATA_OPCODESr   r   r   r   )FF)A__conditional_annotations__
__future__r   dataclassesenumr   r   r   r   collections.abcr   r   typingr   
exceptionsr   r   r	   speedupsr
   ImportErrorutils__all__IntEnumr   r   ro   r   r   r   r   r   ri   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r0   r   r   OK_CLOSE_CODES	dataclassr   r   rn   rD   rw   )r   s   @r   <module>r      sr   " "   	 	   /  4 "$
 )T\\ ) ++
++MM	<<
++
++*') . d,. 2= =8 20!!#8.00=?+  , !! "  S@ S@ S@l J7 J7 J7ZE'R m  "!!"s    I, ,I=<I=