Your IP : 3.144.9.183


Current Path : /opt/alt/python312/lib64/python3.12/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/asyncio/__pycache__/streams.cpython-312.opt-2.pyc

�

�Q�f�k��l�dZddlZddlZddlZddlZddlZeed�redz
ZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddl
mZddlmZd
Zded�d�Zded�d�Zeed�rded�d�Zded�d�ZGd�dej,�ZGd�deej,�ZGd�d�ZGd�d�Zy))�StreamReader�StreamWriter�StreamReaderProtocol�open_connection�start_server�N�AF_UNIX)�open_unix_connection�start_unix_server�)�
coroutines)�events)�
exceptions)�format_helpers)�	protocols)�logger)�sleepi)�limitc����	K�	tj�}t||��}t||���	|j�	fd�||fi|���d{���\}}t|�	||�}||fS7��w)N�r�loop�rc����S�N���protocols��6/opt/alt/python312/lib64/python3.12/asyncio/streams.py�<lambda>z!open_connection.<locals>.<lambda>1s����)r
�get_running_looprr�create_connectionr)
�host�portr�kwdsr�reader�	transport�_�writerrs
         @rrrs}������"�"�"�$�D�
��D�
1�F�#�F��6�H�/��/�/��$��.�(,�.�.�L�I�q�
�)�X�v�t�
<�F��6�>��.�s�AA*�A(�A*c�����K�	tj�����fd�}�j|||fi|���d{���S7��w)Nc�>��t����}t|����}|S�Nrr�rr�r%r�client_connected_cbrrs  ���r�factoryzstart_server.<locals>.factoryNs&����E��5��'��0C�-1�3���r)r
r �
create_server)r.r"r#rr$r/rs`  `  @rrr6sE������(�"�"�$�D��$��#�#�G�T�4�@�4�@�@�@�@�s�5A�?�Ac����K�	tj�}t||��}t||���|j�fd�|fi|���d{���\}}t|�||�}||fS7��w)Nrrc����Srrrs�rrz&open_unix_connection.<locals>.<lambda>bs���Hr)r
r rr�create_unix_connectionr)	�pathrr$rr%r&r'r(rs	        @rr	r	Zsw�����N��&�&�(���E��5��'��T�:��8�T�8�8��d�,�&*�,�,��	�1��i��6�4�@���v�~��,�s�A
A)�
A'�A)c�����K�	tj�����fd�}�j||fi|���d{���S7��w)Nc�>��t����}t|����}|Sr+r,r-s  ���rr/z"start_unix_server.<locals>.factoryks&���!��D�9�F�+�F�4G�15�7�H��Or)r
r �create_unix_server)r.r4rr$r/rs` `  @rr
r
fs?�����K��&�&�(��	�-�T�,�,�W�d�C�d�C�C�C�C�s�4A�>�Ac�4�eZdZ	dd�Zd�Zd�Zd�Zd�Zd�Zy)	�FlowControlMixinNc��|�tj�|_n||_d|_t	j
�|_d|_y�NF)r
�get_event_loop�_loop�_paused�collections�deque�_drain_waiters�_connection_lost)�selfrs  r�__init__zFlowControlMixin.__init__~s>���<��.�.�0�D�J��D�J����)�/�/�1��� %��rc�t�d|_|jj�rtjd|�yy)NTz%r pauses writing)r>r=�	get_debugr�debug�rCs r�
pause_writingzFlowControlMixin.pause_writing�s-������:�:���!��L�L�,�d�3�"rc���d|_|jj�rtjd|�|j
D]$}|j
�r�|jd��&y)NFz%r resumes writing)r>r=rFrrGrA�done�
set_result�rC�waiters  r�resume_writingzFlowControlMixin.resume_writing�sO������:�:���!��L�L�-�t�4��)�)�F��;�;�=��!�!�$�'�*rc��d|_|jsy|jD]8}|j�r�|�|j	d��(|j|��:y�NT)rBr>rArKrL�
set_exception�rC�excrNs   r�connection_lostz FlowControlMixin.connection_lost�sN�� $����|�|���)�)�F��;�;�=��;��%�%�d�+��(�(��-�*rc��NK�|jrtd��|jsy|jj	�}|j
j
|�	|�d{���|j
j|�y7� #|j
j|�wxYw�w)NzConnection lost)rB�ConnectionResetErrorr>r=�
create_futurerA�append�removerMs  r�
_drain_helperzFlowControlMixin._drain_helper�s������ � �&�'8�9�9��|�|�����)�)�+�����"�"�6�*�	/��L�L����&�&�v�.�
�����&�&�v�.�s0�AB%�B�"B�#B�'B%�B�B"�"B%c��t�r)�NotImplementedError�rC�streams  r�_get_close_waiterz"FlowControlMixin._get_close_waiter�s��!�!rr)	�__name__�
__module__�__qualname__rDrIrOrUr[r`rrrr9r9ts%���&�4�(�.�
/�"rr9c�d��eZdZ	dZd�fd�	Zed��Zd�Zd�Z�fd�Z	d�Z
d�Zd	�Zd
�Z
�xZS)rNc�4��t�|�|��|�,tj|�|_|j
|_nd|_|�||_d|_d|_d|_	d|_
||_d|_|jj�|_y)NrF)�superrD�weakref�ref�_stream_reader_wr�_source_traceback�_strong_reader�_reject_connection�_stream_writer�_task�
_transport�_client_connected_cb�	_over_sslr=rX�_closed)rC�
stream_readerr.r�	__class__s    �rrDzStreamReaderProtocol.__init__�s����
���d��#��$�%,�[�[��%?�D�"�%2�%D�%D�D�"�%)�D�"��*�#0�D��"'���"�����
����$7��!�����z�z�/�/�1��rc�<�|j�y|j�Sr)rirHs r�_stream_readerz#StreamReaderProtocol._stream_reader�s ���!�!�)���%�%�'�'rc��|j}|j}||_||_|j	d�du|_y)N�
sslcontext)r=r&rmro�get_extra_inforq)rCr(rr&s    r�_replace_writerz$StreamReaderProtocol._replace_writer�s<���z�z���$�$�	�$���#���"�1�1�,�?�t�K��rc�x����jrKddi}�jr�j|d<�jj|��j	�y��_�j}|�|j���jd�du�_	�j��t��|�j��_�j|�j�}tj|�rA��fd�}�jj|��_�j j#|�d�_yy)N�messagezpAn open stream was garbage collected prior to establishing network connection; call "stream.close()" explicitly.�source_tracebackrxc����|j�r�j�y|j�}|�0�jj	d|�d���j�yy)Nz*Unhandled exception in client_connected_cb)r|�	exceptionr&)�	cancelled�closerr=�call_exception_handler)�taskrTrCr&s  ��r�callbackz6StreamReaderProtocol.connection_made.<locals>.callback�s\����~�~�'�!���)���.�.�*�C����
�
�9�9�'S�),�)2�;��
"���)�
'r)rlrjr=r��abortrorv�
set_transportryrqrprrmr�iscoroutine�create_taskrn�add_done_callbackrk)rCr&�contextr%�resr�s``    r�connection_madez$StreamReaderProtocol.connection_made�s#����"�"��@��G�
�%�%�.2�.D�.D��*�+��J�J�-�-�g�6��O�O���#����$�$����� � ��+�"�1�1�,�?�t�K����$�$�0�".�y�$�/5�/3�z�z�#;�D���+�+�F�,0�,?�,?�A�C��%�%�c�*�*�"�Z�Z�3�3�C�8��
��
�
�,�,�X�6�"&�D��/1rc�f��|j}|�$|�|j�n|j|�|jj	�s9|�|jjd�n|jj|�t�|�|�d|_d|_	d|_
d|_yr)rv�feed_eofrRrrrKrLrfrUrirmrnro)rCrTr%rts   �rrUz$StreamReaderProtocol.connection_lost
s�����$�$�����{����!��$�$�S�)��|�|� � �"��{����'�'��-����*�*�3�/�
����$�!%���"�����
���rc�D�|j}|�|j|�yyr)rv�	feed_data)rC�datar%s   r�
data_receivedz"StreamReaderProtocol.data_receiveds&���$�$�������T�"�rc�Z�|j}|�|j�|jryy)NFT)rvr�rq)rCr%s  r�eof_receivedz!StreamReaderProtocol.eof_received!s,���$�$�����O�O���>�>��rc��|jSr)rrr^s  rr`z&StreamReaderProtocol._get_close_waiter,s���|�|�rc��	|j}|j�r"|j�s|j�yyy#t$rYywxYwr)rrrKr�r�AttributeError)rC�closeds  r�__del__zStreamReaderProtocol.__del__/sM��	#��\�\�F��{�{�}�V�%5�%5�%7�� � �"�&8�}���	��	�s�A�	A
�A
�NN)rarbrcrjrD�propertyrvrzr�rUr�r�r`r��
__classcell__)rts@rrr�sN������2�(�(��(�
L�('�T�$#�
	��	#rrc�x�eZdZ	d�Zd�Zed��Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
dd�Zd
�Zdddd�d�Zd�Zy)rc��||_||_||_||_|jj	�|_|j
j
d�yr)ro�	_protocol�_readerr=rX�
_complete_futrL)rCr&rr%rs     rrDzStreamWriter.__init__EsI��#���!��������
�!�Z�Z�5�5�7������%�%�d�+rc���|jjd|j��g}|j�|j	d|j���djdj
|��S)N�
transport=zreader=�<{}>� )rtraror�rY�format�join�rC�infos  r�__repr__zStreamWriter.__repr__Os[�����'�'�:�d�o�o�5H�)I�J���<�<�#��K�K�'�$�,�,�!1�2�3��}�}�S�X�X�d�^�,�,rc��|jSr�rorHs rr&zStreamWriter.transportUs�����rc�:�|jj|�yr)ro�write�rCr�s  rr�zStreamWriter.writeYs�������d�#rc�:�|jj|�yr)ro�
writelinesr�s  rr�zStreamWriter.writelines\s�����"�"�4�(rc�6�|jj�Sr)ro�	write_eofrHs rr�zStreamWriter.write_eof_s�����(�(�*�*rc�6�|jj�Sr)ro�
can_write_eofrHs rr�zStreamWriter.can_write_eofbs�����,�,�.�.rc�6�|jj�Sr)ror�rHs rr�zStreamWriter.closees�����$�$�&�&rc�6�|jj�Sr)ro�
is_closingrHs rr�zStreamWriter.is_closinghs�����)�)�+�+rc��VK�|jj|��d{���y7��wr)r�r`rHs r�wait_closedzStreamWriter.wait_closedks�����n�n�.�.�t�4�4�4�s�)�'�)Nc�:�|jj||�Sr)rory)rC�name�defaults   rryzStreamWriter.get_extra_infons�����-�-�d�G�<�<rc��K�	|j�|jj�}|�|�|jj�rt	d��d{���|j
j
��d{���y7�'7��w)Nr)r�rror�rr�r[)rCrTs  r�drainzStreamWriter.drainqso����	��<�<�#��,�,�(�(�*�C����	��?�?�%�%�'���(�N�N��n�n�*�*�,�,�,�
��,�s$�AB�A>�!B�8B�9B�B)�server_hostname�ssl_handshake_timeout�ssl_shutdown_timeoutc	��&K�	|jjdu}|j}|j��d{���|jj	|j
||||||���d{���}||_|j
|�y7�Q7��w)N)�server_sider�r�r�)r�rpr�r=�	start_tlsrorz)rCrxr�r�r�r�r�
new_transports        rr�zStreamWriter.start_tls�s�����	B��n�n�9�9��E���>�>���j�j�l���"�j�j�2�2��O�O�X�z�#�_�"7�!5�	3�7�7�
�
(���� � ��&�	��7�s!�9B�B
�3B�/B�0B�Bc��|jj�sc|jj�rt	j
dt�y|j�t	j
d|��t�yy)Nzloop is closedz	unclosed )ror�r=�	is_closed�warnings�warn�ResourceWarningr�rHs rr�zStreamWriter.__del__�sT�����)�)�+��z�z�#�#�%��
�
�.��@��
�
���
�
�	�$��2�O�D�,rr)rarbrcrDr�r�r&r�r�r�r�r�r�r�ryr�r�r�rrrrr;sh���,�-�����$�)�+�/�'�,�5�=�-�4)-�.2�-1�'� Errc��eZdZdZedfd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zdd�Zdd�Zd�Zd�Zd�Zy)rNc�l�|dkrtd��||_|�tj�|_n||_t�|_d|_d|_d|_	d|_
d|_|jj�r.tjtj d��|_yy)NrzLimit cannot be <= 0Fr)�
ValueError�_limitr
r<r=�	bytearray�_buffer�_eof�_waiter�
_exceptionror>rFr�
extract_stack�sys�	_getframerj)rCrrs   rrDzStreamReader.__init__�s����A�:��3�4�4�����<��.�.�0�D�J��D�J� �{�����	��������������:�:���!�%3�%A�%A��
�
�a� �&"�D�"�"rc��dg}|jr'|jt|j��d��|jr|jd�|jt
k7r|jd|j���|jr|jd|j���|jr|jd|j���|jr|jd|j���|jr|jd�d	jd
j|��S)Nrz bytes�eofzlimit=zwaiter=z
exception=r��pausedr�r�)r�rY�lenr�r��_DEFAULT_LIMITr�r�ror>r�r�r�s  rr�zStreamReader.__repr__�s�������<�<��K�K�3�t�|�|�,�-�V�4�5��9�9��K�K����;�;�.�(��K�K�&����
�.�/��<�<��K�K�'�$�,�,�!1�2�3��?�?��K�K�*�T�_�_�$7�8�9��?�?��K�K�*�T�_�_�$7�8�9��<�<��K�K��!��}�}�S�X�X�d�^�,�,rc��|jSr)r�rHs rrzStreamReader.exception�s�����rc��||_|j}|�*d|_|j�s|j|�yyyr)r�r�r�rRrSs   rrRzStreamReader.set_exception�sC������������D�L��#�#�%��$�$�S�)�&�rc�v�	|j}|�*d|_|j�s|jd�yyyr)r�r�rLrMs  r�_wakeup_waiterzStreamReader._wakeup_waiter�s?��?��������D�L��#�#�%��!�!�$�'�&�rc��||_yrr�)rCr&s  rr�zStreamReader.set_transport�s	��#��rc��|jrEt|j�|jkr"d|_|jj�yyyr;)r>r�r�r�ro�resume_readingrHs r�_maybe_resume_transportz$StreamReader._maybe_resume_transport�s;���<�<�C����-����<� �D�L��O�O�*�*�,�=�<rc�2�d|_|j�yrQ)r�r�rHs rr�zStreamReader.feed_eof�s����	����rc�:�	|jxr
|jSr)r�r�rHs r�at_eofzStreamReader.at_eof�s��K��y�y�-����-�-rc�P�|sy|jj|�|j�|j�V|jsIt|j�d|jzkDr#	|jj�d|_yyyy#t$r
d|_YywxYw)N�T)	r��extendr�ror>r�r��
pause_readingr]r�s  rr�zStreamReader.feed_data�s����������D�!������O�O�'��L�L��D�L�L�!�A����O�3�
$����-�-�/� $���4�!�
(��
'�
'�#'���	
'�s�-B�B%�$B%c��.K�	|j�t|�d���|jr!d|_|jj	�|j
j
�|_	|j�d{���d|_y7�#d|_wxYw�w)NzF() called while another coroutine is already waiting for incoming dataF)r��RuntimeErrorr>ror�r=rX)rC�	func_names  r�_wait_for_datazStreamReader._wait_for_data	s�����	��<�<�#���+�4�5�6�
6��<�<� �D�L��O�O�*�*�,��z�z�/�/�1���	 ��,�,����D�L�
���D�L�s0�A(B�+B	�:B�;B	�?B�B	�		B�Bc���K�	d}t|�}	|j|��d{���}|S7�#tj$r}|jcYd}~Sd}~wtj
$r�}|jj||j�r|jd|j|z�=n|jj�|j�t|jd��d}~wwxYw�w)N�
r)
r��	readuntilr�IncompleteReadError�partial�LimitOverrunErrorr��
startswith�consumed�clearr�r��args)rC�sep�seplen�line�es     r�readlinezStreamReader.readline%s�����	����S���
	(�����,�,�D���-���-�-�	��9�9����+�+�	(��|�|�&�&�s�A�J�J�7��L�L�!5�!�*�*�v�"5�!5�6����"�"�$��(�(�*��Q�V�V�A�Y�'�'��
	(�sJ�C6�/�-�/�C6�/�C3�A�
C3�C6�C3�)BC.�.C3�3C6c���K�	t|�}|dk(rtd��|j�|j�d}	t|j�}||z
|k\rO|jj	||�}|dk7rn�|dz|z
}||j
kDrt
jd|��|jrEt|j�}|jj�t
j|d��|jd��d{�����||j
kDrt
jd|��|jd||z}|jd||z�=|j�t|�S7�i�w)Nrz,Separator should be at least one-byte string���rz2Separator is not found, and chunk exceed the limitr�z2Separator is found, but chunk is longer than limit)r�r�r�r��findr�rr�r��bytesr�r�r�r�)rC�	separatorr��offset�buflen�isep�chunks       rr�zStreamReader.readuntilDs����	�&�Y����Q�;��K�L�L��?�?�&��/�/�!�*�������&�F����&�(��|�|�(�(��F�;���2�:�� �!��f�,���D�K�K�'�$�6�6�L�� � ��y�y��d�l�l�+�����"�"�$� �4�4�U�D�A�A��%�%�k�2�2�2�=�@�$�+�+���.�.�D�d�L�
L����^�d�V�m�,���L�L��$��-��(��$�$�&��U�|��
3�s�D	E7�E5�A*E7c���K�	|j�|j�|dk(ry|dkrLg}	|j|j��d{���}|sn|j|��8dj	|�S|j
s%|js|jd��d{���tt|j
�d|�}|j
d|�=|j�|S7��7�H�w)Nrr�read)r�r	r�rYr�r�r�r�r�
memoryviewr�)rC�n�blocks�blockr�s     rr	zStreamReader.read�s�����	�*�?�?�&��/�/�!���6���q�5�
�F��"�i�i����4�4�����
�
�e�$�	�
�8�8�F�#�#��|�|�D�I�I��%�%�f�-�-�-��Z����-�b�q�1�2���L�L��!����$�$�&���5��
.�s&�AC*�C&�	AC*�C(� AC*�(C*c��K�	|dkrtd��|j�|j�|dk(ryt|j�|kr�|jrEt|j�}|jj
�tj||��|jd��d{���t|j�|kr��t|j�|k(r0t|j�}|jj
�n0tt|j�d|�}|jd|�=|j�|S7���w)Nrz*readexactly size can not be less than zeror�readexactly)r�r�r�r�r�rr�rr�r�r
r�)rCr�
incompleter�s    rrzStreamReader.readexactly�s����
	�
�q�5��I�J�J��?�?�&��/�/�!���6���$�,�,��!�#��y�y�"�4�<�<�0�
����"�"�$� �4�4�Z��C�C��%�%�m�4�4�4�
�$�,�,��!�#��t�|�|���!�����&�D��L�L��� ���D�L�L�1�"�1�5�6�D����R�a�R� ��$�$�&���
5�s�B-E�/E�0E�
BEc��|SrrrHs r�	__aiter__zStreamReader.__aiter__�s���rc��XK�|j��d{���}|dk(rt�|S7��w)Nr)r��StopAsyncIteration)rC�vals  r�	__anext__zStreamReader.__anext__�s+�����M�M�O�#���#�:�$�$��
�$�s�*�(�*)r�)r)rarbrcrjr�rDr�rrRr�r�r�r�r�r�r�r�r�r	rrrrrrrr�sf����+�$�"�,-�$�*�(�$�-�
�.�$�, �8�>Y�v1�f'�R�rrr�r)�__all__r?�socketr�r�rg�hasattr�rr
rrr�logr�tasksrr�rrr	r
�Protocolr9rrrrrr�<module>rs���'���
�
���
�6�9���<�<�G����������� .��8A�+�A�B�6�9��
�)7�
�D�&4�D�="�y�)�)�="�@D#�+�Y�-?�-?�D#�NeE�eE�N`�`r

?>