AlkantarClanX12

Your IP : 3.147.13.220


Current Path : /opt/alt/python37/lib64/python3.7/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/asyncio/__pycache__/base_subprocess.cpython-37.opt-1.pyc

B

� fR"�@sxddlZddlZddlZddlmZddlmZddlmZGdd�dej�Z	Gdd	�d	ej
�ZGd
d�deej�Z
dS)�N�)�	protocols)�
transports)�loggercs�eZdZd0�fdd�	Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Z�ZS)1�BaseSubprocessTransportNc
	s&t��|
�d|_||_||_d|_d|_d|_g|_t	�
�|_i|_d|_
|tjkr`d|jd<|tjkrtd|jd<|tjkr�d|jd<y"|jf||||||d�|��Wn|���YnX|jj|_|j|jd<|j���rt|ttf�r�|}n|d}t�d||j�|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�protocolrr	r
rrr
�waiterZextra�kwargsZprogram)�	__class__��</opt/alt/python37/lib64/python3.7/asyncio/base_subprocess.pyrs@








z BaseSubprocessTransport.__init__cCs|jjg}|jr|�d�|jdk	r6|�d|j���|jdk	rT|�d|j���n |jdk	rj|�d�n
|�d�|j�d�}|dk	r�|�d|j���|j�d�}|j�d	�}|dk	r�||kr�|�d
|j���n6|dk	r�|�d|j���|dk	�r|�d|j���d
�	d�
|��S)N�closedzpid=zreturncode=Zrunningznot startedrzstdin=rrzstdout=stderr=zstdout=zstderr=z<{}>� )r,�__name__r�appendrrr�get�pipe�format�join)r'�infor
rrr-r-r.�__repr__7s,






z BaseSubprocessTransport.__repr__cKst�dS)N)�NotImplementedError)r'rr	r
rrr
r+r-r-r.rTszBaseSubprocessTransport._startcCs
||_dS)N)r)r'r)r-r-r.�set_protocolWsz$BaseSubprocessTransport.set_protocolcCs|jS)N)r)r'r-r-r.�get_protocolZsz$BaseSubprocessTransport.get_protocolcCs|jS)N)r)r'r-r-r.�
is_closing]sz"BaseSubprocessTransport.is_closingcCs�|jr
dSd|_x&|j��D]}|dkr*q|j��qW|jdk	r�|jdkr�|j��dkr�|j�	�rpt
�d|�y|j��Wnt
k
r�YnXdS)NTz$Close running child process: kill %r)rr�valuesr4rrrZpollrr!rZwarning�kill�ProcessLookupError)r'�protor-r-r.r`s 


zBaseSubprocessTransport.closecCs(|js$tjd|��t|d�|��dS)Nzunclosed transport )�source)r�warnings�warn�ResourceWarningr)r'r-r-r.�__del__{szBaseSubprocessTransport.__del__cCs|jS)N)r)r'r-r-r.�get_pid�szBaseSubprocessTransport.get_pidcCs|jS)N)r)r'r-r-r.�get_returncode�sz&BaseSubprocessTransport.get_returncodecCs||jkr|j|jSdSdS)N)rr4)r'�fdr-r-r.�get_pipe_transport�s
z*BaseSubprocessTransport.get_pipe_transportcCs|jdkrt��dS)N)rr?)r'r-r-r.�_check_proc�s
z#BaseSubprocessTransport._check_proccCs|��|j�|�dS)N)rJr�send_signal)r'�signalr-r-r.rK�sz#BaseSubprocessTransport.send_signalcCs|��|j��dS)N)rJr�	terminate)r'r-r-r.rM�sz!BaseSubprocessTransport.terminatecCs|��|j��dS)N)rJrr>)r'r-r-r.r>�szBaseSubprocessTransport.killc	
�sLy�j}�j}|jdk	rB|��fdd�|j�IdH\}}|�jd<|jdk	rv|��fdd�|j�IdH\}}|�jd<|jdk	r�|��fdd�|j�IdH\}}|�jd<|��j	j
��x"�jD]\}}|j|f|��q�Wd�_WnBtk
�r(}z"|dk	�r|�
��s|�|�Wdd}~XYn X|dk	�rH|�
��sH|�d�dS)Ncs
t�d�S)Nr)�WriteSubprocessPipeProtor-)r'r-r.�<lambda>��z8BaseSubprocessTransport._connect_pipes.<locals>.<lambda>rcs
t�d�S)Nr)�ReadSubprocessPipeProtor-)r'r-r.rO�rPrcs
t�d�S)Nr)rQr-)r'r-r.rO�rPr)rrr
Zconnect_write_piperrZconnect_read_piper�	call_soonr�connection_mader�	Exception�	cancelledZ
set_exception�
set_result)	r'r*�procr(�_r4�callback�data�excr-)r'r.r&�s6









z&BaseSubprocessTransport._connect_pipescGs2|jdk	r|j�||f�n|jj|f|��dS)N)rr2rrR)r'�cbrZr-r-r.�_call�s
zBaseSubprocessTransport._callcCs|�|jj||�|��dS)N)r]rZpipe_connection_lost�_try_finish)r'rHr[r-r-r.�_pipe_connection_lost�sz-BaseSubprocessTransport._pipe_connection_lostcCs|�|jj||�dS)N)r]rZpipe_data_received)r'rHrZr-r-r.�_pipe_data_received�sz+BaseSubprocessTransport._pipe_data_receivedcCst|j��rt�d||�||_|jjdkr2||j_|�|jj	�|�
�x |jD]}|��sP|�
|�qPWd|_dS)Nz%r exited with return code %r)rr!rr7rr�
returncoder]rZprocess_exitedr^rrUrV)r'rar*r-r-r.�_process_exited�s
z'BaseSubprocessTransport._process_exitedc�s0|jdk	r|jS|j��}|j�|�|IdHS)zdWait until the process exit and return the process return code.

        This method is a coroutine.N)rrZ
create_futurerr2)r'r*r-r-r.�_wait�s


zBaseSubprocessTransport._waitcCs>|jdkrdStdd�|j��D��r:d|_|�|jd�dS)Ncss|]}|dk	o|jVqdS)N)�disconnected)�.0�pr-r-r.�	<genexpr>�sz6BaseSubprocessTransport._try_finish.<locals>.<genexpr>T)r�allrr=rr]�_call_connection_lost)r'r-r-r.r^�s
z#BaseSubprocessTransport._try_finishcCs*z|j�|�Wdd|_d|_d|_XdS)N)r�connection_lostrr)r'r[r-r-r.ri�s
z-BaseSubprocessTransport._call_connection_lost)NN)r1�
__module__�__qualname__rr8rr:r;r<rrErFrGrIrJrKrMr>r&r]r_r`rbrcr^ri�
__classcell__r-r-)r,r.r
s.)$	rc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rNcCs||_||_d|_d|_dS)NF)rWrHr4rd)r'rWrHr-r-r.rsz!WriteSubprocessPipeProto.__init__cCs
||_dS)N)r4)r'Z	transportr-r-r.rSsz(WriteSubprocessPipeProto.connection_madecCs d|jj�d|j�d|j�d�S)N�<z fd=z pipe=�>)r,r1rHr4)r'r-r-r.r8	sz!WriteSubprocessPipeProto.__repr__cCs d|_|j�|j|�d|_dS)NT)rdrWr_rH)r'r[r-r-r.rjsz(WriteSubprocessPipeProto.connection_lostcCs|jj��dS)N)rWr�
pause_writing)r'r-r-r.rpsz&WriteSubprocessPipeProto.pause_writingcCs|jj��dS)N)rWr�resume_writing)r'r-r-r.rqsz'WriteSubprocessPipeProto.resume_writingN)	r1rkrlrrSr8rjrprqr-r-r-r.rN�srNc@seZdZdd�ZdS)rQcCs|j�|j|�dS)N)rWr`rH)r'rZr-r-r.�
data_receivedsz%ReadSubprocessPipeProto.data_receivedN)r1rkrlrrr-r-r-r.rQsrQ)rrrB�rr�logrZSubprocessTransportrZBaseProtocolrNZProtocolrQr-r-r-r.�<module>su