AlkantarClanX12

Your IP : 18.219.47.239


Current Path : /opt/alt/python35/lib64/python3.5/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/asyncio/__pycache__/base_subprocess.cpython-35.pyc



��Yf]#�@s�ddlZddlZddlZddlmZddlmZddlmZddlmZddl	m
Z
Gdd	�d	ej�ZGd
d�dej
�ZGdd
�d
eej�ZdS)�N�)�compat)�	protocols)�
transports)�	coroutine)�loggercsEeZdZdd�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	e
jr�dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zed d!��Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zed*d+��Zd,d-�Zd.d/�Z�S)0�BaseSubprocessTransportNc
s�t�j|
�d|_||_||_d|_d|_d|_g|_t	j
�|_i|_d|_
|tjkr�d|jd<|tjkr�d|jd<|tjkr�d|jd<y5|jd|d|d|d|d	|d
||�Wn|j��YnX|jj|_|j|jd<|jj�r}t|ttf�r]|}n
|d}tjd||j�|jj|j|	��dS)
NFrr��args�shell�stdin�stdout�stderr�bufsize�
subprocesszprocess %r created: pid %s)�super�__init__�_closed�	_protocol�_loop�_proc�_pid�_returncode�
_exit_waiters�collections�deque�_pending_calls�_pipes�	_finishedr�PIPE�_start�close�pidZ_extra�	get_debug�
isinstance�bytes�strr�debugZcreate_task�_connect_pipes)
�self�loop�protocolr
rrr
rr�waiterZextra�kwargsZprogram)�	__class__��</opt/alt/python35/lib64/python3.5/asyncio/base_subprocess.pyrs@									


!
	
	
z BaseSubprocessTransport.__init__cCsp|jjg}|jr%|jd�|jdk	rH|jd|j�|jdk	rn|jd|j�n,|jdk	r�|jd�n
|jd�|jjd�}|dk	r�|jd|j�|jjd�}|jjd	�}|dk	r||kr|jd
|j�n@|dk	r?|jd|j�|dk	r_|jd|j�d
dj	|�S)N�closedzpid=%sz
returncode=%sZrunningznot startedrzstdin=%srr	zstdout=stderr=%sz	stdout=%sz	stderr=%sz<%s>� )
r.�__name__r�appendrrr�get�pipe�join)r)�inforr
rr/r/r0�__repr__9s,	

z BaseSubprocessTransport.__repr__cKs
t�dS)N)�NotImplementedError)r)r
rrr
rrr-r/r/r0r VszBaseSubprocessTransport._startcCs
||_dS)N)r)r)r+r/r/r0�set_protocolYsz$BaseSubprocessTransport.set_protocolcCs|jS)N)r)r)r/r/r0�get_protocol\sz$BaseSubprocessTransport.get_protocolcCs|jS)N)r)r)r/r/r0�
is_closing_sz"BaseSubprocessTransport.is_closingcCs�|jr
dSd|_x3|jj�D]"}|dkr;q&|jj�q&W|jdk	r�|jdkr�|jj�dkr�|jj	�r�t
jd|�y|jj�Wnt
k
r�YnXdS)NTz$Close running child process: kill %r)rr�valuesr6r!rrZpollrr#rZwarning�kill�ProcessLookupError)r)�protor/r/r0r!bs 		
zBaseSubprocessTransport.closecCs+|js'tjd|t�|j�dS)Nzunclosed transport %r)r�warnings�warn�ResourceWarningr!)r)r/r/r0�__del__�s	zBaseSubprocessTransport.__del__cCs|jS)N)r)r)r/r/r0�get_pid�szBaseSubprocessTransport.get_pidcCs|jS)N)r)r)r/r/r0�get_returncode�sz&BaseSubprocessTransport.get_returncodecCs%||jkr|j|jSdSdS)N)rr6)r)�fdr/r/r0�get_pipe_transport�sz*BaseSubprocessTransport.get_pipe_transportcCs|jdkrt��dS)N)rr@)r)r/r/r0�_check_proc�sz#BaseSubprocessTransport._check_proccCs|j�|jj|�dS)N)rJr�send_signal)r)�signalr/r/r0rK�s
z#BaseSubprocessTransport.send_signalcCs|j�|jj�dS)N)rJr�	terminate)r)r/r/r0rM�s
z!BaseSubprocessTransport.terminatecCs|j�|jj�dS)N)rJrr?)r)r/r/r0r?�s
zBaseSubprocessTransport.killc	#s�yL�j}�j}|jdk	r]|j�fdd�|j�EdH\}}|�jd<|jdk	r�|j�fdd�|j�EdH\}}|�jd<|jdk	r�|j�fdd�|j�EdH\}}|�jd<�jdk	st	�|j
�jj��x'�jD]\}}|j
||�q"Wd�_WnKt
k
r�}z+|dk	r�|j�r�|j|�WYdd}~Xn'X|dk	r�|j�r�|jd�dS)Ncs
t�d�S)Nr)�WriteSubprocessPipeProtor/)r)r/r0�<lambda>�sz8BaseSubprocessTransport._connect_pipes.<locals>.<lambda>rcs
t�d�S)Nr)�ReadSubprocessPipeProtor/)r)r/r0rO�srcs
t�d�S)Nr	)rPr/)r)r/r0rO�sr	)rrrZconnect_write_piperr
Zconnect_read_piperr�AssertionError�	call_soonr�connection_made�	Exception�	cancelledZ
set_exception�
set_result)	r)r,�procr*�_r6�callback�data�excr/)r)r0r(�s8		



 z&BaseSubprocessTransport._connect_pipescGs?|jdk	r(|jj||f�n|jj||�dS)N)rr4rrR)r)�cbrZr/r/r0�_call�szBaseSubprocessTransport._callcCs'|j|jj||�|j�dS)N)r]rZpipe_connection_lost�_try_finish)r)rHr[r/r/r0�_pipe_connection_lost�sz-BaseSubprocessTransport._pipe_connection_lostcCs|j|jj||�dS)N)r]rZpipe_data_received)r)rHrZr/r/r0�_pipe_data_received�sz+BaseSubprocessTransport._pipe_data_receivedcCs�|dk	st|��|jdks6t|j��|jj�rXtjd||�||_|jjdkr||j_|j|j	j
�|j�x*|jD]}|j
�s�|j|�q�Wd|_dS)Nz%r exited with return code %r)rQrrr#rr8r�
returncoder]rZprocess_exitedr^rrUrV)r)rar,r/r/r0�_process_exited�s	
	
z'BaseSubprocessTransport._process_exitedccs>|jdk	r|jS|jj�}|jj|�|EdHS)zdWait until the process exit and return the process return code.

        This method is a coroutine.N)rrZ
create_futurerr4)r)r,r/r/r0�_wait�s
zBaseSubprocessTransport._waitcCse|jst�|jdkr#dStdd�|jj�D��rad|_|j|jd�dS)Ncss$|]}|dk	o|jVqdS)N)�disconnected)�.0�pr/r/r0�	<genexpr>�sz6BaseSubprocessTransport._try_finish.<locals>.<genexpr>T)rrQr�allrr>r]�_call_connection_lost)r)r/r/r0r^�s	z#BaseSubprocessTransport._try_finishcCs7z|jj|�Wdd|_d|_d|_XdS)N)r�connection_lostrr)r)r[r/r/r0ri�s
		z-BaseSubprocessTransport._call_connection_lost)r3�
__module__�__qualname__rr9r r;r<r=r!rZPY34rErFrGrIrJrKrMr?rr(r]r_r`rbrcr^rir/r/)r.r0rs0)	%	rc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rNcCs(||_||_d|_d|_dS)NF)rWrHr6rd)r)rWrHr/r/r0rs			z!WriteSubprocessPipeProto.__init__cCs
||_dS)N)r6)r)Z	transportr/r/r0rS
sz(WriteSubprocessPipeProto.connection_madecCsd|jj|j|jfS)Nz<%s fd=%s pipe=%r>)r.r3rHr6)r)r/r/r0r9sz!WriteSubprocessPipeProto.__repr__cCs,d|_|jj|j|�d|_dS)NT)rdrWr_rH)r)r[r/r/r0rjs	z(WriteSubprocessPipeProto.connection_lostcCs|jjj�dS)N)rWr�
pause_writing)r)r/r/r0rmsz&WriteSubprocessPipeProto.pause_writingcCs|jjj�dS)N)rWr�resume_writing)r)r/r/r0rnsz'WriteSubprocessPipeProto.resume_writingN)	r3rkrlrrSr9rjrmrnr/r/r/r0rNsrNc@seZdZdd�ZdS)rPcCs|jj|j|�dS)N)rWr`rH)r)rZr/r/r0�
data_received#sz%ReadSubprocessPipeProto.data_receivedN)r3rkrlror/r/r/r0rP srP)rrrB�rrrZ
coroutinesr�logrZSubprocessTransportrZBaseProtocolrNZProtocolrPr/r/r/r0�<module>s�