Hacked By AnonymousFox

Current Path : /lib64/python3.6/asyncio/__pycache__/
Upload File :
Current File : //lib64/python3.6/asyncio/__pycache__/streams.cpython-36.opt-2.pyc

3


 \�_�@sHdddddddgZddlZeed	�r2ejd
dg�dd
lmZddlmZddlmZddlmZddlm	Z	ddl
mZd!ZGdd�de
�ZGdd�de�Ze	d"ded�dd��Ze	d#ded�dd��Zeed	��re	d$ded�dd
��Ze	d%ded�dd��ZGdd�dej�ZGdd�deej�ZGdd�d�ZGd d�d�ZdS)&�StreamReader�StreamWriter�StreamReaderProtocol�open_connection�start_server�IncompleteReadError�LimitOverrunError�NZAF_UNIX�open_unix_connection�start_unix_server�)�
coroutines)�compat)�events)�	protocols)�	coroutine)�logger��cs$eZdZ�fdd�Zdd�Z�ZS)rcs(t�jdt|�|f�||_||_dS)Nz-%d bytes read on a total of %r expected bytes)�super�__init__�len�partial�expected)�selfrr)�	__class__��'/usr/lib64/python3.6/asyncio/streams.pyr szIncompleteReadError.__init__cCst|�|j|jffS)N)�typerr)rrrr�
__reduce__&szIncompleteReadError.__reduce__)�__name__�
__module__�__qualname__rr�
__classcell__rr)rrrscs$eZdZ�fdd�Zdd�Z�ZS)rcst�j|�||_dS)N)rr�consumed)r�messager#)rrrr0szLimitOverrunError.__init__cCst|�|jd|jffS)Nr)r�argsr#)rrrrr4szLimitOverrunError.__reduce__)rr r!rrr"rr)rrr*s)�loop�limitc	+sb|dkrtj�}t||d�}t||d��|j�fdd�||f|�EdH\}}t|�||�}||fS)N)r'r&)r&cs�S)Nrr)�protocolrr�<lambda>Qsz!open_connection.<locals>.<lambda>)r�get_event_looprrZcreate_connectionr)	�host�portr&r'�kwds�reader�	transport�_�writerr)r(rr8s c+s8�dkrtj�����fdd�}�j|||f|�EdHS)Ncst��d�}t|��d�}|S)N)r'r&)r&)rr)r.r()�client_connected_cbr'r&rr�factoryqszstart_server.<locals>.factory)rr*Z
create_server)r2r+r,r&r'r-r3r)r2r'r&rrVsc+s`|dkrtj�}t||d�}t||d��|j�fdd�|f|�EdH\}}t|�||�}||fS)N)r'r&)r&cs�S)Nrr)r(rrr)�sz&open_unix_connection.<locals>.<lambda>)rr*rrZcreate_unix_connectionr)�pathr&r'r-r.r/r0r1r)r(rr	}sc+s6�dkrtj�����fdd�}�j||f|�EdHS)Ncst��d�}t|��d�}|S)N)r'r&)r&)rr)r.r()r2r'r&rrr3�sz"start_unix_server.<locals>.factory)rr*Zcreate_unix_server)r2r4r&r'r-r3r)r2r'r&rr
�sc@s:eZdZddd�Zdd�Zdd�Zdd	�Zed
d��ZdS)
�FlowControlMixinNcCs0|dkrtj�|_n||_d|_d|_d|_dS)NF)rr*�_loop�_paused�
_drain_waiter�_connection_lost)rr&rrrr�szFlowControlMixin.__init__cCs d|_|jj�rtjd|�dS)NTz%r pauses writing)r7r6�	get_debugr�debug)rrrr�
pause_writing�s
zFlowControlMixin.pause_writingcCsFd|_|jj�rtjd|�|j}|dk	rBd|_|j�sB|jd�dS)NFz%r resumes writing)r7r6r:rr;r8�done�
set_result)r�waiterrrr�resume_writing�s
zFlowControlMixin.resume_writingcCsVd|_|jsdS|j}|dkr"dSd|_|j�r4dS|dkrH|jd�n
|j|�dS)NT)r9r7r8r=r>�
set_exception)r�excr?rrr�connection_lost�sz FlowControlMixin.connection_lostccs<|jrtd��|jsdS|j}|jj�}||_|EdHdS)NzConnection lost)r9�ConnectionResetErrorr7r8r6�
create_future)rr?rrr�
_drain_helper�s
zFlowControlMixin._drain_helper)N)	rr r!rr<r@rCrrFrrrrr5�s


	r5csBeZdZd�fdd�	Zdd�Z�fdd�Zdd	�Zd
d�Z�ZS)
rNcs*t�j|d�||_d|_||_d|_dS)N)r&F)rr�_stream_reader�_stream_writer�_client_connected_cb�	_over_ssl)rZ
stream_readerr2r&)rrrr�s
zStreamReaderProtocol.__init__cCsd|jj|�|jd�dk	|_|jdk	r`t|||j|j�|_|j|j|j�}tj	|�r`|jj
|�dS)NZ
sslcontext)rG�
set_transport�get_extra_inforJrIrr6rHrZiscoroutineZcreate_task)rr/�resrrr�connection_made�s


z$StreamReaderProtocol.connection_madecsF|jdk	r*|dkr|jj�n|jj|�t�j|�d|_d|_dS)N)rG�feed_eofrArrCrH)rrB)rrrrC�s
z$StreamReaderProtocol.connection_lostcCs|jj|�dS)N)rG�	feed_data)r�datarrr�
data_receivedsz"StreamReaderProtocol.data_receivedcCs|jj�|jrdSdS)NFT)rGrOrJ)rrrr�eof_receiveds
z!StreamReaderProtocol.eof_received)NN)	rr r!rrNrCrRrSr"rr)rrr�s
	
c@sfeZdZdd�Zdd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zddd�Ze
dd��ZdS)rcCs||_||_||_||_dS)N)�
_transport�	_protocol�_readerr6)rr/r(r.r&rrrrszStreamWriter.__init__cCs:|jjd|jg}|jdk	r,|jd|j�ddj|�S)Nztransport=%rz	reader=%rz<%s>� )rrrTrV�append�join)r�inforrr�__repr__!s
zStreamWriter.__repr__cCs|jS)N)rT)rrrrr/'szStreamWriter.transportcCs|jj|�dS)N)rT�write)rrQrrrr\+szStreamWriter.writecCs|jj|�dS)N)rT�
writelines)rrQrrrr].szStreamWriter.writelinescCs
|jj�S)N)rT�	write_eof)rrrrr^1szStreamWriter.write_eofcCs
|jj�S)N)rT�
can_write_eof)rrrrr_4szStreamWriter.can_write_eofcCs
|jj�S)N)rT�close)rrrrr`7szStreamWriter.closeNcCs|jj||�S)N)rTrL)r�name�defaultrrrrL:szStreamWriter.get_extra_infoccsN|jdk	r |jj�}|dk	r |�|jdk	r:|jj�r:dV|jj�EdHdS)N)rV�	exceptionrTZ
is_closingrUrF)rrBrrr�drain=s	



zStreamWriter.drain)N)rr r!rr[�propertyr/r\r]r^r_r`rLrrdrrrrrs

c@s�eZdZedfdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
edd��Zedd��Zed'dd��Zed)dd��Zed d!��Zejr�ed"d#��Zed$d%��Zejr�d&d#�ZdS)*rNcCsZ|dkrtd��||_|dkr*tj�|_n||_t�|_d|_d|_d|_	d|_
d|_dS)NrzLimit cannot be <= 0F)�
ValueError�_limitrr*r6�	bytearray�_buffer�_eof�_waiter�
_exceptionrTr7)rr'r&rrrrXszStreamReader.__init__cCs�dg}|jr |jdt|j��|jr0|jd�|jtkrJ|jd|j�|jr`|jd|j�|jrv|jd|j�|jr�|jd|j�|j	r�|jd�d	d
j
|�S)Nrz%d bytes�eofzl=%dzw=%rze=%rzt=%rZpausedz<%s>rW)rirXrrjrg�_DEFAULT_LIMITrkrlrTr7rY)rrZrrrr[ks 


zStreamReader.__repr__cCs|jS)N)rl)rrrrrc}szStreamReader.exceptioncCs0||_|j}|dk	r,d|_|j�s,|j|�dS)N)rlrk�	cancelledrA)rrBr?rrrrA�szStreamReader.set_exceptioncCs*|j}|dk	r&d|_|j�s&|jd�dS)N)rkror>)rr?rrr�_wakeup_waiter�s
zStreamReader._wakeup_waitercCs
||_dS)N)rT)rr/rrrrK�szStreamReader.set_transportcCs*|jr&t|j�|jkr&d|_|jj�dS)NF)r7rrirgrT�resume_reading)rrrr�_maybe_resume_transport�sz$StreamReader._maybe_resume_transportcCsd|_|j�dS)NT)rjrp)rrrrrO�szStreamReader.feed_eofcCs|jo|jS)N)rjri)rrrr�at_eof�szStreamReader.at_eofcCsv|sdS|jj|�|j�|jdk	rr|jrrt|j�d|jkrry|jj�Wntk
rjd|_YnXd|_dS)NrT)	ri�extendrprTr7rrgZ
pause_reading�NotImplementedError)rrQrrrrP�s
zStreamReader.feed_dataccsV|jdk	rtd|��|jr,d|_|jj�|jj�|_z|jEdHWdd|_XdS)NzH%s() called while another coroutine is already waiting for incoming dataF)rk�RuntimeErrorr7rTrqr6rE)rZ	func_namerrr�_wait_for_data�s


zStreamReader._wait_for_dataccs�d}t|�}y|j|�EdH}Wn�tk
rB}z|jSd}~Xnftk
r�}zJ|jj||j�rv|jd|j|�=n
|jj�|j	�t
|jd��WYdd}~XnX|S)N�
r)r�	readuntilrrrri�
startswithr#�clearrrrfr%)r�sep�seplen�line�errr�readline�s
 zStreamReader.readlinerxccs�t|�}|dkrtd��|jdk	r(|j�d}x�t|j�}|||kr||jj||�}|dkr\P|d|}||jkr|td|��|jr�t|j�}|jj	�t
|d��|jd�EdHq.W||jkr�td|��|jd||�}|jd||�=|j�t|�S)Nrz,Separator should be at least one-byte stringrz2Separator is not found, and chunk exceed the limitryz2Separator is found, but chunk is longer than limit���)
rrfrlri�findrgrrj�bytesr{rrwrr)rZ	separatorr}�offsetZbuflenZisep�chunkrrrry�s:






zStreamReader.readuntilrccs�|jdk	r|j�|dkrdS|dkrZg}x&|j|j�EdH}|sBP|j|�q*Wdj|�S|jrz|jrz|jd�EdHt|jd|��}|jd|�=|j	�|S)Nr��read)
rlr�rgrXrYrirjrwr�rr)r�nZblocks�blockrQrrrr�Ps$

zStreamReader.readccs�|dkrtd��|jdk	r |j�|dkr,dSxFt|j�|krr|jr`t|j�}|jj�t||��|jd�EdHq.Wt|j�|kr�t|j�}|jj�nt|jd|��}|jd|�=|j	�|S)Nrz*readexactly size can not be less than zeror��readexactly)
rfrlrrirjr�r{rrwrr)rr�Z
incompleterQrrrr��s&




zStreamReader.readexactlycCs|S)Nr)rrrr�	__aiter__�szStreamReader.__aiter__ccs|j�EdH}|dkrt�|S)Nr�)r��StopAsyncIteration)r�valrrr�	__anext__�szStreamReader.__anext__cCs|S)Nr)rrrrr��s)rxr�)r�)rr r!rnrr[rcrArprKrrrOrsrPrrwr�ryr�r�r
ZPY35r�r�ZPY352rrrrrVs,	 [2*i)NN)NN)N)N)�__all__Zsocket�hasattrrt�rr
rrr�logrrn�EOFErrorr�	Exceptionrrrr	r
ZProtocolr5rrrrrrr�<module>s@
"B3G

Hacked By AnonymousFox1.0, Coded By AnonymousFox