ok

Mini Shell

Direktori : /proc/self/root/lib64/python3.6/asyncio/__pycache__/
Upload File :
Current File : //proc/self/root/lib64/python3.6/asyncio/__pycache__/windows_events.cpython-36.opt-2.pyc

3


 \�l�@s�ddlZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZddlmZdd	lm
Z
dd
lmZddlmZddlmZd
dddgZdZdZdZdZdZdZGdd�de	j�ZGdd�de	j�ZGdd�de�ZGdd�de�ZGdd�de�Z Gd d!�d!ej!�Z"Gd"d�de
j#�Z$Gd#d�d�Z%Gd$d%�d%ej&�Z'e"Z(Gd&d'�d'ej)�Z*e*Z+dS)(�N�)�events)�base_subprocess)�futures)�proactor_events)�selector_events)�tasks)�
windows_utils)�_overlapped)�	coroutine)�logger�SelectorEventLoop�ProactorEventLoop�IocpProactor�DefaultEventLoopPolicyl��i�i�g����MbP?g�������?csZeZdZdd��fdd�
Z�fdd�Zdd�Z�fd	d
�Z�fdd�Z�fd
d�Z�Z	S)�_OverlappedFutureN)�loopcs&t�j|d�|jr|jd=||_dS)N)rr���)�super�__init__�_source_traceback�_ov)�self�ovr)�	__class__��./usr/lib64/python3.6/asyncio/windows_events.pyr-sz_OverlappedFuture.__init__cs@t�j�}|jdk	r<|jjr dnd}|jdd||jjf�|S)N�pendingZ	completedrzoverlapped=<%s, %#x>)r�
_repr_inforr�insert�address)r�info�state)rrrr3s


z_OverlappedFuture._repr_infocCsr|jdkrdSy|jj�WnJtk
rf}z.d||d�}|jrJ|j|d<|jj|�WYdd}~XnXd|_dS)Nz&Cancelling an overlapped future failed)�message�	exception�future�source_traceback)r�cancel�OSErrorr�_loop�call_exception_handler)r�exc�contextrrr�_cancel_overlapped:s

z$_OverlappedFuture._cancel_overlappedcs|j�t�j�S)N)r-rr')r)rrrr'Jsz_OverlappedFuture.cancelcst�j|�|j�dS)N)r�
set_exceptionr-)rr$)rrrr.Nsz_OverlappedFuture.set_exceptioncst�j|�d|_dS)N)r�
set_resultr)r�result)rrrr/Rsz_OverlappedFuture.set_result)
�__name__�
__module__�__qualname__rrr-r'r.r/�
__classcell__rr)rrr'srcsjeZdZdd��fdd�
Zdd�Z�fdd�Zd	d
�Zdd�Z�fd
d�Z�fdd�Z	�fdd�Z
�ZS)�_BaseWaitHandleFutureN)rcs8t�j|d�|jr|jd=||_||_||_d|_dS)N)rrTr)rrrr�_handle�_wait_handle�_registered)rr�handle�wait_handler)rrrrZsz_BaseWaitHandleFuture.__init__cCstj|jd�tjkS)Nr)�_winapiZWaitForSingleObjectr6Z
WAIT_OBJECT_0)rrrr�_pollhsz_BaseWaitHandleFuture._pollcs\t�j�}|jd|j�|jdk	r>|j�r0dnd}|j|�|jdk	rX|jd|j�|S)Nz
handle=%#xZsignaledZwaitingzwait_handle=%#x)rr�appendr6r<r7)rr!r")rrrrms



z _BaseWaitHandleFuture._repr_infocCs
d|_dS)N)r)r�futrrr�_unregister_wait_cbwsz)_BaseWaitHandleFuture._unregister_wait_cbcCs�|js
dSd|_|j}d|_ytj|�WnZtk
r�}z>|jtjkrtd||d�}|jrd|j|d<|jj	|�dSWYdd}~XnX|j
d�dS)NFz$Failed to unregister the wait handle)r#r$r%r&)r8r7r
ZUnregisterWaitr(�winerror�ERROR_IO_PENDINGrr)r*r?)rr:r+r,rrr�_unregister_wait|s"
z&_BaseWaitHandleFuture._unregister_waitcs|j�t�j�S)N)rBrr')r)rrrr'�sz_BaseWaitHandleFuture.cancelcs|j�t�j|�dS)N)rBrr.)rr$)rrrr.�sz#_BaseWaitHandleFuture.set_exceptioncs|j�t�j|�dS)N)rBrr/)rr0)rrrr/�sz _BaseWaitHandleFuture.set_result)r1r2r3rr<rr?rBr'r.r/r4rr)rrr5Ws
r5csBeZdZdd��fdd�
Zdd�Z�fdd�Z�fd	d
�Z�ZS)�_WaitCancelFutureN)rcst�j||||d�d|_dS)N)r)rr�_done_callback)rr�eventr:r)rrrr�sz_WaitCancelFuture.__init__cCstd��dS)Nz'_WaitCancelFuture must not be cancelled)�RuntimeError)rrrrr'�sz_WaitCancelFuture.cancelcs$t�j|�|jdk	r |j|�dS)N)rr/rD)rr0)rrrr/�s
z_WaitCancelFuture.set_resultcs$t�j|�|jdk	r |j|�dS)N)rr.rD)rr$)rrrr.�s
z_WaitCancelFuture.set_exception)r1r2r3rr'r/r.r4rr)rrrC�srCcs6eZdZdd��fdd�
Z�fdd�Zdd�Z�ZS)	�_WaitHandleFutureN)rcs<t�j||||d�||_d|_tjdddd�|_d|_dS)N)rTF)rr�	_proactorZ_unregister_proactorr
ZCreateEvent�_event�
_event_fut)rrr9r:�proactorr)rrrr�s
z_WaitHandleFuture.__init__csF|jdk	r"tj|j�d|_d|_|jj|j�d|_t�j|�dS)N)	rIr;�CloseHandlerJrH�_unregisterrrr?)rr>)rrrr?�s
	z%_WaitHandleFuture._unregister_wait_cbcCs�|js
dSd|_|j}d|_ytj||j�WnZtk
r�}z>|jtjkrxd||d�}|jrh|j|d<|j	j
|�dSWYdd}~XnX|jj|j|j
�|_dS)NFz$Failed to unregister the wait handle)r#r$r%r&)r8r7r
ZUnregisterWaitExrIr(r@rArr)r*rH�_wait_cancelr?rJ)rr:r+r,rrrrB�s$

z"_WaitHandleFuture._unregister_wait)r1r2r3rr?rBr4rr)rrrG�srGc@s8eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZeZdS)�
PipeServercCs,||_tj�|_d|_d|_|jd�|_dS)NT)�_address�weakref�WeakSet�_free_instances�_pipe�_accept_pipe_future�_server_pipe_handle)rr rrrr�s

zPipeServer.__init__cCs|j|jd�}|_|S)NF)rTrV)r�tmprrr�_get_unconnected_pipe�sz PipeServer._get_unconnected_pipec	Csr|j�rdStjtjB}|r&|tjO}tj|j|tjtjBtj	Btj
tjtjtj
tj�}tj|�}|jj|�|S)N)�closedr;ZPIPE_ACCESS_DUPLEXZFILE_FLAG_OVERLAPPEDZFILE_FLAG_FIRST_PIPE_INSTANCEZCreateNamedPiperPZPIPE_TYPE_MESSAGEZPIPE_READMODE_MESSAGEZ	PIPE_WAITZPIPE_UNLIMITED_INSTANCESr	ZBUFSIZEZNMPWAIT_WAIT_FOREVER�NULL�
PipeHandlerS�add)r�first�flags�h�piperrrrVs


zPipeServer._server_pipe_handlecCs
|jdkS)N)rP)rrrrrYszPipeServer.closedcCsV|jdk	r|jj�d|_|jdk	rRx|jD]}|j�q,Wd|_d|_|jj�dS)N)rUr'rPrS�closerT�clear)rr`rrrras


zPipeServer.closeN)	r1r2r3rrXrVrYra�__del__rrrrrO�s
rOc@seZdZdd�ZdS)�_WindowsSelectorEventLoopcCstj�S)N)r	�
socketpair)rrrr�_socketpair+sz%_WindowsSelectorEventLoop._socketpairN)r1r2r3rfrrrrrd(srdcsLeZdZd�fdd�	Zdd�Zedd��Zedd	��Zed
d
d��Z�Z	S)rNcs|dkrt�}t�j|�dS)N)rrr)rrK)rrrr2szProactorEventLoop.__init__cCstj�S)N)r	re)rrrrrf7szProactorEventLoop._socketpairccs8|jj|�}|EdH}|�}|j||d|id�}||fS)N�addr)�extra)rH�connect_pipe�_make_duplex_pipe_transport)r�protocol_factoryr �fr`�protocol�transrrr�create_pipe_connection:s
z(ProactorEventLoop.create_pipe_connectioncs.t���d�����fdd�	��j���gS)Ncsd}yj|rL|j�}�jj|��j�r2|j�dS��}�j||d�id��j�}|dkr`dS�jj|�}Wn�t	k
r�}zH|r�|j
�d	kr��jd||d��|j�n�jr�t
jd|dd�WYdd}~Xn2tjk
r�|r�|j�YnX|�_|j��dS)
Nrg)rhrzPipe accept failed)r#r$r`zAccept pipe failed on pipe %rT)�exc_infor)r0rS�discardrYrarjrXrH�accept_piper(�filenor*Z_debugrZwarningr�CancelledErrorrU�add_done_callback)rlr`rmr+)r �loop_accept_piperkr�serverrrrvGs<

z>ProactorEventLoop.start_serving_pipe.<locals>.loop_accept_pipe)N)rOZ	call_soon)rrkr r)r rvrkrrwr�start_serving_pipeCs(
z$ProactorEventLoop.start_serving_pipec	ks�|j�}
t||||||||f|
|d�|	��}y|
EdHWn&tk
r`}z
|}
WYdd}~XnXd}
|
dk	r�|j�|j�EdH|
�|S)N)�waiterrh)�
create_future�_WindowsSubprocessTransport�	ExceptionraZ_wait)rrm�args�shell�stdin�stdout�stderr�bufsizerh�kwargsryZtranspr+�errrrr�_make_subprocess_transportrs

z,ProactorEventLoop._make_subprocess_transport)N)N)
r1r2r3rrfrrorxr�r4rr)rrr/s	/c@s�eZdZd0dd�Zdd�Zdd�Zd1d	d
�Zdd�Zd2dd�Zd3dd�Z	dd�Z
dd�Zdd�Ze
dd��Zd4dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd5d(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)6r���cCsDd|_g|_tjtjtd|�|_i|_tj	�|_
g|_tj	�|_dS)Nr)
r)�_resultsr
�CreateIoCompletionPort�INVALID_HANDLE_VALUErZ�_iocp�_cacherQrRr8�
_unregistered�_stopped_serving)rZconcurrencyrrrr�s
zIocpProactor.__init__cCsd|jjt|j�t|j�fS)Nz<%s overlapped#=%s result#=%s>)rr1�lenr�r�)rrrr�__repr__�szIocpProactor.__repr__cCs
||_dS)N)r))rrrrr�set_loop�szIocpProactor.set_loopNcCs |js|j|�|j}g|_|S)N)r�r<)r�timeoutrWrrr�select�s

zIocpProactor.selectcCs|jj�}|j|�|S)N)r)rzr/)r�valuer>rrr�_result�s

zIocpProactor._resultrcCsz|j|�tjt�}y4t|tj�r6|j|j�||�n|j|j�|�Wnt	k
rb|j
d�SXdd�}|j|||�S)N�cSsJy|j�Stk
rD}z |jtjkr2t|j��n�WYdd}~XnXdS)N)�	getresultr(r@r
�ERROR_NETNAME_DELETED�ConnectionResetErrorr})rn�keyrr+rrr�finish_recv�sz&IocpProactor.recv.<locals>.finish_recv)�_register_with_iocpr
�
OverlappedrZ�
isinstance�socketZWSARecvrsZReadFile�BrokenPipeErrorr��	_register)r�conn�nbytesr^rr�rrr�recv�s

	zIocpProactor.recvcCsZ|j|�tjt�}t|tj�r4|j|j�||�n|j|j�|�dd�}|j	|||�S)NcSsJy|j�Stk
rD}z |jtjkr2t|j��n�WYdd}~XnXdS)N)r�r(r@r
r�r�r})rnr�rr+rrr�finish_send�sz&IocpProactor.send.<locals>.finish_send)
r�r
r�rZr�r�ZWSASendrsZ	WriteFiler�)rr��bufr^rr�rrr�send�s

	zIocpProactor.sendcsz|j��|j�j��tjt�}|j�j��j����fdd�}tdd��}|j	|�|�}||��}t
j||jd�|S)NcsD|j�tjd�j��}�jtjtj|��j	�j
����j�fS)Nz@P)r��structZpackrs�
setsockoptr��
SOL_SOCKETr
ZSO_UPDATE_ACCEPT_CONTEXT�
settimeoutZ
gettimeoutZgetpeername)rnr�rr�)r��listenerrr�
finish_accept�s
z*IocpProactor.accept.<locals>.finish_acceptcss4y|EdHWn tjk
r.|j��YnXdS)N)rrtra)r%r�rrr�accept_coro�s
z(IocpProactor.accept.<locals>.accept_coro)r)
r��_get_accept_socket�familyr
r�rZZAcceptExrsrr�rZ
ensure_futurer))rr�rr�r�r%�coror)r�r�r�accept�s

		
zIocpProactor.acceptcs�|j��ytj�j��j�WnBtk
rb}z&|jtjkr@��j	�ddkrR�WYdd}~XnXtj
t�}|j�j�|��fdd�}|j
|�|�S)Nrrcs|j��jtjtjd��S)Nr)r�r�r�r�r
ZSO_UPDATE_CONNECT_CONTEXT)rnr�r)r�rr�finish_connects
z,IocpProactor.connect.<locals>.finish_connect)r�r
Z	BindLocalrsr�r(r@�errnoZ	WSAEINVALZgetsocknamer�rZZ	ConnectExr�)rr�r �err�r)r�r�connect�s

zIocpProactor.connectcsJ|j��tjt�}|j�j��}|r0|j��S�fdd�}|j|�|�S)Ncs|j��S)N)r�)rnr�r)r`rr�finish_accept_pipesz4IocpProactor.accept_pipe.<locals>.finish_accept_pipe)r�r
r�rZZConnectNamedPipersr�r�)rr`rZ	connectedr�r)r`rrr
s


zIocpProactor.accept_pipeccszt}xjytj|�}PWn0tk
rF}z|jtjkr6�WYdd}~XnXt|dt�}tj	||j
d�EdHqWtj|�S)N�)r)
�CONNECT_PIPE_INIT_DELAYr
ZConnectPiper(r@ZERROR_PIPE_BUSY�min�CONNECT_PIPE_MAX_DELAYrZsleepr)r	r[)rr Zdelayr9r+rrrris
zIocpProactor.connect_pipecCs|j||d�S)NF)�_wait_for_handle)rr9r�rrr�wait_for_handle/szIocpProactor.wait_for_handlecCs|j|dd�}||_|S)NT)r�rD)rrEZ
done_callbackr>rrrrN7szIocpProactor._wait_cancelcs�|dkrtj}ntj|d�}tjt�}tj||j|j	|�}|rTt
||||jd��nt|||||jd���j
rv�j
d=�fdd�}�|d|f|j|j	<�S)Ng@�@)rrcs�j�S)N)r<)rnr�r)rlrr�finish_wait_for_handleRsz=IocpProactor._wait_for_handle.<locals>.finish_wait_for_handlerr)r;�INFINITE�math�ceilr
r�rZZRegisterWaitWithQueuer�r rCr)rGrr�)rr9r�Z
_is_cancel�msrr:r�r)rlrr�>s


	zIocpProactor._wait_for_handlecCs0||jkr,|jj|�tj|j�|jdd�dS)Nr)r8r\r
r�rsr�)r�objrrrr�^s
z IocpProactor._register_with_iocpcCs�t||jd�}|jr|jd=|jsjy|dd|�}Wn,tk
r^}z|j|�WYdd}~XnX|j|�||||f|j|j<|S)N)rrr)	rr)rrr(r.r/r�r )rrr��callbackrlr�r�rrrr�hs

zIocpProactor._registercCs|jj|�dS)N)r�r=)rrrrrrM�szIocpProactor._unregistercCstj|�}|jd�|S)Nr)r�r�)rr��srrrr��s

zIocpProactor._get_accept_socketcCs�|dkrt}n0|dkr td��ntj|d�}|tkr>td���xtj|j|�}|dkrZPd}|\}}}}y|jj|�\}}	}
}WnVt	k
r�|j
j�r�|j
jdd||||fd��|dtj
fkr�tj|�wBYnX|
|jkr�|j�qB|j�sBy||||	�}Wn:tk
�r@}
z|j|
�|jj|�WYdd}
~
XqBX|j|�|jj|�qBWx |jD]}	|jj|	jd��qdW|jj�dS)Nrznegative timeoutg@�@ztimeout too bigz8GetQueuedCompletionStatus() returned an unexpected eventz)err=%s transferred=%s key=%#x address=%#x)r#�status)r��
ValueErrorr�r�r
ZGetQueuedCompletionStatusr�r��pop�KeyErrorr)Z	get_debugr*r�r;rLr�r'�doner(r.r�r=r/r�r rb)rr�r�r�r�Ztransferredr�r rlrr�r�r�r�rrrr<�sJ






zIocpProactor._pollcCs|jj|�dS)N)r�r\)rr�rrr�
_stop_serving�szIocpProactor._stop_servingcCs�x�t|jj��D]�\}\}}}}|j�r*qt|t�r6qy|j�Wqtk
r�}z8|jdk	r�d||d�}|j	rz|j	|d<|jj
|�WYdd}~XqXqWx|jr�|jd�s�tj
d�q�Wg|_|jdk	r�tj|j�d|_dS)NzCancelling a future failed)r#r$r%r&rz"taking long time to close proactor)�listr��itemsZ	cancelledr�rCr'r(r)rr*r<r�debugr�r�r;rL)rr r>rr�r�r+r,rrrra�s, 


"

zIocpProactor.closecCs|j�dS)N)ra)rrrrrc�szIocpProactor.__del__)r�)N)r)r)N)N)r1r2r3rr�r�r�r�r�r�r�r�rrrrir�rNr�r�r�rMr�r<r�rarcrrrrr�s,





 
	
7 c@seZdZdd�ZdS)r{c
sPtj|f|||||d�|���_�fdd�}�jjjt�jj��}	|	j|�dS)N)r~rr�r�r�cs�jj�}�j|�dS)N)�_procZpollZ_process_exited)rl�
returncode)rrrr��s
z4_WindowsSubprocessTransport._start.<locals>.callback)	r	�Popenr�r)rHr��intr6ru)
rr}r~rr�r�r�r�r�rlr)rr�_start�sz"_WindowsSubprocessTransport._startN)r1r2r3r�rrrrr{�sr{c@seZdZeZdS)�_WindowsDefaultEventLoopPolicyN)r1r2r3r
Z
_loop_factoryrrrrr�sr�),r;r�r�r�r�rQ�rrrrrrr	r
Z
coroutinesr�logr�__all__rZr�ZERROR_CONNECTION_REFUSEDZERROR_CONNECTION_ABORTEDr�r�ZFuturerr5rCrG�objectrOZBaseSelectorEventLooprdZBaseProactorEventLooprrZBaseSubprocessTransportr{r
ZBaseDefaultEventLoopPolicyr�rrrrr�<module>sJ0J4;]k

Zerion Mini Shell 1.0