AlkantarClanX12

Your IP : 3.21.159.223


Current Path : /opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/util.cpython-39.pyc

a

R�f�6�@s�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	gd�Z
dZdZdZ
dZd	Zd
ZdZdadad
d�Zdd�Zdd�Zdd�Zdd�Zd?dd�Zdd�Zdd�Ze�Zdd�Zdd �Ze��Z e�!�Z"d!d"�Z#d#d$�Z$iZ%e�!�Z&Gd%d&�d&e'�Z(d@d'd(�Z)d)d*�Z*da+eee)e	j,e	j-fd+d,�Z.e�/e.�Gd-d.�d.e'�Z0Gd/d0�d0ej1�Z2ze�3d1�Z4Wne5�y�d2Z4Yn0d3d4�Z6d5d6�Z7d7d8�Z8d9d:�Z9d;d<�Z:d=d>�Z;dS)A�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|g|�R�dS�N)�_logger�logr��msg�args�r�9/opt/alt/python39/lib64/python3.9/multiprocessing/util.pyr,srcGstrtjt|g|�R�dSr)rr�DEBUGrrrr r0srcGstrtjt|g|�R�dSr)rr�INFOrrrr r4srcGstrtjt|g|�R�dSr)rrrrrrr r8srcCs�ddl}|��zdtsj|�t�adt_ttd�rFt�t	�t�
t	�n$tj�t	dif�tj�
t	dif�W|��n
|��0tS)z0
    Returns logger used by multiprocessing
    rN�
unregisterr)�loggingZ_acquireLockrZ	getLogger�LOGGER_NAMEZ	propagate�hasattr�atexitr#�_exit_function�registerZ
_exithandlers�remove�appendZ_releaseLock)r$rrr r	<s


r	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	formatterZhandlerrrr r
Ws



r
cCs tjdkrdSttd�rdSdS)NZlinuxTZgetandroidapilevelF)�sys�platformr&rrrr �#_platform_supports_abstract_socketsls


r1cCsH|sdSt|t�r|ddkSt|t�r4|ddkStd|�d���dS)NFr�zaddress type of z
 unrecognized)�
isinstance�bytes�str�	TypeError)Zaddressrrr �is_abstract_socket_namespacets

r7cCs&||�t��}|dur"d|jd<dS)N�tempdir)r�current_process�_config)�rmtreer8r9rrr �_remove_temp_dir�sr<cCsft��j�d�}|durbddl}ddl}|jdd�}td|�tdt	|j
|fdd�|t��jd<|S)Nr8rzpymp-)�prefixzcreated temp directory %si����)r�exitpriority)rr9r:�get�shutil�tempfileZmkdtemprrr<r;)r8r@rArrr r�s
�rcCshtt���}|��|D]J\\}}}}z||�Wqty`}ztd|�WYd}~qd}~00qdS)Nz after forker raised exception %s)�list�_afterfork_registry�items�sort�	Exceptionr)rD�indexZident�func�obj�errr �_run_after_forkers�srKcCs|ttt�t|�|f<dSr)rC�next�_afterfork_counter�id)rIrHrrr r�src@sFeZdZdZddd�Zdeeejfdd�Z	dd	�Z
d
d�Zdd
�ZdS)rzA
    Class which supports object finalization using weakrefs
    rNcCs�|dur&t|t�s&td�|t|����|dur>t�||�|_n|durNtd��||_	||_
|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)r3�intr6�format�type�weakref�ref�_weakref�
ValueError�	_callback�_args�_kwargsrL�_finalizer_counter�_key�os�getpid�_pid�_finalizer_registry)�selfrI�callbackr�kwargsr>rrr �__init__�s ��

zFinalize.__init__cCs�z||j=Wnty&|d�Ynf0|j|�krB|d�d}n(|d|j|j|j�|j|ji|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)rZ�KeyErrorr]rVrWrXrT)r_Zwrr^rr\�resrrr �__call__�s��zFinalize.__call__cCsBzt|j=WntyYn 0d|_|_|_|_|_dS)z3
        Cancel finalization of the object
        N)r^rZrcrTrVrWrX�r_rrr �cancel�s��zFinalize.cancelcCs
|jtvS)zS
        Return whether this finalizer is still waiting to invoke callback
        )rZr^rfrrr �still_active�szFinalize.still_activec	Cs�z|��}Wnttfy&d}Yn0|dur<d|jjSd|jjt|jd|j�f}|jrp|dt|j�7}|j	r�|dt|j	�7}|j
ddur�|dt|j
d�7}|dS)	Nz<%s object, dead>z<%s object, callback=%s�__name__z, args=z	, kwargs=rz, exitpriority=�>)rT�AttributeErrorr6�	__class__ri�getattrrVrWr5rXrZ)r_rI�xrrr �__repr__�s"
�zFinalize.__repr__)rNN)
ri�
__module__�__qualname__�__doc__rbr^rr[r\rergrhrorrrr r�s
�
rc	s�tdurdS�durdd��n�fdd���fdd�tt�D�}|jdd�|D]N}t�|�}|durPtd	|�z
|�WqPty�d
dl}|��YqP0qP�dur�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|dduS�Nrr��prrr �<lambda>�z!_run_finalizers.<locals>.<lambda>cs|dduo|d�kSrsrrt)�minpriorityrr rvrwcsg|]}�|�r|�qSrr)�.0�key)�frr �
<listcomp>#rwz#_run_finalizers.<locals>.<listcomp>T)�reversez
calling %sr)	r^rBrEr?rrF�	traceback�	print_exc�clear)rx�keysrz�	finalizerr~r)r{rxr �_run_finalizerss$



r�cCstp
tduS)z6
    Returns true if the process is shutting down
    N)�_exitingrrrr r
8sr
cCs�ts�da|d�|d�|d�|�durr|�D] }|jr0|d|j�|j��q0|�D]}|d|j�|��qX|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_childrenr9rurrr r(@s	



r(c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs.t��|_|jj|_|jj|_t|tj�dSr)�	threadingZLock�_lock�acquire�releaserr�_at_fork_reinitrfrrr rbqs


zForkAwareThreadLock.__init__cCs|j��dSr)r�r�rfrrr r�wsz#ForkAwareThreadLock._at_fork_reinitcCs
|j��Sr)r��	__enter__rfrrr r�zszForkAwareThreadLock.__enter__cGs|jj|�Sr)r��__exit__)r_rrrr r�}szForkAwareThreadLock.__exit__N)rirprqrbr�r�r�rrrr rpsrc@seZdZdd�Zdd�ZdS)rcCst|dd��dS)NcSs
|j��Sr)�__dict__r�)rIrrr rv�rwz)ForkAwareLocal.__init__.<locals>.<lambda>)rrfrrr rb�szForkAwareLocal.__init__cCst|�dfS)Nr)rQrfrrr �
__reduce__�szForkAwareLocal.__reduce__N)rirprqrbr�rrrr r�sr�SC_OPEN_MAX�cCsbt|�dtg}|��|dtks,Jd��tt|�d�D] }t�||d||d�q<dS)N���zfd too larger)rB�MAXFDrE�range�lenr[�
closerange)�fds�irrr r�s
rc	Cs�tjdurdSztj��Wnttfy2Yn0z@t�tjtj�}zt|dd�t_Wnt�|��Yn0Wnttfy�Yn0dS)NF)�closefd)	r/�stdin�close�OSErrorrUr[�open�devnull�O_RDONLY)�fdrrr �_close_stdin�s

r�c	CsPztj��Wnttfy$Yn0ztj��WnttfyJYn0dSr)r/�stdout�flushrkrU�stderrrrrr �_flush_std_streams�sr�cCs�ddl}tttt|���}t��\}}zP|�|t�|�gd|dddddddd||ddddddd�Wt�	|�t�	|�St�	|�t�	|�0dS)NrTr�F)
�_posixsubprocess�tuple�sorted�maprOr[�pipeZ	fork_exec�fsencoder�)�pathrZpassfdsr�Zerrpipe_readZ
errpipe_writerrr �spawnv_passfds�s �

��
r�cGs|D]}t�|�qdS)z/Close each file descriptor given as an argumentN)r[r�)r�r�rrr �	close_fds�sr�cCsZddlm}t��ddlm}|j��ddlm}|j	��t
�|��|��dS)zKCleanup multiprocessing resources when multiprocessing tests
    completed.r)�support)�
forkserver)�resource_trackerN)
�testr�rZ_cleanuprr�Z_forkserverZ_stopr�Z_resource_trackerr�Z
gc_collectZ
reap_children)r�r�r�rrr �_cleanup_tests�s

r�)N)N)<r[�	itertoolsr/rRr'r��
subprocessr�r�__all__ZNOTSETrr!r"rr%r,rr-rrrrr	r
r1r7Zabstract_sockets_supportedr<rZWeakValueDictionaryrC�countrMrKrr^rY�objectrr�r
r�r�r9r(r)rZlocalr�sysconfr�rFrr�r�r�r�r�rrrr �<module>
sn

		V
,�
*