Your IP : 3.23.92.50


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/__pycache__/client_ws.cpython-311.pyc

�

��bg+����dZddlZddlZddlmZmZmZddlmZddl	m
Z
ddlmZm
Z
ddlmZmZmZmZmZmZdd	lmZdd
lmZmZddlmZmZmZmZejdkrddlZ nddl Z Gd
�d��Z!dS)zWebSocket client for asyncio.�N)�Any�Optional�cast�)�ClientError)�ClientResponse)�
call_later�
set_result)�WS_CLOSED_MESSAGE�WS_CLOSING_MESSAGE�WebSocketError�WSCloseCode�	WSMessage�	WSMsgType)�WebSocketWriter)�	EofStream�FlowControlDataQueue)�DEFAULT_JSON_DECODER�DEFAULT_JSON_ENCODER�JSONDecoder�JSONEncoder)��c���eZdZddddd�dddedeed	ed
ededed
e	j
deedeedededdfd�Zd7d�Z
d7d�Zd7d�Zd7d�Zedefd���Zedeefd���Zedeefd���Zedefd���Zedefd���Zd8dededefd�Zdeefd �Zd9d"eddfd#�Zd9d"eddfd$�Zd8d%edeeddfd&�Zd8d%edeeddfd'�Z	d8e d(�d%edeed)e!ddfd*�Z"e#j$d!d+�d,ed"edefd-�Z%d8d
eede&fd.�Z'dd/�d
eedefd0�Z(dd/�d
eedefd1�Z)e*dd2�d3e+d
eedefd4�Z,d:d5�Z-de&fd6�Z.dS);�ClientWebSocketResponseNrF)�receive_timeout�	heartbeat�compress�client_notakeover�readerzFlowControlDataQueue[WSMessage]�writer�protocol�response�timeout�	autoclose�autoping�looprrrr�returnc	�h�||_|j|_||_||_||_d|_d|_d|_||_	|	|_
||_||_|
|_
d|_|
�
|
dz|_d|_||_d|_d|_||_||_|���dS)NFg@)�	_response�
connection�_conn�_writer�_reader�	_protocol�_closed�_closing�_close_code�_timeout�_receive_timeout�
_autoclose�	_autoping�
_heartbeat�
_heartbeat_cb�_pong_heartbeat�_pong_response_cb�_loop�_waiting�
_exception�	_compress�_client_notakeover�_reset_heartbeat)
�selfr r!r"r#r$r%r&r'rrrrs
             �H/opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/client_ws.py�__init__z ClientWebSocketResponse.__init__"s��� "����(��
�������!��������
�*.�����
� /���#���!���#���<@���� �#,�s�?�D� �@D�����
�8<��
�37���!���"3�����������c��|j� |j���d|_|j�"|j���d|_dSdS�N)r:�cancelr8�rAs rB�_cancel_heartbeatz)ClientWebSocketResponse._cancel_heartbeatLs\���!�-��"�)�)�+�+�+�%)�D�"���)���%�%�'�'�'�!%�D����*�)rDc��|���|j�At|j|j|j|j�|jjjnd���|_dSdS�N�)�timeout_ceil_threshold)	rIr7r	�_send_heartbeatr;r,�
_connector�_timeout_ceil_thresholdr8rHs rBr@z(ClientWebSocketResponse._reset_heartbeatUsl����� � � ��?�&�!+��$����
��:�)�(,�z�'<�'T�'T��
"�"�"�D����'�&rDc�J�|j��|js�|j�|j�����|j�|j���t|j	|j
|j|j�|jjj
nd���|_dSdSdSrK)r7r0r;�create_taskr-�pingr:rGr	�_pong_not_receivedr9r,rOrPrHs rBrNz'ClientWebSocketResponse._send_heartbeatbs����?�&�t�|�&�
�J�"�"�4�<�#4�#4�#6�#6�7�7�7��%�1��&�-�-�/�/�/�%/��'��$��
��:�)�(,�z�'<�'T�'T��
&�&�&�D�"�"�"�'�&�&�&rDc��|jsKd|_tj|_t	j��|_|j���dSdS)NT)	r0r�ABNORMAL_CLOSUREr2�asyncio�TimeoutErrorr=r*�closerHs rBrTz*ClientWebSocketResponse._pong_not_receivedtsR���|�	#��D�L�*�;�D��%�2�4�4�D�O��N� � �"�"�"�"�"�		#�	#rDc��|jSrF)r0rHs rB�closedzClientWebSocketResponse.closed{s
���|�rDc��|jSrF)r2rHs rB�
close_codez"ClientWebSocketResponse.close_codes����rDc��|jSrF)r/rHs rBr"z ClientWebSocketResponse.protocol��
���~�rDc��|jSrF)r>rHs rBrz ClientWebSocketResponse.compress�r_rDc��|jSrF)r?rHs rBrz)ClientWebSocketResponse.client_notakeover�s���&�&rD�name�defaultc�d�|jj}|�|S|j}|�|S|�||��S)z$extra info from connection transport)r*r+�	transport�get_extra_info)rArbrc�connres     rBrfz&ClientWebSocketResponse.get_extra_info�s>���~�(���<��N��N�	����N��'�'��g�6�6�6rDc��|jSrF)r=rHs rB�	exceptionz!ClientWebSocketResponse.exception�s
����rDrD�messagec��JK�|j�|���d{V��dSrF)r-rS�rArjs  rBrSzClientWebSocketResponse.ping��4�����l����(�(�(�(�(�(�(�(�(�(�(rDc��JK�|j�|���d{V��dSrF)r-�pongrls  rBrozClientWebSocketResponse.pong�rmrD�datac��K�t|t��stdt|��z���|j�|d|����d{V��dS)Nzdata argument must be str (%r)F��binaryr)�
isinstance�str�	TypeError�typer-�send�rArprs   rB�send_strz ClientWebSocketResponse.send_str�sh�����$��$�$�	K��<�t�D�z�z�I�J�J�J��l����U�X��F�F�F�F�F�F�F�F�F�F�FrDc���K�t|tttf��st	dt|��z���|j�|d|����d{V��dS)Nz#data argument must be byte-ish (%r)Trr)rt�bytes�	bytearray�
memoryviewrvrwr-rxrys   rB�
send_bytesz"ClientWebSocketResponse.send_bytes�so�����$��	�:� >�?�?�	P��A�D��J�J�N�O�O�O��l����T�H��E�E�E�E�E�E�E�E�E�E�ErD)�dumpsr�c��VK�|�||��|����d{V��dS)N)r)rz)rArprr�s    rB�	send_jsonz!ClientWebSocketResponse.send_json�s>�����m�m�E�E�$�K�K�(�m�;�;�;�;�;�;�;�;�;�;�;rD)�coderjr�c��K�|j�;|js4d|_|j�td��|j�d{V��|j�s|���d|_	|j�||���d{V��n�#tj
$r,tj|_
|j����t$r<}tj|_
||_|j���Yd}~dSd}~wwxYw|j
r|j���dS		t#j|j��4�d{V��|j����d{V��}ddd���d{V��n#1�d{V��swxYwYn�#tj
$r,tj|_
|j����t$r<}tj|_
||_|j���Yd}~dSd}~wwxYw|jt,jkr'|j|_
|j���dS��$dS)NTrF)r<r1r.�	feed_datarr0rIr-rYrW�CancelledErrorrrVr2r*�	Exceptionr=�
async_timeoutr$r3�readrwr�CLOSErp)rAr�rj�exc�msgs     rBrYzClientWebSocketResponse.close�s�����=�$�T�]�$� �D�M��L�"�"�#5�q�9�9�9��-���������|�&	��"�"�$�$�$��D�L�

��l�(�(��w�7�7�7�7�7�7�7�7�7�7���)�
�
�
�#.�#?�� ���$�$�&�&�&���
�
�
�#.�#?�� �"%�����$�$�&�&�&��t�t�t�t�t�����	
������
���$�$�&�&�&��t�
 � �,�4�T�]�C�C�8�8�8�8�8�8�8�8�$(�L�$5�$5�$7�$7�7�7�7�7�7�7��8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8����8�8�8�8����-����'2�'C�D�$��N�(�(�*�*�*�� � � � �'2�'C�D�$�&)�D�O��N�(�(�*�*�*��4�4�4�4�4�����	 �����8�y��.�.�'*�x�D�$��N�(�(�*�*�*��4�#
 �&�5sV�)!B�AD
�1D�D
�1F� F�0F�
F�F�F�F�AH�1H�Hc���K�	|j�td���|jrtS|jr!|����d{V��tS	|j���|_	tj	|p|j
��4�d{V��|j����d{V��}ddd���d{V��n#1�d{V��swxYwY|�
��|j}d|_t|d��n##|j}d|_t|d��wxYw�nl#tjtjf$rt$j|_�t*$rIt$j|_|����d{V��t/t0jdd��cYSt4$r"d|_t$j|_tcYSt6$rR}|j|_|�|j����d{V��t/t0j|d��cYd}~Sd}~wt<$r^}||_d|_t$j|_|����d{V��t/t0j|d��cYd}~Sd}~wwxYw|j t0j!kr<d|_|j"|_|js!|j#r|����d{V��ny|j t0j$krd|_n\|j t0j%kr)|j&r"|�'|j"���d{V����A|j t0j(kr	|j&r��_|S)NTz+Concurrent call to receive() is not allowed)r�))r<�RuntimeErrorr0rr1rYr;�
create_futurer�r$r4r.r�r@r
rWr�rXrrVr2r�OKrr�CLOSEDrr
r��ERRORr�r=rwr�rpr5�CLOSING�PINGr6ro�PONG)rAr$r��waiterr�s     rB�receivezClientWebSocketResponse.receive�s/����7	��}�(�"�#P�Q�Q�Q��|�
)�(�(���
)��j�j�l�l�"�"�"�"�"�"�"�(�(�
=� $�
� 8� 8� :� :��
�-�,�4�W�5U��@U�V�V�8�8�8�8�8�8�8�8�$(�L�$5�$5�$7�$7�7�7�7�7�7�7��8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8�8����8�8�8�8��)�)�+�+�+�!�]�F�$(�D�M��v�t�,�,�,�,��"�]�F�$(�D�M��v�t�,�,�,�,����,���*�G�,@�A�
�
�
�#.�#?�� ���
?�
?�
?�#.�>�� ��j�j�l�l�"�"�"�"�"�"�"� ��!1�4��>�>�>�>�>��
)�
)�
)�#���#.�#?�� �(�(�(�(�!�
=�
=�
=�#&�8�� ��j�j�c�h�j�/�/�/�/�/�/�/�/�/� ���#�t�<�<�<�<�<�<�<�<������
=�
=�
=�"%��� $��
�#.�#?�� ��j�j�l�l�"�"�"�"�"�"�"� ���#�t�<�<�<�<�<�<�<�<�����
=�����x�9�?�*�*� $��
�#&�8�� ��|�'���'��*�*�,�,�&�&�&�&�&�&�&����Y�.�.�.� $��
�
���Y�^�+�+���+��i�i���)�)�)�)�)�)�)�)�)����Y�^�+�+���+���Js{�D,�0!D� C�1D�
C
�
D�C
�D�(D,� D'�'D,�,A<J�*(J�	J�AH*�$J�*
J�7AJ�
J�J�r$c���K�|�|���d{V��}|jtjkr t	d|j�d|j�d����t
t|j��S)N�Received message �:z is not str)r�rwr�TEXTrvrprru�rAr$r�s   rB�receive_strz#ClientWebSocketResponse.receive_strsp�����L�L��)�)�)�)�)�)�)�)���8�y�~�%�%��R���R�R�3�8�R�R�R�S�S�S��C���"�"�"rDc���K�|�|���d{V��}|jtjkr t	d|j�d|j�d����t
t|j��S)Nr�r�z
 is not bytes)r�rwr�BINARYrvrprr|r�s   rB�
receive_bytesz%ClientWebSocketResponse.receive_bytes%sq�����L�L��)�)�)�)�)�)�)�)���8�y�'�'�'��T���T�T�3�8�T�T�T�U�U�U��E�3�8�$�$�$rD)�loadsr$r�c��TK�|�|����d{V��}||��S)Nr�)r�)rAr�r$rps    rB�receive_jsonz$ClientWebSocketResponse.receive_json+s>�����%�%�g�%�6�6�6�6�6�6�6�6���u�T�{�{�rDc��|SrF�rHs rB�	__aiter__z!ClientWebSocketResponse.__aiter__4s���rDc��K�|����d{V��}|jtjtjtjfvrt�|SrF)r�rwrr�r�r��StopAsyncIteration)rAr�s  rB�	__anext__z!ClientWebSocketResponse.__anext__7sL�����L�L�N�N�"�"�"�"�"�"���8�	���):�I�<L�M�M�M�$�$��
rD)r(NrF)rD)r(r)/�__name__�
__module__�__qualname__rrrur�float�boolrW�AbstractEventLoop�intrCrIr@rNrT�propertyr[r]r"rrrrf�
BaseExceptionrir|rSrorzrrrr�rr�rYrr�r�r�rrr�r�r�r�rDrBrr!s�������,0�%)��"'�( �( �( �1�( � �( ��3�-�	( �
!�( ��
( ��( ��( ��'�( �"�%��( ��E�?�( ��( � �( �
�( �( �( �( �T&�&�&�&���������$#�#�#�#��������X��� �H�S�M� � � ��X� ���(�3�-�����X����#�����X���'�4�'�'�'��X�'�7�7�3�7��7��7�7�7�7��8�M�2�����)�)�%�)�$�)�)�)�)�)�)�%�)�$�)�)�)�)�G�G�3�G�(�3�-�G�4�G�G�G�G�
F�F�U�F�h�s�m�F�t�F�F�F�F�#'�<�
2�<�<�<��<��3�-�<�
�<�
�
<�<�<�<�*5��#�.�.�.�3�.�%�.�RV�.�.�.�.�`8�8�X�e�_�8�	�8�8�8�8�t?C�#�#�#�H�U�O�#�s�#�#�#�#�AE�%�%�%�h�u�o�%��%�%�%�%�2�#'�	������%��	�


����������������rDr)"�__doc__rW�sys�typingrrr�client_exceptionsr�
client_reqrepr�helpersr	r
�httprrr
rrr�http_websocketr�streamsrr�typedefsrrrr�version_infor�rr�rDrB�<module>r�s���#�#�����
�
�
�
�&�&�&�&�&�&�&�&�&�&�*�*�*�*�*�*�)�)�)�)�)�)�+�+�+�+�+�+�+�+�����������������,�+�+�+�+�+�4�4�4�4�4�4�4�4���������������w���#�#�#�#�#�����Z�Z�Z�Z�Z�Z�Z�Z�Z�ZrD

?>