AlkantarClanX12

Your IP : 18.224.63.123


Current Path : /opt/alt/python311/lib64/python3.11/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/multiprocessing/__pycache__/util.cpython-311.pyc

�

c��f�7��N�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	gd�Z
dZdZdZ
dZd	Zd
ZdZdadad
�Zd�Zd�Zd�Zd�Zd*d�Zd�Zd�Ze��Zd�Zd�Zej��Z ej!��Z"d�Z#d�Z$iZ%ej!��Z&Gd�de'��Z(d*d�Z)d�Z*da+eee)e	j,e	j-fd�Z.ej/e.��Gd�de'��Z0Gd �d!ej1��Z2	ej3d"��Z4n
#e5$rd#Z4YnwxYwd$�Z6d%�Z7d&�Z8d'�Z9d(�Z: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)sFc�N�trtjt|g|�Rddi�dSdS�N�
stacklevel�)�_logger�logr��msg�argss  �;/opt/alt/python311/lib64/python3.11/multiprocessing/util.pyrr,s<���8���H�c�7�D�7�7�7�Q�7�7�7�7�7�8�8�c�N�trtjt|g|�Rddi�dSdSr)rr�DEBUGr s  r#rr0s<���5���E�3�4��4�4�4�!�4�4�4�4�4�5�5r$c�N�trtjt|g|�Rddi�dSdSr)rr�INFOr s  r#rr4s<���4���D�#�3��3�3�3��3�3�3�3�3�4�4r$c�N�trtjt|g|�Rddi�dSdSr)rrrr s  r#r	r	8s<���:���J��9�d�9�9�9�q�9�9�9�9�9�:�:r$c�$�ddl}|���	ts�|�t��adt_t
td��r3tjt��tj
t��nNtj�tdif��tj�
tdif��|���n#|���wxYwtS)z0
    Returns logger used by multiprocessing
    rN�
unregister�)�logging�_acquireLockr�	getLogger�LOGGER_NAME�	propagate�hasattr�atexitr+�_exit_function�register�
_exithandlers�remove�append�_releaseLock)r-s r#r
r
<s���
�N�N�N���������	F��'�'��4�4�G� !�G���v�|�,�,�
F��!�.�1�1�1����/�/�/�/��$�+�+�^�R��,D�E�E�E��$�+�+�^�R��,D�E�E�E�	�������������������Ns�CC2�2Dc��ddl}t��}|�t��}|���}|�|��|�|��|r|�|��datS)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�handlers     r#rrWs���
�N�N�N�
�\�\�F��!�!�"8�9�9�I��#�#�%�%�G�����#�#�#�
���g��������������N��Nr$c�X�tjdkrdSttd��rdSdS)N�linuxT�getandroidapilevelF)�sys�platformr2r,r$r#�#_platform_supports_abstract_socketsrKls1��
�|�w����t��s�(�)�)���t��5r$c��|sdSt|t��r|ddkSt|t��r|ddkStd|�d����)NFr�zaddress type of z
 unrecognized)�
isinstance�bytes�str�	TypeError)�addresss r#�is_abstract_socket_namespacerStsj�����u��'�5�!�!�"��q�z�Q���	�G�S�	!�	!�"��q�z�T�!�!�
�?�w�?�?�?�
@�
@�@r$c�h�d�}|||���tj��}|�d|jd<dSdS)Nc�>�t|dt��s�dS�Nr)�
issubclass�FileNotFoundError)�func�path�err_infos   r#�onerrorz!_remove_temp_dir.<locals>.onerror�s&���(�1�+�'8�9�9�	��	�	r$)r\�tempdir)r�current_process�_config)�rmtreer]r\r^s    r#�_remove_temp_dirra�sY������F�7�G�$�$�$�$��-�/�/�O��"�-1���	�*�*�*�#�"r$c�0�tj��j�d��}|�hddl}ddl}|�d���}td|��tdt|j
|fd���|tj��jd<|S)Nr]rzpymp-)�prefixzcreated temp directory %si����)r"�exitpriority)rr^r_�get�shutil�tempfile�mkdtemprrrar`)r]rfrgs   r#rr�s����%�'�'�/�3�3�I�>�>�G������������"�"�'�"�2�2���
(�'�2�2�2�	��'�v�}�g�.F�"�	$�	$�	$�	$�7>���!�!�)�)�4��Nr$c��tt�����}|���|D]<\\}}}}	||���#t$r}td|��Yd}~�5d}~wwxYwdS)Nz after forker raised exception %s)�list�_afterfork_registry�items�sort�	Exceptionr)rl�index�identrY�obj�es      r#�_run_after_forkersrs�s����$�*�*�,�,�-�-�E�	�J�J�L�L�L�%*�8�8�!����t�c�	8��D��I�I�I�I���	8�	8�	8��3�Q�7�7�7�7�7�7�7�7�����	8����8�8s�A�
A7�A2�2A7c�^�|ttt��t|��|f<dS�N)rk�next�_afterfork_counter�id)rqrYs  r#r
r
�s)��EH���0�1�1�2�c�7�7�D�A�B�B�Br$c�F�eZdZdZd	d�Zdeeejfd�Z	d�Z
d�Zd�ZdS)
rzA
    Class which supports object finalization using weakrefs
    r,Nc��|�Et|t��s0td�|t	|�������|�tj||��|_n|�td���||_	||_
|pi|_|tt��f|_tj��|_|t$|j<dS)Nz3Exitpriority ({0!r}) must be None or int, not {1!s}z+Without object, exitpriority cannot be None)rN�intrQ�format�type�weakref�ref�_weakref�
ValueError�	_callback�_args�_kwargsrv�_finalizer_counter�_key�os�getpid�_pid�_finalizer_registry)�selfrq�callbackr"�kwargsrds      r#�__init__zFinalize.__init__�s����$�j��c�.J�.J�$��E�L�L� �$�|�"4�"4�6�6�7�7�
7��?�#�K��T�2�2�D�M�M�
�
!��J�K�K�K�!�����
��|����!�4�(:�#;�#;�<��	��I�K�K��	�)-��D�I�&�&�&r$c�@�	||j=|j|��kr|d��d}n4|d|j|j|j��|j|ji|j��}dx|_x|_x|_x|_|_|S#t$r|d��YdSwxYw)zQ
        Run the callback unless it has already been called or cancelled
        z+finalizer ignored because different processNz/finalizer calling %s with args %s and kwargs %szfinalizer no longer registered)r�r�r�r�r�r��KeyError)r��wrr�rr��ress      r#�__call__zFinalize.__call__�s���	�#�D�I�.��y�F�F�H�H�$�$��	�G�H�H�H�����	�K��.�$�*�d�l�D�D�D�$�d�n�d�j�A�D�L�A�A��7;�
<�D�M�
<�D�N�
<�T�Z�
<� �L�4�9��J���	8�	8�	8��I�6�7�7�7�7�7�7�	8���s�B�B�Bc��	t|j=dx|_x|_x|_x|_|_dS#t$rYdSwxYw)z3
        Cancel finalization of the object
        N)r�r�r�r�r�r�r��r�s r#�cancelzFinalize.cancel�sg��	<�#�D�I�.�
8<�
<�D�M�
<�D�N�
<�T�Z�
<� �L�4�9�9�9��	�	�	�	��D�D�	���s�
4�
A�Ac��|jtvS)zS
        Return whether this finalizer is still waiting to invoke callback
        )r�r�r�s r#�still_activezFinalize.still_active�s���y�/�/�/r$c��	|���}n#ttf$rd}YnwxYw|�d|jjzSd|jj�dt|jd|j����}|jr|dt|j��zz
}|j	r|dt|j	��zz
}|j
d� |dt|j
d��zz
}|d	zS)
Nz<%s object, dead>�<z object, callback=�__name__z, args=z	, kwargs=rz, exitpriority=�>)r��AttributeErrorrQ�	__class__r��getattrr�r�rPr�r�)r�rq�xs   r#�__repr__zFinalize.__repr__�s��	��-�-�/�/�C�C���	�*�	�	�	��C�C�C�	�����;�&���)@�@�@����'�'�'����
�D�N�C�C�C�
E���:�	-�
��S���_�_�,�,�A��<�	1�
��s�4�<�0�0�0�0�A��9�Q�<�#�
�"�S���1��%6�%6�6�6�A��3�w�s��-�-)r,NN)
r��
__module__�__qualname__�__doc__r�r�rr�r�r�r�r�r�r,r$r#rr�s���������.�.�.�.�&�&9�$�R�Y�	����0
<�
<�
<�0�0�0�����r$rc����t�dS��d��n�fd���fd�tt��D��}|�d���|D]b}t�|��}|�Dt	d|��	|���:#t
$rddl}|���Y�^wxYw�c��t���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.
    Nc��|dduSrVr,)�ps r#�<lambda>z!_run_finalizers.<locals>.<lambda>s��q��t�4�'�r$c�0��|dduo|d�kSrVr,)r��minprioritys �r#r�z!_run_finalizers.<locals>.<lambda>s���q��t�4�'�?�A�a�D�K�,?�r$c�*��g|]}�|���
|��Sr,r,)�.0�key�fs  �r#�
<listcomp>z#_run_finalizers.<locals>.<listcomp>&s&���?�?�?�C���#���?�C�?�?�?r$T)�reversez
calling %sr)	r�rjrmrerrn�	traceback�	print_exc�clear)r��keysr��	finalizerr�r�s`    @r#�_run_finalizersr�s �����"�	����'�'���?�?�?�?��@�?�?�?�4� 3�4�4�?�?�?�D��I�I�d�I�����	&�	&��'�+�+�C�0�0�	�� ��l�I�.�.�.�
&��	�������
&�
&�
&� � � � ��#�#�%�%�%�%�%�
&����	!����!�!�#�#�#�#�#��s�>
B	�	"B.�-B.c�"�tptduS)z6
    Returns true if the process is shutting down
    N)�_exitingr,r$r#rr;s���'�x�4�'�'r$c�|�ts�da|d��|d��|d��|���p|��D]3}|jr*|d|j��|j����4|��D]'}|d|j��|����(|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��daemon�name�_popen�	terminate�join)rrr��active_childrenr^r�s      r#r4r4Cs��������
$�%�%�%�
��B�C�C�C��������?���(�%�_�&�&�
)�
)���8�)��D�<�a�f�E�E�E��H�&�&�(�(�(��$�_�&�&�
�
����4�a�f�=�=�=��������
��9�:�:�:��������?�r$c�&�eZdZd�Zd�Zd�Zd�ZdS)rc��tj��|_|jj|_|jj|_t|tj��dSru)�	threading�Lock�_lock�acquire�releaser
r�_at_fork_reinitr�s r#r�zForkAwareThreadLock.__init__tsC���^�%�%��
��z�)����z�)����D�"5�"E�F�F�F�F�Fr$c�8�|j���dSru)r�r�r�s r#r�z#ForkAwareThreadLock._at_fork_reinitzs���
�"�"�$�$�$�$�$r$c�4�|j���Sru)r��	__enter__r�s r#r�zForkAwareThreadLock.__enter__}s���z�#�#�%�%�%r$c� �|jj|�Sru)r��__exit__)r�r"s  r#r�zForkAwareThreadLock.__exit__�s��"�t�z�"�D�)�)r$N)r�r�r�r�r�r�r�r,r$r#rrssS������G�G�G�%�%�%�&�&�&�*�*�*�*�*r$rc��eZdZd�Zd�ZdS)rc�(�t|d���dS)Nc�4�|j���Sru)�__dict__r�)rqs r#r�z)ForkAwareLocal.__init__.<locals>.<lambda>�s��s�|�/A�/A�/C�/C�r$)r
r�s r#r�zForkAwareLocal.__init__�s���D�"C�"C�D�D�D�D�Dr$c�$�t|��dfS)Nr,)r}r�s r#�
__reduce__zForkAwareLocal.__reduce__�s���D�z�z�2�~�r$N)r�r�r�r�r�r,r$r#rr�s5������E�E�E�����r$r�SC_OPEN_MAX�c�(�t|��dtgz}|���|dtks
Jd���tt	|��dz
��D])}tj||dz||dz���*dS)N���zfd too larger)rj�MAXFDrm�range�lenr��
closerange)�fds�is  r#rr�s���
�s�)�)�r�5�k�
!�C��H�H�J�J�J��r�7�e����^����
�3�s�8�8�a�<�
 �
 �*�*��
�
�c�!�f�Q�h��A�a�C��)�)�)�)�*�*r$c��tj�dS	tj���n#ttf$rYnwxYw	tjt
jt
j��}	t
|dd���t_dS#tj|���xYw#ttf$rYdSwxYw)Nzutf-8F)�encoding�closefd)	rI�stdin�close�OSErrorr�r��open�devnull�O_RDONLY)�fds r#�_close_stdinr��s���
�y����
��	���������Z� �
�
�
���
����
�
�W�R�Z���
-�
-��	��R�'�5�A�A�A�C�I�I�I��	��H�R�L�L�L�������Z� �
�
�
����
���s3�/�A�A�)B)�1B�B&�&B)�)B>�=B>c���	tj���n#ttf$rYnwxYw	tj���dS#ttf$rYdSwxYwru)rI�stdout�flushr�r��stderrr,r$r#�_flush_std_streamsr��s���
��
���������J�'�
�
�
���
����
��
����������J�'�
�
�
����
���s�!�5�5�A�A.�-A.c��ddl}ddl}ttt	t
|������}t
j��\}}	|�||gd|dddddddd||dddddddd|j	��t
j
|��t
j
|��S#t
j
|��t
j
|��wxYw)NrTr�F)�_posixsubprocess�
subprocess�tuple�sorted�mapr{r��pipe�	fork_exec�
_USE_VFORKr�)rZr"�passfdsr�r��errpipe_read�
errpipe_writes       r#�spawnv_passfdsr��s������������F�3�s�G�,�,�-�-�.�.�G�"$�'�)�)��L�-� ��)�)��4�&�$���t���B��B��L�-��5�"�d�D�$��D��!�	#�#�	������
��������	������
���������s�0B(�(*Cc�8�|D]}tj|���dS)z/Close each file descriptor given as an argumentN)r�r�)r�r�s  r#�	close_fdsr��s*������
��������r$c� �ddlm}tj��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�s   r#�_cleanup_testsr�s��������������+�*�*�*�*�*��� � �"�"�"�1�0�0�0�0�0��&�,�,�.�.�.������������������r$ru)<r��	itertoolsrIr~r3r�r�r�r�__all__�NOTSETrr&r(rr0r<rrArrrr	r
rrKrS�abstract_sockets_supportedrar�WeakValueDictionaryrk�countrwrsr
r�r��objectrr�rr�r�r^r4r5r�localr�sysconfr�rnrr�r�r�r�rr,r$r#�<module>rsD��
�	�	�	�����
�
�
�
�����
�
�
�
�����3�3�3�3�3�3�����������
����
��	��
�
���F��
����8�8�8�5�5�5�4�4�4�:�:�:����6����*���A�A�A�A�@�B�B��
2�
2�
2����$2�g�1�3�3��$�Y�_�&�&��8�8�8�I�I�I���$�Y�_�&�&��S�S�S�S�S�v�S�S�S�l&$�&$�&$�&$�X(�(�(����E�?�#*�#:�#*�#:�(�(�(�(�T�������*�*�*�*�*�&�*�*�*�"�����Y�_������B�J�}�%�%�E�E�������E�E�E�����*�*�*�
�
�
�.
�
�
�
 �
 �
 � �������s�5D�D�D