AlkantarClanX12

Your IP : 18.117.158.10


Current Path : /opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/util.cpython-35.opt-2.pyc



���]y-�@sTddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddddd	d
ddd
ddddddgZ
dZdZdZ
dZdZdZdZdadadd�Zdd�Zdd�Zdd�Zdd	�Zdd d
�Zd!d�Zej�Zej�Zd"d#�Zd$d�Z iZ!ej�Z"Gd%d�de#�Z$dd&d'�Z%d(d
�Z&da'eee%e	j(e	j)d)d*�Z*ej+e*�Gd+d�de#�Z,Gd,d�dej-�Z.yej/d-�Z0Wne1k
r+d.Z0YnXd/d�Z2d0d1�Z3d2d3�Z4dS)4�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��
���multiprocessingz+[%(levelname)s/%(processName)s] %(message)sFcGstrtjt||�dS)N)�_logger�logr)�msg�args�r�)/opt/alt/python35/lib64/python3.5/util.pyr,scGstrtjt||�dS)N)rr�DEBUG)rrrrrr0scGstrtjt||�dS)N)rr�INFO)rrrrrr4scGstrtjt||�dS)N)rrr)rrrrrr8sc
Cs�ddl}|j�z�ts�|jt�adt_ttd�rctjt	�tj
t	�n2tjjt	fif�tjj
t	fif�Wd|j�XtS)Nr�
unregister)�logging�_acquireLockr�	getLogger�LOGGER_NAME�	propagate�hasattr�atexitr!�_exit_function�register�
_exithandlers�remove�append�_releaseLock)r"rrrr	<s
	
cCsgddl}t�}|jt�}|j�}|j|�|j|�|r]|j|�dat	S)NrT)
r"r	�	Formatter�DEFAULT_LOGGING_FORMAT�
StreamHandler�setFormatter�
addHandler�setLevel�_log_to_stderrr)�levelr"�logger�	formatter�handlerrrrr
Ws	


cCs�tj�jjd�}|dkr�ddl}ddl}|jdd�}td|�td|j	d|gdd	�|tj�jd<|S)
N�tempdirr�prefixzpymp-zcreated temp directory %sr�exitpriority�di����)
r�current_process�_config�get�shutil�tempfile�mkdtemprr�rmtree)r:rArBrrrrms
cCs�ttj��}|j�x`|D]X\\}}}}y||�Wq#tk
rz}ztd|�WYdd}~Xq#Xq#WdS)Nz after forker raised exception %s)�list�_afterfork_registry�items�sort�	Exceptionr)rG�index�ident�func�obj�errr�_run_after_forkerss
rOcCs#|ttt�t|�|f<dS)N)rF�next�_afterfork_counter�id)rMrLrrrr�sc@sdeZdZfdddd�Zdeeejdd�Zdd�Z	dd	�Z
d
d�ZdS)rNcCsz|dk	r$tj||�|_n||_||_|p?i|_|tt�f|_t	j
�|_|t|j<dS)N)
�weakref�ref�_weakref�	_callback�_args�_kwargsrP�_finalizer_counter�_key�os�getpid�_pid�_finalizer_registry)�selfrM�callbackr�kwargsr<rrr�__init__�s		zFinalize.__init__c
Cs�y||j=Wntk
r,|d�Yn�X|j|�krR|d�d}n4|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)rZ�KeyErrorr]rVrWrXrU)r_�wrr^rr\�resrrr�__call__�s

	%zFinalize.__call__cCsLyt|j=Wntk
r"Yn&Xd|_|_|_|_|_dS)N)r^rZrcrUrVrWrX)r_rrr�cancel�s

zFinalize.cancelcCs
|jtkS)N)rZr^)r_rrr�still_active�szFinalize.still_activecCs�y|j�}Wnttfk
r0d}YnX|dkrKd|jjSd|jjt|jd|j�f}|jr�|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=�>)rU�AttributeError�	TypeError�	__class__ri�getattrrVrW�strrXrZ)r_rM�xrrr�__repr__�s 			zFinalize.__repr__)ri�
__module__�__qualname__rbr^rr[r\rfrgrhrqrrrrr�scs�tdkrdS�dkr+dd��n�fdd���fdd�tt�D�}|jdd�xl|D]d}tj|�}|dk	rstd|�y|�Wqstk
r�d	dl}|j�YqsXqsW�dkr�tj�dS)
NcSs|ddk	S)Nrr)�prrr�<lambda>�sz!_run_finalizers.<locals>.<lambda>cs|ddk	o|d�kS)Nrr)rt)�minpriorityrrru�scs"g|]}�|�r|�qSrr)�.0�key)�frr�
<listcomp>�s	z#_run_finalizers.<locals>.<listcomp>�reverseTz
calling %sr)	r^rErHr@rrI�	traceback�	print_exc�clear)rv�keysrx�	finalizerr|r)ryrvr�_run_finalizers�s$


r�cCstptdkS)N)�_exitingrrrrr
scCs�ts�da|d�|d�|d�|�dk	r�x7|�D],}|jrC|d|j�|jj�qCWx+|�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)r��daemon�name�_popen�	terminate�join)rrr��active_childrenr>rtrrrr)s	


	
r)c@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs|j�t|tj�dS)N)�_resetrr)r_rrrrbKs
zForkAwareThreadLock.__init__cCs1tj�|_|jj|_|jj|_dS)N)�	threading�Lock�_lock�acquire�release)r_rrrr�OszForkAwareThreadLock._resetcCs
|jj�S)N)r��	__enter__)r_rrrr�TszForkAwareThreadLock.__enter__cGs|jj|�S)N)r��__exit__)r_rrrrr�WszForkAwareThreadLock.__exit__N)rirrrsrbr�r�r�rrrrrJsc@s(eZdZdd�Zdd�ZdS)rcCst|dd��dS)NcSs
|jj�S)N)�__dict__r~)rMrrrru]sz)ForkAwareLocal.__init__.<locals>.<lambda>)r)r_rrrrb\szForkAwareLocal.__init__cCst|�ffS)N)�type)r_rrr�
__reduce__^szForkAwareLocal.__reduce__N)rirrrsrbr�rrrrr[s�SC_OPEN_MAX�cCset|�dtg}|j�x>tt|�d�D]&}tj||d||d�q7WdS)Nr���)rE�MAXFDrH�range�lenr[�
closerange)�fds�irrrrjs
cCs�tjdkrdSytjj�Wnttfk
r>YnXyPtjtjtj�}yt|dd�t_Wntj|��YnXWnttfk
r�YnXdS)N�closefdF)	�sys�stdin�close�OSError�
ValueErrorr[�open�devnull�O_RDONLY)�fdrrr�_close_stdints
r�cCs�ddl}tttt|���}tj�\}}zM|j|tj|�gd|ddddddd	d
||ddd�SWdtj	|�tj	|�XdS)NrTrFr�r�r�r�r�r�)
�_posixsubprocess�tuple�sorted�map�intr[�pipe�	fork_exec�fsencoder�)�pathr�passfdsr��errpipe_read�
errpipe_writerrr�spawnv_passfds�s
r�)5r[�	itertoolsr�rSr(r��
subprocessr�r�__all__�NOTSETrrr rr%r0rr5rrrrr	r
r�WeakValueDictionaryrF�countrQrOrr^rY�objectrr�r
r�r�r>r)r*r�localr�sysconfr�rIrr�r�rrrr�<module>
sd		S,	(