Your IP : 52.15.92.58


Current Path : /opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/reduction.cpython-312.pyc

�

�Q�f(%��f�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
gd�Zejdk(xs)e
ed�xre
ed�xre
ejd	�ZGd
�dej�Zej"Zd)d�Zejdk(r'egd
�z
ZddlZd*dd�d�Zd�Zd�Zd�ZGd�de�Zn)egd�z
ZddlZejdk(Zd�Zd�Zd�Zd�Zd�Zd�ZGd�d�Z ee!e �jD�e�d�Z#ee!e$jJ�e#�ee!e&jN�e#�d �Z(d!�Z)eejTe(�ejdk(rd"�Z+d#�Z,eeje+�nd$�Z+d%�Z,eeje+�Gd&�d'e�(�Z-y)+�)�ABCMetaN�)�context)�send_handle�recv_handle�ForkingPickler�register�dump�win32�CMSG_LEN�
SCM_RIGHTS�sendmsgc�x��eZdZdZiZejZ�fd�Ze	d��Z
e	dd��ZejZ
�xZS)rz)Pickler subclass used by multiprocessing.c���t�|�|�|jj�|_|jj|j�y�N)�super�__init__�_copyreg_dispatch_table�copy�dispatch_table�update�_extra_reducers)�self�args�	__class__s  ��@/opt/alt/python312/lib64/python3.12/multiprocessing/reduction.pyrzForkingPickler.__init__&sA���
���$��"�:�:�?�?�A������"�"�4�#7�#7�8�c�"�||j|<y)z&Register a reduce function for a type.N)r)�cls�type�reduces   rr	zForkingPickler.register+s��%+����D�!rc�z�tj�}|||�j|�|j�Sr)�io�BytesIOr
�	getbuffer)r�obj�protocol�bufs    r�dumpszForkingPickler.dumps0s.���j�j�l���C������$��}�}��rr)�__name__�
__module__�__qualname__�__doc__r�copyregrrr�classmethodr	r)�pickle�loads�
__classcell__)rs@rrr!sO���3��O�%�4�4��9�
�+��+�����

�L�L�Errc�:�t||�j|�y)z3Replacement for pickle.dump() using ForkingPickler.N)rr
)r&�filer's   rr
r
:s���4��"�'�'��,r)�	DupHandle�	duplicate�steal_handle)�source_processc��tj�}|�|}|�|}tj|||d|tj�S)z<Duplicate a handle.  (target_process is a handle not a pid!)r)�_winapi�GetCurrentProcess�DuplicateHandle�DUPLICATE_SAME_ACCESS)�handle�target_process�inheritabler8�current_processs     rr6r6GsO��"�3�3�5���!�,�N��!�,�N��&�&��F�N�
�{�G�9�9�;�	;rc	�B�tjtjd|�}	tj||tj�ddtj
tjz�tj|�S#tj|�wxYw)z5Steal a handle from process identified by source_pid.Fr)r:�OpenProcess�PROCESS_DUP_HANDLEr<r;r=�DUPLICATE_CLOSE_SOURCE�CloseHandle)�
source_pidr>�source_process_handles   rr7r7Ss~�� '� 3� 3��&�&��z�!;��	7��*�*�%�v��)�)�+�Q���-�-��0N�0N�N�P�

��� 5�6��G��� 5�6�s�A
B�Bc�\�t|tj|�}|j|�y�z&Send a handle over a local connection.N)r5r:r=�send)�connr>�destination_pid�dhs    rrr_s!��
�v�w�<�<�o�
N���	�	�"�
rc�>�|j�j�S)�)Receive a handle over a local connection.)�recv�detach)rLs rrrds���y�y�{�!�!�#�#rc��eZdZdZdd�Zd�Zy)r5zPicklable wrapper for a handle.Nc�X�|�tj�}tjtjd|�}	tj
tj�|||dd�|_tj|�||_	||_
y#tj|�wxYw)NFr)�os�getpidr:rCrDr<r;�_handlerF�_access�_pid)rr>�access�pid�procs     rrzDupHandle.__init__js����{��i�i�k���&�&�w�'A�'A�5�#�N�D�
*�&�6�6��-�-�/��D�&�%�� 4����#�#�D�)�!�D�L��D�I���#�#�D�)�s�1B�B)c��|jtj�k(r|jSt	j
tjd|j�}	t	j||jt	j�|jdtj�t	j|�S#t	j|�wxYw)z1Get the handle.  This should only be called once.F)rYrUrVrWr:rCrDr<r;rXrErF)rr\s  rrRzDupHandle.detachys����y�y�B�I�I�K�'��|�|�#��&�&�w�'A�'A�5�'+�y�y�2�D�
*��.�.��$�,�,��(A�(A�(C��L�L�%��)G�)G�I��#�#�D�)���#�#�D�)�s
�A
C�Cr)r*r+r,r-rrR�rrr5r5hs��-�
	�	*rr5)�DupFd�sendfds�recvfds�darwinc��tjd|�}tt|�dzg�}|j|gtj
tj|fg�tr |jd�dk7rtd��yy)z,Send an array of fds over an AF_UNIX socket.�i�r�Az%did not receive acknowledgement of fdN)
�array�bytes�lenr�socket�
SOL_SOCKETr
�ACKNOWLEDGErQ�RuntimeError)�sock�fds�msgs   rr`r`�sr���k�k�#�s�#���S��X��^�$�%�����c�U�f�/�/��1B�1B�C�H�I�J��4�9�9�Q�<�4�/��F�G�G�0�;rc���tjd�}|j|z}|jdtj|��\}}}}|s|st
�	tr|jd�t|�dk7rtdt|�z��|d\}}	}
|tjk(r�|	tjk(rxt|
�|jzdk7rt�|j|
�t|�dz|dk7r'tdjt|�|d���t!|�Std��#tt"f$r
Ytd��wxYw)	z/Receive an array of fds over an AF_UNIX socket.rdrrfzreceived %d items of ancdatarrez Len is {0:n} but msg[0] is {1!r}zInvalid data received)rg�itemsize�recvmsgrj�
CMSG_SPACE�EOFErrorrlrKrirmrkr
�
ValueError�	frombytes�AssertionError�format�list�
IndexError)rn�size�a�
bytes_sizerp�ancdata�flags�addr�
cmsg_level�	cmsg_type�	cmsg_datas           rrara�sT���K�K�����Z�Z�$�&�
�$(�L�L��F�4E�4E�j�4Q�$R�!��W�e�T��7��N�	���	�	�$���7�|�q� �"�#A�#&�w�<�$0�1�1�/6�q�z�,�J�	�9��f�/�/�/��V�.�.�.��y�>�A�J�J�.�!�3�$�$����I�&��q�6�C�<�3�q�6�)�(�:�A�A���F�C��F�,�-�-��A�w���2�3�3���J�'�	���2�3�3�	�s�C"E�E$�#E$c���tj|j�tjtj�5}t||g�ddd�y#1swYyxYwrJ)rj�fromfd�fileno�AF_UNIX�SOCK_STREAMr`)rLr>rM�ss    rrr�s>��
�]�]�4�;�;�=�&�.�.�&�:L�:L�
M�QR��A��x� �N�
M�
M�s�A�A"c���tj|j�tjtj�5}t|d�dcddd�S#1swYyxYw)rPrrN)rjr�r�r�r�ra)rLr�s  rrr�sD��
�]�]�4�;�;�=�&�.�.�&�:L�:L�
M�QR��1�a�=��#�	$�	$�
M�
M�s�A�A$c��tj�}|� |j|j|��Strddlm}|j|�Std��)zReturn a wrapper for an fd.r)�resource_sharerz&SCM_RIGHTS appears not to be available)r�get_spawning_popenr_�duplicate_for_child�HAVE_SEND_HANDLE�r�rv)�fd�	popen_objr�s   rr_r_�sS���.�.�0�	�� ��?�?�9�#@�#@��#D�E�E�
�)�"�(�(��,�,��E�F�Frc��|j�(t|j|jjffSt|j|jjffSr)�__self__�getattrr�__func__r*��ms r�_reduce_methodr��sH���z�z������a�j�j�&9�&9�:�:�:�����Q�Z�Z�%8�%8�9�9�9rc��eZdZd�Zy)�_Cc��yrr^)rs r�fz_C.f�s��rN)r*r+r,r�r^rrr�r��s��
rr�c�>�t|j|jffSr)r��__objclass__r*r�s r�_reduce_method_descriptorr��s���Q�^�^�Q�Z�Z�0�0�0rc�\�t|j|j|jxsiffSr)�_rebuild_partial�funcr�keywords)�ps r�_reduce_partialr��s%���a�f�f�a�f�f�a�j�j�.>�B�?�?�?rc�4�tj|g|��i|��Sr)�	functools�partial)r�rr�s   rr�r��s�����T�5�D�5�H�5�5rc�,�ddlm}t||�ffS)Nr)�	DupSocket)r�r��_rebuild_socket)r�r�s  r�_reduce_socketr��s��.���1���/�/rc�"�|j�Sr)rR)�dss rr�r��s���y�y�{�rc��t|j��}t||j|j|j
ffSr)r_r�r��familyr �proto)r��dfs  rr�r��s2��
�1�8�8�:�
����Q�X�X�q�v�v�q�w�w� ?�?�?rc�T�|j�}tj||||��S)N)r�)rRrj)r�r�r r�r�s     rr�r��s"��
�Y�Y�[���}�}�V�T�5��<�<rc�v�eZdZdZeZeZeZeZeZe	jdk(reZeZe
Z
neZeZeZeZeZeZeZeZd�Zy)�AbstractReducerz�Abstract base class for use in implementing a Reduction class
    suitable for use in replacing the standard reduction mechanism
    used in multiprocessing.rc�n�ttt�j�t�ttt
j�t�tttj�t�ttjt�ttjt�yr)r	r r�r�r�rz�appendr��int�__add__r�r�r�rjr�)rrs  rrzAbstractReducer.__init__s\����b�d�f�f��~�.���d�k�k�"�$=�>���c�k�k�"�$=�>���"�"�O�4������/rN)r*r+r,r-rr	r
rr�sys�platformr7r6r5r`rar_r�r�r�r�r�rr^rrr�r��sl�� �$�N��H��D��K��K�
�|�|�w��#���	��	�������#�N� 9��'��#�N�%�O�0rr�)�	metaclassr)NF).�abcrr.r�r#rUr0rjr�r�r�__all__r��hasattrr��Picklerrr	r
r:r6r7rr�objectr5rgrlr`rar_r�r�r r�r�rzr�r�r�r�r�r�r�r�r�r^rr�<module>r�s������	�	�
�
�
��
N���L�L�G�+�8��V�Z�0�7��V�\�2�7��V�]�]�I�6���V�^�^��.�"�"��-��<�<�7���9�9�G��
;�$(�
;�
7��
$�*�F�*�F�.�.�G���,�,�(�*�K�H�4�8!�
$�
	G�:�

�
�	��b�d�f�f��~�&�1���d�k�k�	�5�6���c�k�k�	�5�6�@�6���	�	�O�,��<�<�7��0���V�]�]�N�+�@�=�
�V�]�]�N�+�0��0r

?>