AlkantarClanX12

Your IP : 18.188.63.71


Current Path : /opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/util.cpython-310.opt-1.pyc

o

6��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�Z4Wne5y�d2Z4Ynwd3d4�Z6d5d6�Z7d7d8�Z8d9d:�Z9d;d<�Z:d=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)sFcG� trtjt|g|�R�dSdS�N)�_logger�logr��msg�args�r �;/opt/alt/python310/lib64/python3.10/multiprocessing/util.pyr,��rcGrr)rr�DEBUGrr r r!r0r"rcGrr)rr�INFOrr r r!r4r"rcGrr)rrrrr r r!r8r"rcCs�ddl}|��zAts<|�t�adt_ttd�r#t�t	�t�
t	�n tj�t	dif�tj�
t	dif�W|��tSW|��tSW|��tS|��w)z0
    Returns logger used by multiprocessing
    rN�
unregisterr )�loggingZ_acquireLockrZ	getLogger�LOGGER_NAMEZ	propagate�hasattr�atexitr%�_exit_function�registerZ
_exithandlers�remove�appendZ_releaseLock)r&r r r!r	<s(


��
�r	cCsJddl}t�}|�t�}|��}|�|�|�|�|r!|�|�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	formatterZhandlerr r r!r
Ws



r
cCs tjdkrdSttd�rdSdS)NZlinuxTZgetandroidapilevelF)�sys�platformr(r r r r!�#_platform_supports_abstract_socketsls


r3cCsD|sdSt|t�r|ddkSt|t�r|ddkStd|�d���)NFr�zaddress type of z
 unrecognized)�
isinstance�bytes�str�	TypeError)Zaddressr r r!�is_abstract_socket_namespacets

r9cCs*||�t��}|durd|jd<dSdS)N�tempdir)r�current_process�_config)�rmtreer:r;r r r!�_remove_temp_dir�s
�r>cCsft��j�d�}|dur1ddl}ddl}|jdd�}td|�tdt	|j
|fdd�|t��jd<|S)Nr:rzpymp-)�prefixzcreated temp directory %si����)r�exitpriority)rr;r<�get�shutil�tempfileZmkdtemprrr>r=)r:rBrCr r r!r�s
�rcCsftt���}|��|D]$\\}}}}z||�Wqty0}ztd|�WYd}~qd}~wwdS)Nz after forker raised exception %s)�list�_afterfork_registry�items�sort�	Exceptionr)rF�indexZident�func�obj�er r r!�_run_after_forkers�s���rMcCs|ttt�t|�|f<dSr)rE�next�_afterfork_counter�id)rKrJr r r!r�src@sFeZdZdZddd�Zdeeejfdd�Z	dd	�Z
d
d�Zdd
�ZdS)rzA
    Class which supports object finalization using weakrefs
    r NcCs�|durt|t�std�|t|����|durt�||�|_n|dur'td��||_	||_
|p0i|_|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)r5�intr8�format�type�weakref�ref�_weakref�
ValueError�	_callback�_args�_kwargsrN�_finalizer_counter�_key�os�getpid�_pid�_finalizer_registry)�selfrK�callbackr�kwargsr@r r r!�__init__�s ��

zFinalize.__init__cCs�z||j=Wnty|d�YdSw|j|�kr"|d�d}n|d|j|j|j�|j|ji|j��}d|_|_|_|_|_|S)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)r\�KeyErrorr_rXrYrZrV)raZwrr`rr^�resr r r!�__call__�s ���zFinalize.__call__cCsDzt|j=Wn
tyYdSwd|_|_|_|_|_dS)z3
        Cancel finalization of the object
        N)r`r\rerVrXrYrZ�rar r r!�cancel�s��zFinalize.cancelcCs
|jtvS)zS
        Return whether this finalizer is still waiting to invoke callback
        )r\r`rhr r r!�still_active�s
zFinalize.still_activec	Cs�z|��}Wn
ttfyd}Ynw|durd|jjSd|jjt|jd|j�f}|jr8|dt|j�7}|j	rD|dt|j	�7}|j
ddurV|dt|j
d�7}|dS)	Nz<%s object, dead>z<%s object, callback=%s�__name__z, args=z	, kwargs=rz, exitpriority=�>)rV�AttributeErrorr8�	__class__rk�getattrrXrYr7rZr\)rarK�xr r r!�__repr__�s$��zFinalize.__repr__)r NN)
rk�
__module__�__qualname__�__doc__rdr`rr]r^rgrirjrqr r r r!r�s

�rc	s�tdurdS�durdd��n�fdd���fdd�tt�D�}|jdd�|D]'}t�|�}|durOtd	|�z|�Wq(tyNd
dl}|��Yq(wq(�durZt��dSdS)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 ��pr r r!�<lambda>sz!_run_finalizers.<locals>.<lambda>cs|dduo|d�kSrur rv)�minpriorityr r!rx�csg|]}�|�r|�qSr r )�.0�key)�fr r!�
<listcomp>#rzz#_run_finalizers.<locals>.<listcomp>T)�reversez
calling %sr)	r`rDrGrArrH�	traceback�	print_exc�clear)ry�keysr|�	finalizerr�r )r}ryr!�_run_finalizerss*



���r�cCstptduS)z6
    Returns true if the process is shutting down
    N)�_exitingr r r r!r
8sr
cCs�tsBda|d�|d�|d�|�dur9|�D]}|jr(|d|j�|j��q|�D]}|d|j�|��q,|d�|�dSdS)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_childrenr;rwr r r!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_reinitrhr r r!rdqs


zForkAwareThreadLock.__init__cCs|j��dSr)r�r�rhr r r!r�wsz#ForkAwareThreadLock._at_fork_reinitcC�
|j��Sr)r��	__enter__rhr r r!r�zs
zForkAwareThreadLock.__enter__cGs|jj|�Sr)r��__exit__)rarr r r!r�}�zForkAwareThreadLock.__exit__N)rkrrrsrdr�r�r�r r r r!rps
rc@seZdZdd�Zdd�ZdS)rcCst|dd��dS)NcSr�r)�__dict__r�)rKr r r!rx�s
z)ForkAwareLocal.__init__.<locals>.<lambda>)rrhr r r!rd�szForkAwareLocal.__init__cCst|�dfS)Nr )rSrhr r r!�
__reduce__�r�zForkAwareLocal.__reduce__N)rkrrrsrdr�r r r r!r�sr�SC_OPEN_MAX�cCsNt|�dtg}|��tt|�d�D]}t�||d||d�qdS)N���r)rD�MAXFDrG�range�lenr]�
closerange)�fds�ir r r!r�s
�rc	Cs�tjdurdSztj��WnttfyYnwzt�tjtj�}zt|ddd�t_WWdSt�|��ttfyDYdSw)Nzutf-8F)�encoding�closefd)	r1�stdin�close�OSErrorrWr]�open�devnull�O_RDONLY)�fdr r r!�_close_stdin�s"
�
�r�c	CsPztj��WnttfyYnwztj��WdSttfy'YdSwr)r1�stdout�flushrmrW�stderrr r r r!�_flush_std_streams�s��r�cCs�ddl}tttt|���}t��\}}z(|�|t�|�gd|dddddddd||ddddddd�Wt�	|�t�	|�St�	|�t�	|�w)NrTr�F)
�_posixsubprocess�tuple�sorted�maprQr]�pipeZ	fork_exec�fsencoder�)�pathrZpassfdsr�Zerrpipe_readZ
errpipe_writer r r!�spawnv_passfds�s�

�r�cGs|D]}t�|�qdS)z/Close each file descriptor given as an argumentN)r]r�)r�r�r r r!�	close_fds�s�r�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�r r r!�_cleanup_tests�s

r�r)<r]�	itertoolsr1rTr)r��
subprocessr�r�__all__ZNOTSETrr#r$rr'r.rr/rrrrr	r
r3r9Zabstract_sockets_supportedr>rZWeakValueDictionaryrE�countrOrMrr`r[�objectrr�r
r�r�r;r*r+rZlocalr�sysconfr�rHrr�r�r�r�r�r r r r!�<module>sr	

		
V,
�
*
�