AlkantarClanX12

Your IP : 3.144.122.20


Current Path : /opt/alt/python310/lib64/python3.10/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/asyncio/__pycache__/streams.cpython-310.opt-2.pyc

o

6��f�d�@s&dZddlZddlZddlZddlZddlZeed�red7ZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddl
mZddlmZd
Zded�dd�Zded�dd�Zeed�rpd ed�dd�Zd ed�dd�ZGdd�dej�ZGdd�deej�ZGdd�d�ZGdd�d�ZdS)!)�StreamReader�StreamWriter�StreamReaderProtocol�open_connection�start_server�NZAF_UNIX)�open_unix_connection�start_unix_server�)�
coroutines)�events)�
exceptions)�format_helpers)�	protocols)�logger)�sleepi)�limitc	�sb�	t��}t||d�}t||d��|j�fdd�||fi|��IdH\}}t|�||�}||fS)N�r�loop�rc��S�N�r��protocolr�6/opt/alt/python310/lib64/python3.10/asyncio/streams.py�<lambda>1�z!open_connection.<locals>.<lambda>)r�get_running_looprrZcreate_connectionr)	�host�portr�kwdsr�reader�	transport�_�writerrrrrs���rc�s8�	t������fdd�}�j|||fi|��IdHS)Nc�t��d�}t|��d�}|S�Nrr�rr�r!r��client_connected_cbrrrr�factoryO�
�zstart_server.<locals>.factory)rrZ
create_server)r*rrrr r+rr)rr6s
�rc�s`�	t��}t||d�}t||d��|j�fdd�|fi|��IdH\}}t|�||�}||fS)Nrrcrrrrrrrrcrz&open_unix_connection.<locals>.<lambda>)rrrrZcreate_unix_connectionr)�pathrr rr!r"r#r$rrrr[s���rc�s6�	t������fdd�}�j||fi|��IdHS)Ncr%r&r'r(r)rrr+lr,z"start_unix_server.<locals>.factory)rrZcreate_unix_server)r*r-rr r+rr)rrgs
�rc@s@eZdZ	ddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�FlowControlMixinNcCs8|durtjdd�|_n||_d|_t��|_d|_dS)N�)�
stacklevelF)r�_get_event_loop�_loop�_paused�collections�deque�_drain_waiters�_connection_lost)�selfrrrr�__init__s

zFlowControlMixin.__init__cCs$d|_|j��rt�d|�dSdS)NTz%r pauses writing)r3r2�	get_debugr�debug�r8rrr�
pause_writing�s
�zFlowControlMixin.pause_writingcCs>d|_|j��rt�d|�|jD]}|��s|�d�qdS)NFz%r resumes writing)r3r2r:rr;r6�done�
set_result�r8�waiterrrr�resume_writing�s


��zFlowControlMixin.resume_writingcCsFd|_|jsdS|jD]}|��s |dur|�d�q|�|�qdS�NT)r7r3r6r>r?�
set_exception�r8�excrArrr�connection_lost�s

��z FlowControlMixin.connection_lostc	�s\�|jrtd��|js
dS|j��}|j�|�z|IdHW|j�|�dS|j�|�w)NzConnection lost)r7�ConnectionResetErrorr3r2�
create_futurer6�append�remover@rrr�
_drain_helper�s�
zFlowControlMixin._drain_helpercCst�r)�NotImplementedError�r8�streamrrr�_get_close_waiter��z"FlowControlMixin._get_close_waiterr)	�__name__�
__module__�__qualname__r9r=rBrGrLrPrrrrr.us
		

r.csdeZdZ	dZd�fdd�	Zedd��Zdd�Z�fdd	�Zd
d�Z	dd
�Z
dd�Zdd�Z�Z
S)rNcstt�j|d�|durt�|�|_|j|_nd|_|dur ||_d|_d|_d|_	d|_
||_d|_|j
��|_dS)NrF)�superr9�weakref�ref�_stream_reader_wr�_source_traceback�_strong_reader�_reject_connection�_stream_writer�_task�
_transport�_client_connected_cb�	_over_sslr2rI�_closed)r8Z
stream_readerr*r��	__class__rrr9�s
zStreamReaderProtocol.__init__cCs|jdurdS|��Sr)rXr<rrr�_stream_reader�s
z#StreamReaderProtocol._stream_readercCs�|jrddi}|jr|j|d<|j�|�|��dS||_|j}|dur*|�|�|�d�du|_	|j
durXt||||j�|_|�
||j�}t
�|�rS|j�|�|_d|_dSdS)N�messagezpAn open stream was garbage collected prior to establishing network connection; call "stream.close()" explicitly.Zsource_tracebackZ
sslcontext)r[rYr2Zcall_exception_handler�abortr^rd�
set_transport�get_extra_infor`r_rr\r
ZiscoroutineZcreate_taskr]rZ)r8r"�contextr!�resrrr�connection_made�s2�


��

�z$StreamReaderProtocol.connection_madecs~|j}|dur|dur|��n|�|�|j��s+|dur%|j�d�n|j�|�t��|�d|_d|_	d|_
d|_dSr)rd�feed_eofrDrar>r?rUrGrXr\r]r^)r8rFr!rbrrrG�s



z$StreamReaderProtocol.connection_lostcCs |j}|dur|�|�dSdSr)rd�	feed_data)r8�datar!rrr�
data_receiveds�z"StreamReaderProtocol.data_receivedcCs$|j}|dur|��|jrdSdS)NFT)rdrlr`)r8r!rrr�eof_receivedsz!StreamReaderProtocol.eof_receivedcC�|jSr)rarNrrrrP�z&StreamReaderProtocol._get_close_waitercCsDz|j}Wn
tyYdSw|��r|��s |��dSdSdSr)ra�AttributeErrorr>�	cancelled�	exception)r8�closedrrr�__del__s
��zStreamReaderProtocol.__del__�NN)rRrSrTrYr9�propertyrdrkrGrorprPrw�
__classcell__rrrbrr�s
rc@steZdZ	dd�Zdd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
ddd�Zdd�ZdS)rcCs4||_||_||_||_|j��|_|j�d�dSr)r^�	_protocol�_readerr2rIZ
_complete_futr?)r8r"rr!rrrrr90szStreamWriter.__init__cCs@|jjd|j��g}|jdur|�d|j���d�d�|��S)N�
transport=zreader=�<{}>� )rcrRr^r|rJ�format�join�r8�inforrr�__repr__:s
zStreamWriter.__repr__cCrqr�r^r<rrrr"@szStreamWriter.transportcC�|j�|�dSr)r^�write�r8rnrrrr�D�zStreamWriter.writecCr�r)r^�
writelinesr�rrrr�Gr�zStreamWriter.writelinescC�
|j��Sr)r^�	write_eofr<rrrr�J�
zStreamWriter.write_eofcCr�r)r^�
can_write_eofr<rrrr�Mr�zStreamWriter.can_write_eofcCr�r)r^�closer<rrrr�Pr�zStreamWriter.closecCr�r)r^�
is_closingr<rrrr�Sr�zStreamWriter.is_closingc�s�|j�|�IdHdSr)r{rPr<rrr�wait_closedVs�zStreamWriter.wait_closedNcCs|j�||�Sr)r^rh)r8�name�defaultrrrrhYszStreamWriter.get_extra_infoc�sP�	|jdur|j��}|dur|�|j��rtd�IdH|j��IdHdS)Nr)r|rur^r�rr{rL)r8rFrrr�drain\s�



zStreamWriter.drainr)rRrSrTr9r�ryr"r�r�r�r�r�r�r�rhr�rrrrr&s	


rc@s�eZdZdZedfdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd&dd�Zd'dd�Zd d!�Zd"d#�Zd$d%�ZdS)(rNcCsz|dkrtd��||_|durt��|_n||_t�|_d|_d|_d|_	d|_
d|_|j��r;t
�t�d��|_dSdS)NrzLimit cannot be <= 0Fr	)�
ValueError�_limitrr1r2�	bytearray�_buffer�_eof�_waiter�
_exceptionr^r3r:r
�
extract_stack�sys�	_getframerY)r8rrrrrr9zs"

��zStreamReader.__init__cCs�dg}|jr|�t|j��d��|jr|�d�|jtkr'|�d|j���|jr3|�d|j���|jr?|�d|j���|jrK|�d|j���|j	rS|�d�d	�
d
�|��S)Nrz bytes�eofzlimit=zwaiter=z
exception=r}Zpausedr~r)r�rJ�lenr�r��_DEFAULT_LIMITr�r�r^r3r�r�r�rrrr��s 


zStreamReader.__repr__cCrqr)r�r<rrrru�rrzStreamReader.exceptioncCs8||_|j}|durd|_|��s|�|�dSdSdSr)r�r�rtrDrErrrrD�s�zStreamReader.set_exceptioncCs4	|j}|durd|_|��s|�d�dSdSdSr)r�rtr?r@rrr�_wakeup_waiter�s�zStreamReader._wakeup_waitercCs
||_dSrr�)r8r"rrrrg�s
zStreamReader.set_transportcCs2|jrt|j�|jkrd|_|j��dSdSdS)NF)r3r�r�r�r^�resume_readingr<rrr�_maybe_resume_transport�s�z$StreamReader._maybe_resume_transportcCsd|_|��dSrC)r�r�r<rrrrl�szStreamReader.feed_eofcCs	|jo|jSr)r�r�r<rrr�at_eof�szStreamReader.at_eofcCs�|sdS|j�|�|��|jdur:|js<t|j�d|jkr>z|j��Wn
ty4d|_YdSwd|_dSdSdSdS)N�T)	r��extendr�r^r3r�r�Z
pause_readingrMr�rrrrm�s 
��
�zStreamReader.feed_datac�s`�	|jdurt|�d���|jrd|_|j��|j��|_z|jIdHWd|_dSd|_w)NzF() called while another coroutine is already waiting for incoming dataF)r��RuntimeErrorr3r^r�r2rI)r8Z	func_namerrr�_wait_for_data�s�
�
zStreamReader._wait_for_datac
�s��	d}t|�}z|�|�IdH}W|Stjy)}z	|jWYd}~Sd}~wtjyW}z"|j�||j�rC|jd|j|�=n|j�	�|�
�t|jd��d}~ww)N�
r)
r��	readuntilr�IncompleteReadError�partial�LimitOverrunErrorr��
startswith�consumed�clearr�r��args)r8�sep�seplen�line�errr�readline�s$�
��
��zStreamReader.readliner�c�s�	t|�}|dkrtd��|jdur|j�d}	t|j�}|||krA|j�||�}|dkr0n-|d|}||jkrAt�d|��|jrTt	|j�}|j�
�t�|d��|�d�IdHq||jkrht�d|��|jd||�}|jd||�=|�
�t	|�S)	Nrz,Separator should be at least one-byte stringT���r	z2Separator is not found, and chunk exceed the limitr�z2Separator is found, but chunk is longer than limit)r�r�r�r��findr�rr�r��bytesr�r�r�r�)r8Z	separatorr��offsetZbuflenZisep�chunkrrrr�sD�


�

�
 �zStreamReader.readuntilr�c�s��	|jdur
|j�|dkrdS|dkr.g}	|�|j�IdH}|s#n|�|�qd�|�S|js<|js<|�d�IdHt|jd|��}|jd|�=|�	�|S)Nr�T�read)
r�r�r�rJr�r�r�r�r�r�)r8�nZblocks�blockrnrrrr�ss*�

�
zStreamReader.readc�s��	|dkr
td��|jdur|j�|dkrdSt|j�|krA|jr2t|j�}|j��t�||��|�	d�IdHt|j�|kst|j�|krSt|j�}|j��nt|jd|��}|jd|�=|�
�|S)Nrz*readexactly size can not be less than zeror��readexactly)r�r�r�r�r�r�r�rr�r�r�)r8r�Z
incompleternrrrr��s,�


�
zStreamReader.readexactlycCs|Srrr<rrr�	__aiter__�rQzStreamReader.__aiter__c�s �|��IdH}|dkrt�|S)Nr�)r��StopAsyncIteration)r8�valrrr�	__anext__�s
�zStreamReader.__anext__)r�)r�)rRrSrTrYr�r9r�rurDr�rgr�rlr�rmr�r�r�r�r�r�r�rrrrrvs&	

[3)rrxr)�__all__r4Zsocketr��warningsrV�hasattr�r
rrr
r�logrZtasksrr�rrrrZProtocolr.rrrrrrr�<module>sB
��
"��@qP