Mini Shell

Direktori : /proc/self/root/lib64/python3.9/multiprocessing/__pycache__/
Upload File :
Current File : //proc/self/root/lib64/python3.9/multiprocessing/__pycache__/util.cpython-39.pyc

a

�DOg�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�,/usr/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)�logging�_acquireLockr�	getLogger�LOGGER_NAME�	propagate�hasattr�atexitr#�_exit_function�register�
_exithandlers�remove�append�_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	�	Formatter�DEFAULT_LOGGING_FORMAT�
StreamHandler�setFormatter�
addHandler�setLevel�_log_to_stderrr)�levelr$�logger�	formatter�handlerrrr r
Ws



r
cCs tjdkrdSttd�rdSdS)N�linuxT�getandroidapilevelF)�sys�platformr)rrrr �#_platform_supports_abstract_socketsls


r@cCsH|sdSt|t�r|ddkSt|t�r4|ddkStd|�d���dS)NFr�zaddress type of z
 unrecognized)�
isinstance�bytes�str�	TypeError)�addressrrr �is_abstract_socket_namespacets

rGcCs&||�t��}|dur"d|jd<dS)N�tempdir)r�current_process�_config)�rmtreerHrIrrr �_remove_temp_dir�srLcCsft��j�d�}|durbddl}ddl}|jdd�}td|�tdt	|j
|fdd�|t��jd<|S)NrHrzpymp-)�prefixzcreated temp directory %si����)r�exitpriority)rrIrJ�get�shutil�tempfile�mkdtemprrrLrK)rHrPrQrrr r�s
�rcCshtt���}|��|D]J\\}}}}z||�Wqty`}ztd|�WYd}~qd}~00qdS)Nz after forker raised exception %s)�list�_afterfork_registry�items�sort�	Exceptionr)rU�index�ident�func�obj�errr �_run_after_forkers�sr]cCs|ttt�t|�|f<dSr)rT�next�_afterfork_counter�id)r[rZrrr 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)rB�intrE�format�type�weakref�ref�_weakref�
ValueError�	_callback�_args�_kwargsr^�_finalizer_counter�_key�os�getpid�_pid�_finalizer_registry)�selfr[�callbackr�kwargsrNrrr �__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)rl�KeyErrorrorhrirjrf)rq�wrrprrn�resrrr �__call__�s��zFinalize.__call__cCsBzt|j=WntyYn 0d|_|_|_|_|_dS)z3
        Cancel finalization of the object
        N)rprlrurfrhrirj�rqrrr �cancel�s��zFinalize.cancelcCs
|jtvS)zS
        Return whether this finalizer is still waiting to invoke callback
        )rlrpryrrr �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=�>)rf�AttributeErrorrE�	__class__r|�getattrrhrirDrjrl)rqr[�xrrr �__repr__�s"
�zFinalize.__repr__)rNN)
r|�
__module__�__qualname__�__doc__rtrprrmrnrxrzr{r�rrrr 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�kSr�rr�)�minpriorityrr r�r�csg|]}�|�r|�qSrr)�.0�key)�frr �
<listcomp>#r�z#_run_finalizers.<locals>.<listcomp>T)�reversez
calling %sr)	rprSrVrOrrW�	traceback�	print_exc�clear)r��keysr��	finalizerr�r)r�r�r �_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��daemon�name�_popen�	terminate�join)rrr��active_childrenrIr�rrr r+@s	



r+c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs.t��|_|jj|_|jj|_t|tj�dSr)�	threading�Lock�_lock�acquire�releaserr�_at_fork_reinitryrrr rtqs


zForkAwareThreadLock.__init__cCs|j��dSr)r�r�ryrrr r�wsz#ForkAwareThreadLock._at_fork_reinitcCs
|j��Sr)r��	__enter__ryrrr r�zszForkAwareThreadLock.__enter__cGs|jj|�Sr)r��__exit__)rqrrrr r�}szForkAwareThreadLock.__exit__N)r|r�r�rtr�r�r�rrrr rpsrc@seZdZdd�Zdd�ZdS)rcCst|dd��dS)NcSs
|j��Sr)�__dict__r�)r[rrr r��r�z)ForkAwareLocal.__init__.<locals>.<lambda>)rryrrr rt�szForkAwareLocal.__init__cCst|�dfS)Nr)rcryrrr �
__reduce__�szForkAwareLocal.__reduce__N)r|r�r�rtr�rrrr r�sr�SC_OPEN_MAX�cCsbt|�dtg}|��|dtks,Jd��tt|�d�D] }t�||d||d�q<dS)N���zfd too larger)rS�MAXFDrV�range�lenrm�
closerange)�fds�irrr r�s
rc	Cs�tjdurdSztj��Wnttfy2Yn0z@t�tjtj�}zt|dd�t_Wnt�|��Yn0Wnttfy�Yn0dS)NF)�closefd)	r>�stdin�close�OSErrorrgrm�open�devnull�O_RDONLY)�fdrrr �_close_stdin�s

r�c	CsPztj��Wnttfy$Yn0ztj��WnttfyJYn0dSr)r>�stdout�flushr~rg�stderrrrrr �_flush_std_streams�sr�cCs�ddl}tttt|���}t��\}}zP|�|t�|�gd|dddddddd||ddddddd�Wt�	|�t�	|�St�	|�t�	|�0dS)NrTr�F)
�_posixsubprocess�tuple�sorted�maprarm�pipe�	fork_exec�fsencoder�)�pathr�passfdsr��errpipe_read�
errpipe_writerrr �spawnv_passfds�s �

��
r�cGs|D]}t�|�qdS)z/Close each file descriptor given as an argumentN)rmr�)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�r�_cleanuprr��_forkserver�_stopr��_resource_trackerr��
gc_collect�
reap_children)r�r�r�rrr �_cleanup_tests�s

r�)N)N)<rm�	itertoolsr>rdr*r��
subprocessr�r�__all__�NOTSETrr!r"rr'r2rr7rrrrr	r
r@rG�abstract_sockets_supportedrLr�WeakValueDictionaryrT�countr_r]rrprk�objectrr�r
r�r�rIr+r,r�localr�sysconfr�rWrr�r�r�r�r�rrrr �<module>
sn

		V
,�
*





Zerion Mini Shell 1.0