Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
frames.cpython-313.pyc152 linesDownload Raw Back to __pycache__
1�

2p�j4����%SSKJr SSKrSSKrSSKrSSKrSSKrSSKrSSKJ	r	J3r4 SSKJr SSK
JrJr SSKJr SSKJr /S	Qr"S5S\R,5r\R0r\R4r\R8r\R<r\R@r!\RDr#\\\4r$\\!\#4r%"SS
\R,5r&\&RNS\&RPS\&RRS\&RTS\&RVS\&RXS\&RZS\&R\S\&R^S\&R`S\&RbS\&RdS\&RfS\&RhS\&RjS0r6S\7S'\&RN\&RP\&RR\&RT\&RZ\&R\\&R^\&R`\&Rb\&Rd\&Rf\&Rh1r8\&RN\&RP\&RV1r9\Rt"SS 55r;\Rt"S!S"55r<SS#K=J>r> g!\a6 SSKJr GN,f=f)$�)�annotationsN)�	Generator�Sequence)�Callable�)�
PayloadTooBig�
ProtocolError)�	BytesLike)�7apply_mask)�Opcode�OP_CONT�OP_TEXT�	OP_BINARY�OP_CLOSE�OP_PING�OP_PONG�DATA_OPCODES�CTRL_OPCODES�	CloseCode�Frame�Closec�0�\rSrSrSrSurrrSurr	r8Srg)r�&z#Opcode values for WebSocket frames.)rr�)��	�9�N)�__name__�10__module__�__qualname__�__firstlineno__�__doc__�CONT�TEXT�BINARY�CLOSE�PING�PONG�__static_attributes__r��WD:\code\apps\devtools\python\user_packages\Python313\site-packages\websockets/frames.pyrr&s��-�)��D�$��(��E�4�r+rc�T�\rSrSrSrSrSrSrSrSr	Sr11S	rS12rSr
SrS
rSrSrSrSrSrg)r�8z-Close code values for WebSocket close frames.i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�rN)rr r!r"r#�NORMAL_CLOSURE�13GOING_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*rr+r,rr8sT��7��N��J��N����N����L����O����N��O��O��K��Mr+r�OKz14going awayzprotocol errorzunsupported datazno status received [internal]zabnormal closure [internal]zinvalid frame payload datazpolicy violationzmessage too bigzmandatory extensionzinternal errorzservice restartztry again laterzbad gatewayz TLS handshake failure [internal]zdict[int, str]�CLOSE_CODE_EXPLANATIONSc�15�\rSrSr%SrS\S'S\S'SrS\S	'S16rS\S'S17rS\S'S18r	S\S
'\19"\RRSS55rSSjr\SSS.SSjj5rSS.SSjjrSSjrSrg)r�za"20WebSocket frame.21 22Attributes:23    opcode: Opcode.24    data: Payload data.25    fin: FIN bit.26    rsv1: RSV1 bit.27    rsv2: RSV2 bit.28    rsv3: RSV3 bit.29 30Only these fields are needed. The MASK bit, payload length and masking-key31are handled on the fly when parsing and serializing frames.32 33r�opcoder34�dataT�bool�finF�rsv1�rsv2�rsv3�WEBSOCKETS_MAX_LOG_SIZE�75c�*�Sn[UR5S[UR5S:XaSOS3nUR(aSOSnUR[La.[[
UR5R55nGOUR[LasURn[U5URS-:�a2URS-S-35S-nSRUSS	U-S36XV*S/5nSRSU55nOUR[La)[[RUR55nOCUR(a0[[
UR5R55nS
nOSn[U5UR:�a#URS-S-37nUSS	U-S-XF*S-nSR[#SXU/55nURR$SUSUS3$![[ 4aw URn[U5URS-:�a2URS-S-38S-nSRUSS	U-S39XV*S/5nSRSU55nSnN�f=f)z540Return a human-readable representation of a frame.41 42Nz byter��s�	continued�r+rs� c3�(# �UHoSv� M43 g7f��02xNr��.0�bytes  r,�	<genexpr>� Frame.__str__.<locals>.<genexpr>�s���=�f�d�C�j�M�f����textc3�(# �UHoSv� M44 g7frRrrTs  r,rWrX�s���A�&�$��*�
�&�rY�binaryz''z...z, z [�])�lenrCrErBr�repr�bytes�decoder�MAX_LOG_SIZE�joinr�strr�parse�UnicodeDecodeError�AttributeError�filter�name)�self�coding�length�	non_finalrCr\�cut�metadatas        r,�__str__�
Frame.__str__�sW��45����	�	�N�#�5�s�4�9�9�~��/B���(L�M���(�(�B��	��;�;�'�!���d�i�i�(�/�/�1�2�D�
�[�[�I�
%��Y�Y�F��6�{�T�.�.�!�3�3��(�(�A�-��1�a�7�����6�)�A��G�#4�k�6�$�%�=�"Q�R���8�8�=�f�=�=�D�
�[�[�H�
$��u�{�{�4�9�9�-�.�D�
�Y�Y�	
"��E�$�)�)�,�3�3�5�6�����D��t�9�t�(�(�(��#�#�q�(�1�,�C��	�!�c�'�?�U�*�T�$�%�[�8�D��9�9�V�D�6�9�*E�F�G���+�+�"�"�#�1�T�F�"�X�J�a�8�8��!'��7�
"������v�;��!2�!2�a�!7�7��,�,��1�A�5�!�;�C� �X�X�v�i��C��'8�+�v�d�e�}�&U�V�F��x�x�A�&�A�A��!��

"�s�".H�BJ�JN)�max_size�46extensionsc#�^# �U"S5Shv�Nn[R"SU5upgUS-(aSOSnUS-(aSOSn	US-(aSOSn47US	-(aSOSn[US48-5nUS-(aSOSU:wa[	S5eUS
-nUS:Xa*U"S5Shv�Nn[R"SU5unO/US
:Xa)U"S5Shv�Nn[R"SU5unUbX�:�a[X�5eU(aU"S5Shv�NnU"U5Shv�NnU(a[
UW5nU"X�X�X�5nUc/n[U5HnURUUS9nM UR5 U$GNv![an
[	S5U
eSn
A
ff=fN�N�N�N�7f)aq49Parse a WebSocket frame.50 51This is a generator-based coroutine.52 53Args:54    read_exact: Generator-based coroutine that reads the requested55        bytes or raises an exception if there isn't enough data.56    mask: Whether the frame should be masked i.e. whether the read57        happens on the server side.58    max_size: Maximum payload size in bytes.59    extensions: List of extensions, applied in reverse order.60 61Raises:62    EOFError: If the connection is closed without a full WebSocket frame.63    PayloadTooBig: If the frame's payload size exceeds ``max_size``.64    ProtocolError: If the frame contains incorrect values.65 66rN�!BB�TF�@� ��zinvalid opcodezincorrect masking��~�!Hrz!Q�)rr)67�struct�unpackr�68ValueErrorr	rr�reversedra�check)�cls�69read_exact�maskrrrsrC�head1�head2rErFrGrHrB�excrl�70mask_bytes�frame�	extensions                  r,re�Frame.parse�s����:%�Q�-�'���}�}�U�D�1����j�(�d�e���z�)�t�u���z�)�t�u���z�)�t�u��	;��E�J�.�/�F��J�&�D�E�d�:�� 3�4�4���#���S�=�(��m�+�D��
�
�d�D�1�I�V�
�s�]�(��m�+�D��
�
�d�D�1�I�V���F�$5���1�1��$.�q�M�1�J�%�V�,�,����d�J�/�D��F�#�T�8�����J�!�*�-�I��$�$�U�X�$�>�E�.�	���
���W(���	;�� 0�1�s�:��	;��,�,�712�-�sx�F-�F�AF-�%F�33F-�&F%�'/F-�F'�AF-�F)�F-�)F+�*AF-�72F"�F�F"�"F-�'F-�)F-�+F-�rsc��UR5 Uc/nUHnURU5nM [R"5nUR(aSOSUR73(aSOS-UR(aSOS-UR(aSOS-UR-nU(aSOSn[UR5nUS:a*UR[R"SXVU-55 O[US:a+UR[R"S	XVS-U55 O*UR[R"S74XVS-U55 U(a'[R"S5nURU5 U(a[!URW5n	OURn	URU	5 UR#5$)
a75Serialize a WebSocket frame.76 77Args:78    mask: Whether the frame should be masked i.e. whether the write79        happens on the client side.80    extensions: List of extensions, applied in order.81 82Raises:83    ProtocolError: If the frame contains incorrect values.84 85rvrrwrxryr|ruiz!BBHz!BBQr{r~)r��encode�io�BytesIOrErFrGrHrBr^rC�writer�pack�secrets�token_bytesr�getvalue)86rjr�rsr��outputr�r�rlr�rCs87          r,�	serialize�Frame.serializesb��$	
�88�89�����J�#�I��#�#�D�)�D�$������ �8�8�Z��!�Y�Y�z�A�
/�!�Y�Y�z�A�
/�"�Y�Y�z�A�
/��k�k�	
�	�#�90����T�Y�Y����C�<��L�L����U�E�6�>�B�C�
�e�^��L�L����V�U�C�K��H�I��L�L����V�U�C�K��H�I�� �,�,�Q�/�J��L�L��$���d�i�i��4�D��9�9�D����T����� � r+c�*�UR(d"UR(dUR(a[S5eUR[91;aA[
UR5S:�a[S5eUR(d[S5egg)z�92Check that reserved bits and opcode have acceptable values.93 94Raises:95    ProtocolError: If a reserved bit or the opcode is invalid.96 97zreserved bits must be 0�}zcontrol frame too longzfragmented control frameN)	rFrGrHr	rBrr^rCrE�rjs r,r��Frame.checkNsh���9�9��	�	�T�Y�Y�� 9�:�:��;�;�,�&��4�9�9�~��#�#�$<�=�=��8�8�#�$>�?�?��'r+r��returnrd)98r�z9Callable[[int], Generator[None, None, bytes | bytearray]]r�rDrrz99int | Noners�%Sequence[extensions.Extension] | Noner�zGenerator[None, None, Frame])r�rDrsr�r�r`�r��None)rr r!r"r#�__annotations__rErFrGrH�int�os�environ�getrbrp�classmethodrer�r�r*rr+r,rrzs���� 
�N�100�O��C����D�$���D�$���D�$���r�z�z�~�~�&?��F�G�L�09�d� $�<@�
G�M�G��	G�101�G�:�
G�102&�G��G�Z=A�	:!��:!�:�	:!�103104�:!�x@r+rc�`�\rSrSr%SrS\S'S\S'S
Sjr\SSj5rSS	jr	SS105jr106Srg)ri`zk107Code and reason for WebSocket close frames.108 109Attributes:110    code: Close code.111    reason: Close reason.112 113zCloseCode | int�coderd�reasonc�"�SURs=::aS:aO OSnO=SURs=::aS:aO OSnO [RURS5nURSUS3nUR(aUS	UR3nU$)114zE115Return a human-readable representation of a close code and reason.116 117�i��118registered�zprivate use�unknownz (�)rP)r�r?r�r�)rj�explanation�results   r,rp�
Close.__str__ns|��119�4�9�9�#�t�#�&�K�
�T�Y�Y�
%��
%�'�K�1�5�5�d�i�i��K�K��I�I�;�b��
�Q�/���;�;��x�q����
�.�F��
r+c�T�[U[5(a[S5e[U5S:�aI[R120"SUSS5unUSSR
5nU"X#5nUR5 U$[U5S:XaU"[RS5$[S5e)z�121Parse the payload of a close frame.122 123Args:124    data: Payload of the close frame.125 126Raises:127    ProtocolError: If data is ill-formed.128    UnicodeDecodeError: If the reason isn't valid UTF-8.129 130z.only compressed outgoing frames use memoryviewrr}NrrLzclose frame too short)�131isinstance�132memoryview�AssertionErrorr^rr�rar�rr3r	)r�rCr�r��closes     r,re�Close.parse�s����d�J�'�'� �!Q�R�R��t�9��>��m�m�D�$�r��(�3�G�T��!�"�X�_�_�&�F���%�E��K�K�M��L�
��Y�!�^��y�/�/��4�4�� 7�8�8r+c��UR5 [R"SUR5URR5-$)z*133Serialize the payload of a close frame.134 135r})r�rr�r�r�r�r�s r,r��Close.serialize�s4��136	
�137�138���{�{�4����+�d�k�k�.@�.@�.B�B�Br+c�v�UR[;d%SURs=::aS:d
O [S5egg)z{139Check that the close code has a valid value for a close frame.140 141Raises:142    ProtocolError: If the close code is invalid.143 144r�r�zinvalid status codeN)r��EXTERNAL_CLOSE_CODESr	r�s r,r��Close.check�s6���	�	�1�1�T�T�Y�Y�5M��5M�� 5�6�6�6N�1r+rNr�)rCr145r�r)r�r`r�)rr r!r"r#r�rpr�rer�r�r*rr+r,rr`s8������K��$�9��9�2C�	7r+rr�)?�146__future__r�dataclasses�enumr�r�r�r�collections.abcrr�typingr�147exceptionsrr	r148�speedupsr�ImportError�utils�__all__�IntEnumrr$r
r%rr&rr'rr(rr)rrrrr/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r?r�r��OK_CLOSE_CODES�	dataclassrrrLrsrr+r,�<module>r�sg��"���	�	��
�/��4��"�$�149
�� )�T�\�\�)��+�+��150�+�+���M�M�	��<�<��151�+�+��152�+�+�����*����'�)�������.���d�
���,�
���.�
��� 2�
���=�
��� =�
���8�
��� 2�
���0�
�!�!�#8�
���.�
���0�
���0�
���=�
���?�+����,���
���
���
���
���
���
���
�!�!�
���
���
���
���
��"���
���
�����
���b@�b@��b@�J
���J7�J7��J7�\��{�"�!�!�"�s�I � I0�/I0
codekingpro/portable-devtools · Team Ai