ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/multiprocessing/__pycache__/util.cpython-38.opt-1.pyc

U

.��c~6�@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(dAd,d-�Z)d.d
�Z*da+eee)e	j,e	j-fd/d0�Z.e�/e.�Gd1d�de'�Z0Gd2d�dej1�Z2ze�3d3�Z4Wne5k
�r�d4Z4YnXd5d�Z6d6d7�Z7d8d9�Z8d:d;�Z9d<d=�Z:d>d?�Z;dS)B�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/python38/lib64/python3.8/multiprocessing/util.pyr,scGstrtjt|f|��dSr)rr�DEBUGrrrr r0scGstrtjt|f|��dSr)rr�INFOrrrr r4scGstrtjt|f|��dSr)rrrrrrr r8scCs|ddl}|��z\tsj|�t�adt_ttd�rFt�	t
�t�t
�n$tj�
t
dif�tj�t
dif�W5|��XtS)z0
    Returns logger used by multiprocessing
    rN�
unregisterr)�loggingZ_acquireLockZ_releaseLockrZ	getLogger�LOGGER_NAMEZ	propagate�hasattr�atexitr#�_exit_function�registerZ
_exithandlers�remove�append)r$rrr r	<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	formatterZhandlerrrr r
Ws



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


r1cCs@|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

r7cCs&||�t��}|dk	r"d|jd<dS)N�tempdir)r�current_process�_config)�rmtreer8r9rrr �_remove_temp_dir�sr<cCsft��j�d�}|dkrbddl}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
�cCsftt���}|��|D]H\\}}}}z||�Wqtk
r^}ztd|�W5d}~XYqXqdS)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�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)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=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)rZ�KeyErrorr]rVrWrXrT)r_Zwrr^rr\�resrrr �__call__�s$��zFinalize.__call__cCsDzt|j=Wntk
r Yn Xd|_|_|_|_|_dS)z3
        Cancel finalization of the object
        N)r^rZrcrTrVrWrX�r_rrr �cancel�s��zFinalize.cancelcCs
|jtkS)zS
        Return whether this finalizer is still waiting to invoke callback
        )rZr^rfrrr �still_active�szFinalize.still_activec	Cs�z|��}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, exitpriority=�>)rT�AttributeErrorr6�	__class__ri�getattrrVrWr5rXrZ)r_rI�xrrr �__repr__�s"
�zFinalize.__repr__)rNN)
ri�
__module__�__qualname__�__doc__rbr^rr[r\rergrhrorrrr r�s
�
c	s�tdkrdS�dkrdd��n�fdd���fdd�tt�D�}|jdd�|D]P}t�|�}|dk	rPtd	|�z
|�WqPtk
r�d
dl}|��YqPXqP�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�kSrsrrt)�minpriorityrr rvrwcsg|]}�|�r|�qSrr)�.0�key)�frr �
<listcomp>#sz#_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
tdkS)z6
    Returns true if the process is shutting down
    N)�_exitingrrrr r
8scCs�ts�da|d�|d�|d�|�dk	rr|�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|tj�dSr)�_resetrrrfrrr rbqszForkAwareThreadLock.__init__cCs"t��|_|jj|_|jj|_dSr)�	threadingZLock�_lock�acquire�releaserfrrr r�us

zForkAwareThreadLock._resetcCs
|j��Sr)r��	__enter__rfrrr r�zszForkAwareThreadLock.__enter__cGs|jj|�Sr)r��__exit__)r_rrrr r�}szForkAwareThreadLock.__exit__N)rirprqrbr�r�r�rrrr rpsc@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�s�SC_OPEN_MAX�cCsNt|�dtg}|��tt|�d�D] }t�||d||d�q(dS)N���r)rB�MAXFDrE�range�lenr[�
closerange)�fds�irrr r�sc	Cs�tjdkrdSztj��Wnttfk
r4YnXz@t�tjtj�}zt|dd�t_Wnt�|��YnXWnttfk
r�YnXdS)NF)�closefd)	r/�stdin�close�OSErrorrUr[�open�devnull�O_RDONLY)�fdrrr �_close_stdin�s

r�c	CsTztj��Wnttfk
r&YnXztj��Wnttfk
rNYnXdSr)r/�stdout�flushrkrU�stderrrrrr �_flush_std_streams�sr�cCsxddl}tttt|���}t��\}}z6|�|t�	|�gd|dddddddd||ddd�W�St�|�t�|�XdS)NrTr�F)
�_posixsubprocess�tuple�sorted�maprOr[�piper�Z	fork_exec�fsencode)�pathrZpassfdsr�Zerrpipe_readZ
errpipe_writerrr �spawnv_passfds�s2
�
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)
Ztestr�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>
s��

		V
,�
*





Zerion Mini Shell 1.0