AlkantarClanX12

Your IP : 3.144.43.194


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

B

� fl5�@s�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddddd	d
ddd
ddddddgZ
dZdZdZ
dZdZdZdZdadadd�Zdd�Zdd�Zdd�Zdd	�Zd>d d
�Zd!d"�Zd#d$�Ze�Zd%d&�Zd'd�Ze��Z e�!�Z"d(d)�Z#d*d�Z$iZ%e�!�Z&Gd+d�de'�Z(d?d,d-�Z)d.d
�Z*da+eee)e	j,e	j-fd/d0�Z.e�/e.�Gd1d�de'�Z0Gd2d�dej1�Z2ye�3d3�Z4Wne5k
�r�d4Z4YnXd5d�Z6d6d7�Z7d8d9�Z8d:d;�Z9d<d=�Z:dS)@�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|f|��dS)N)�_logger�logr)�msg�args�r�9/opt/alt/python37/lib64/python3.7/multiprocessing/util.pyr,scGstrtjt|f|��dS)N)rr�DEBUG)rrrrrr0scGstrtjt|f|��dS)N)rr�INFO)rrrrrr4scGstrtjt|f|��dS)N)rrr)rrrrrr8scCs|ddl}|��z\tsj|�t�adt_ttd�rFt�t	�t�
t	�n$tj�t	dif�tj�
t	dif�Wd|��XtS)z0
    Returns logger used by multiprocessing
    rN�
unregisterr)�loggingZ_acquireLockrZ	getLogger�LOGGER_NAMEZ	propagate�hasattr�atexitr!�_exit_function�registerZ
_exithandlers�remove�appendZ_releaseLock)r"rrrr	<s



cCsJddl}t�}|�t�}|��}|�|�|�|�|rB|�|�dat	S)zB
    Turn on logging and add a handler which prints to stderr
    rNT)
r"r	Z	Formatter�DEFAULT_LOGGING_FORMATZ
StreamHandlerZsetFormatterZ
addHandlerZsetLevel�_log_to_stderrr)�levelr"ZloggerZ	formatterZhandlerrrrr
Ws



cCs tjdkrdSttd�rdSdS)NZlinuxTZgetandroidapilevelF)�sys�platformr$rrrr�#_platform_supports_abstract_socketsls


r/cCs@|sdSt|t�r|ddkSt|t�r4|ddkStd��dS)NFr�z(address type of {address!r} unrecognized)�
isinstance�bytes�str�	TypeError)Zaddressrrr�is_abstract_socket_namespacets

r5cCs&||�t��}|dk	r"d|jd<dS)N�tempdir)r�current_process�_config)�rmtreer6r7rrr�_remove_temp_dir�sr:cCsft��j�d�}|dkrbddl}ddl}|jdd�}td|�tdt	|j
|fdd�|t��jd<|S)Nr6rzpymp-)�prefixzcreated temp directory %si����)r�exitpriority)rr7r8�get�shutil�tempfileZmkdtemprrr:r9)r6r>r?rrrr�s
cCsjtt���}|��xP|D]H\\}}}}y||�Wqtk
r`}ztd|�Wdd}~XYqXqWdS)Nz after forker raised exception %s)�list�_afterfork_registry�items�sort�	Exceptionr)rB�indexZident�func�obj�errr�_run_after_forkers�srIcCs|ttt�t|�|f<dS)N)rA�next�_afterfork_counter�id)rGrFrrrr�sc@sFeZdZdZddd�Zdeeejfdd�Z	dd	�Z
d
d�Zdd
�ZdS)rzA
    Class which supports object finalization using weakrefs
    rNcCs�|dk	r&t|t�s&td�|t|����|dk	r>t�||�|_n|dkrNtd��||_	||_
|p`i|_|tt
�f|_t��|_|t|j<dS)Nz3Exitpriority ({0!r}) must be None or int, not {1!s}z+Without object, exitpriority cannot be None)r1�intr4�format�type�weakref�ref�_weakref�
ValueError�	_callback�_args�_kwargsrJ�_finalizer_counter�_key�os�getpid�_pid�_finalizer_registry)�selfrG�callbackr�kwargsr<rrr�__init__�s

zFinalize.__init__cCs�y||j=Wntk
r(|d�YnbX|j|�krD|d�d}n$|d|j|j|j�|j|j|j�}d|_|_|_|_|_|SdS)zQ
        Run the callback unless it has already been called or cancelled
        zfinalizer no longer registeredz+finalizer ignored because different processNz/finalizer calling %s with args %s and kwargs %s)rX�KeyErrorr[rTrUrVrR)r]Zwrr\rrZZresrrr�__call__�szFinalize.__call__cCsDyt|j=Wntk
r Yn Xd|_|_|_|_|_dS)z3
        Cancel finalization of the object
        N)r\rXrarRrTrUrV)r]rrr�cancel�s
zFinalize.cancelcCs
|jtkS)zS
        Return whether this finalizer is still waiting to invoke callback
        )rXr\)r]rrr�still_active�szFinalize.still_activec	Cs�y|��}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=�>)rR�AttributeErrorr4�	__class__re�getattrrTrUr3rVrX)r]rG�xrrr�__repr__�s 
zFinalize.__repr__)rNN)
re�
__module__�__qualname__�__doc__r`r\rrYrZrbrcrdrkrrrrr�s
c	s�tdkrdS�dkrdd��n�fdd���fdd�tt�D�}|jdd�xX|D]P}t�|�}|dk	rRtd	|�y
|�WqRtk
r�d
dl}|��YqRXqRW�dkr�t��dS)z�
    Run all finalizers whose exit priority is not None and at least minpriority

    Finalizers with highest priority are called first; finalizers with
    the same priority will be called in reverse order of creation.
    NcSs|ddk	S)Nrr)�prrr�<lambda>�z!_run_finalizers.<locals>.<lambda>cs|ddk	o|d�kS)Nrr)ro)�minpriorityrrrprqcsg|]}�|�r|�qSrr)�.0�key)�frr�
<listcomp>#sz#_run_finalizers.<locals>.<listcomp>T)�reversez
calling %sr)	r\r@rCr=rrD�	traceback�	print_exc�clear)rr�keysrt�	finalizerrxr)rurrr�_run_finalizerss$




r}cCstp
tdkS)z6
    Returns true if the process is shutting down
    N)�_exitingrrrrr
8scCs�ts�da|d�|d�|d�|�dk	rzx*|�D] }|jr2|d|j�|j��q2Wx"|�D]}|d|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~Zdaemon�nameZ_popenZ	terminate�join)rrr}�active_childrenr7rorrrr&@s	
r&c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs|��t|tj�dS)N)�_resetrr)r]rrrr`qszForkAwareThreadLock.__init__cCs"t��|_|jj|_|jj|_dS)N)�	threadingZLock�_lock�acquire�release)r]rrrr�us

zForkAwareThreadLock._resetcCs
|j��S)N)r��	__enter__)r]rrrr�zszForkAwareThreadLock.__enter__cGs|jj|�S)N)r��__exit__)r]rrrrr�}szForkAwareThreadLock.__exit__N)rerlrmr`r�r�r�rrrrrpsc@seZdZdd�Zdd�ZdS)rcCst|dd��dS)NcSs
|j��S)N)�__dict__rz)rGrrrrp�rqz)ForkAwareLocal.__init__.<locals>.<lambda>)r)r]rrrr`�szForkAwareLocal.__init__cCst|�dfS)Nr)rO)r]rrr�
__reduce__�szForkAwareLocal.__reduce__N)rerlrmr`r�rrrrr�s�SC_OPEN_MAX�cCsRt|�dtg}|��x4tt|�d�D] }t�||d||d�q*WdS)N���r)r@�MAXFDrC�range�lenrY�
closerange)Zfds�irrrr�sc	Cs�tjdkrdSytj��Wnttfk
r4YnXy@t�tjtj�}yt|dd�t_Wnt�|��YnXWnttfk
r�YnXdS)NF)�closefd)	r-�stdin�close�OSErrorrSrY�open�devnull�O_RDONLY)�fdrrr�_close_stdin�s

r�c	CsTytj��Wnttfk
r&YnXytj��Wnttfk
rNYnXdS)N)r-�stdout�flushrgrS�stderrrrrr�_flush_std_streams�sr�cCstddl}tttt|���}t��\}}z2|�|t�|�gd|dddddddd||ddd�St�	|�t�	|�XdS)NrTr�F)
�_posixsubprocess�tuple�sorted�maprMrY�pipeZ	fork_exec�fsencoder�)�pathrZpassfdsr�Zerrpipe_readZ
errpipe_writerrr�spawnv_passfds�s

r�cCsDddlm}t��ddlm}|j��t�|�	�|�
�dS)zKCleanup multiprocessing resources when multiprocessing tests
    completed.r)�support)�
forkserverN)Ztestr�rZ_cleanuprr�Z_forkserverZ_stopr}Z
gc_collectZ
reap_children)r�r�rrr�_cleanup_tests�s
r�)N)N);rY�	itertoolsr-rPr%r��
subprocessr�r�__all__ZNOTSETrrr rr#r*rr+rrrrr	r
r/r5Zabstract_sockets_supportedr:rZWeakValueDictionaryrA�countrKrIrr\rW�objectrr}r
r~r�r7r&r'rZlocalr�sysconfr�rDrr�r�r�r�rrrr�<module>
sp



		V
,(