AlkantarClanX12

Your IP : 52.15.170.196


Current Path : /opt/alt/python36/lib64/python3.6/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/multiprocessing/__pycache__/util.cpython-36.opt-2.pyc

3

��2an.�@s�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddddd	d
ddd
ddddddgZ
dZdZdZ
dZdZdZdZdadadd�Zdd�Zdd�Zdd�Zdd	�Zd6d d
�Zd!d�Zej�Zej�Zd"d#�Zd$d�Z iZ!ej�Z"Gd%d�de#�Z$d7d&d'�Z%d(d
�Z&da'eee%e	j(e	j)fd)d*�Z*ej+e*�Gd+d�de#�Z,Gd,d�dej-�Z.yej/d-�Z0Wne1k
�r�d.Z0YnXd/d�Z2d0d1�Z3d2d3�Z4d4d5�Z5dS)8�N)�_args_from_interpreter_flags�)�process�	sub_debug�debug�info�sub_warning�
get_logger�
log_to_stderr�get_temp_dir�register_after_fork�
is_exiting�Finalize�ForkAwareThreadLock�ForkAwareLocal�close_all_fds_except�SUBDEBUG�
SUBWARNING��
��Zmultiprocessingz+[%(levelname)s/%(processName)s] %(message)sFcGstrtjt|f|��dS)N)�_logger�logr)�msg�args�r�)/opt/alt/python36/lib64/python3.6/util.pyr,scGstrtjt|f|��dS)N)rr�DEBUG)rrrrrr0scGstrtjt|f|��dS)N)rr�INFO)rrrrrr4scGstrtjt|f|��dS)N)rrr)rrrrrr8sc
Cs|ddl}|j�z\tsj|jt�adt_ttd�rFtjt	�tj
t	�n$tjjt	fif�tjj
t	fif�Wd|j�XtS)Nr�
unregister)�loggingZ_acquireLockrZ	getLogger�LOGGER_NAMEZ	propagate�hasattr�atexitr �_exit_function�registerZ
_exithandlers�remove�appendZ_releaseLock)r!rrrr	<s



cCsJddl}t�}|jt�}|j�}|j|�|j|�|rB|j|�dat	S)NrT)
r!r	Z	Formatter�DEFAULT_LOGGING_FORMATZ
StreamHandlerZsetFormatterZ
addHandlerZsetLevel�_log_to_stderrr)�levelr!Zlogger�	formatterZhandlerrrrr
Ws



cCsdtj�jjd�}|dkr`ddl}ddl}|jdd�}td|�td|j	|gdd�|tj�jd<|S)	N�tempdirrzpymp-)�prefixzcreated temp directory %s�d)r�exitpriorityi����)
r�current_processZ_config�get�shutil�tempfileZmkdtemprrZrmtree)r-r3r4rrrrms
cCsjttj��}|j�xP|D]H\\}}}}y||�Wqtk
r`}ztd|�WYdd}~XqXqWdS)Nz after forker raised exception %s)�list�_afterfork_registry�items�sort�	Exceptionr)r7�indexZident�func�obj�errr�_run_after_forkerssr>cCs|ttt�t|�|f<dS)N)r6�next�_afterfork_counter�id)r<r;rrrr�sc@sHeZdZfddfdd�Zdeeejfdd�Zdd�Z	dd	�Z
d
d�ZdS)rNcCsT|dk	rtj||�|_n||_||_|p*i|_|tt�f|_t	j
�|_|t|j<dS)N)
�weakref�ref�_weakref�	_callback�_args�_kwargsr?�_finalizer_counter�_key�os�getpid�_pid�_finalizer_registry)�selfr<�callbackr�kwargsr0rrr�__init__�s

zFinalize.__init__c
Cs�y||j=Wntk
r(|d�YnbX|j|�krD|d�d}n$|d|j|j|j�|j|j|j�}d|_|_|_|_|_|SdS)Nzfinalizer no longer registeredz+finalizer ignored because different processz/finalizer calling %s with args %s and kwargs %s)rI�KeyErrorrLrErFrGrD)rN�wrrMrrK�resrrr�__call__�szFinalize.__call__cCsDyt|j=Wntk
r Yn Xd|_|_|_|_|_dS)N)rMrIrRrDrErFrG)rNrrr�cancel�s
zFinalize.cancelcCs
|jtkS)N)rIrM)rNrrr�still_active�szFinalize.still_activecCs�y|j�}Wnttfk
r(d}YnX|dkr>d|jjSd|jjt|jd|j�f}|jrr|dt|j�7}|j	r�|dt|j	�7}|j
ddk	r�|dt|j
d�7}|dS)	Nz<%s object, dead>z<%s object, callback=%s�__name__z, args=z	, kwargs=rz, exitprority=�>)rD�AttributeError�	TypeError�	__class__rX�getattrrErF�strrGrI)rNr<�xrrr�__repr__�s 
zFinalize.__repr__)rX�
__module__�__qualname__rQrMrrJrKrUrVrWr`rrrrr�scs�tdkrdS�dkrdd��n�fdd���fdd�tt�D�}|jdd�xX|D]P}tj|�}|dk	rRtd|�y
|�WqRtk
r�d	dl}|j�YqRXqRW�dkr�tj�dS)
NcSs|ddk	S)Nrr)�prrr�<lambda>�sz!_run_finalizers.<locals>.<lambda>cs|ddk	o|d�kS)Nrr)rc)�minpriorityrrrd�scsg|]}�|�r|�qSrr)�.0�key)�frr�
<listcomp>�sz#_run_finalizers.<locals>.<listcomp>T)�reversez
calling %sr)	rMr5r8r2rr9�	traceback�	print_exc�clear)re�keysrg�	finalizerrkr)rhrer�_run_finalizers�s$




rpcCstp
tdkS)N)�_exitingrrrrr
scCs�ts�da|d�|d�|d�|�dk	rzx*|�D] }|jr2|d|j�|jj�q2Wx"|�D]}|d|j�|j�q^W|d�|�dS)NTzprocess shutting downz2running all "atexit" finalizers with priority >= 0rz!calling terminate() for daemon %szcalling join() for process %sz)running the remaining "atexit" finalizers)rqZdaemon�nameZ_popenZ	terminate�join)rrrp�active_childrenr1rcrrrr%s	
r%c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs|j�t|tj�dS)N)�_resetrr)rNrrrrQKszForkAwareThreadLock.__init__cCs"tj�|_|jj|_|jj|_dS)N)�	threadingZLock�_lock�acquire�release)rNrrrruOs

zForkAwareThreadLock._resetcCs
|jj�S)N)rw�	__enter__)rNrrrrzTszForkAwareThreadLock.__enter__cGs|jj|�S)N)rw�__exit__)rNrrrrr{WszForkAwareThreadLock.__exit__N)rXrarbrQrurzr{rrrrrJsc@seZdZdd�Zdd�ZdS)rcCst|dd��dS)NcSs
|jj�S)N)�__dict__rm)r<rrrrd]sz)ForkAwareLocal.__init__.<locals>.<lambda>)r)rNrrrrQ\szForkAwareLocal.__init__cCst|�ffS)N)�type)rNrrr�
__reduce__^szForkAwareLocal.__reduce__N)rXrarbrQr~rrrrr[s�SC_OPEN_MAX�cCsRt|�dtg}|j�x4tt|�d�D] }tj||d||d�q*WdS)Nr���)r5�MAXFDr8�range�lenrJ�
closerange)Zfds�irrrrjscCs�tjdkrdSytjj�Wnttfk
r4YnXy@tjtjtj�}yt|dd�t_Wntj|��YnXWnttfk
r�YnXdS)NF)�closefd)	�sys�stdin�close�OSError�
ValueErrorrJ�open�devnull�O_RDONLY)�fdrrr�_close_stdints

r�cCsTytjj�Wnttfk
r&YnXytjj�Wnttfk
rNYnXdS)N)r��stdout�flushrZr��stderrrrrr�_flush_std_streams�sr�cCstddl}tttt|���}tj�\}}z2|j|tj|�gd|ddddddd	d
||ddd�Stj	|�tj	|�XdS)NrTrFr�r�r�r�r�r�)
�_posixsubprocess�tuple�sorted�map�intrJ�pipeZ	fork_exec�fsencoder�)�pathrZpassfdsr�Zerrpipe_readZ
errpipe_writerrr�spawnv_passfds�s

r�)N)N)6rJ�	itertoolsr�rBr$rv�
subprocessr�r�__all__ZNOTSETrrrrr"r)rr*rrrrr	r
r�WeakValueDictionaryr6�countr@r>rrMrH�objectrrpr
rqrtr1r%r&rZlocalr�sysconfr�r9rr�r�r�rrrr�<module>
sf


	S
,(