Your IP : 18.191.171.43


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

�

c��f(%��H�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
gd�Zejdkp(e
ed��oe
ed��oe
ejd	��ZGd
�dej��ZejZd*d�Zejdkr*egd
�z
ZddlZd+dd�d�Zd�Zd�Zd�ZGd�de��Zn%egd�z
ZddlZejdkZd�Zd�Zd�Zd�Zd�Zd�ZGd�d��Z ee!e ��j"��e��d �Z#ee!e$j%��e#��ee!e&j'��e#��d!�Z(d"�Z)eej*e(��ejdkrd#�Z+d$�Z,eeje+��nd%�Z+d&�Z,eeje+��Gd'�d(e�)��Z-dS),�)�ABCMetaN�)�context)�send_handle�recv_handle�ForkingPickler�register�dump�win32�CMSG_LEN�
SCM_RIGHTS�sendmsgc�p��eZdZdZiZejZ�fd�Ze	d���Z
e	dd���Zej
Z
�xZS)rz)Pickler subclass used by multiprocessing.c���t��j|�|j���|_|j�|j��dS�N)�super�__init__�_copyreg_dispatch_table�copy�dispatch_table�update�_extra_reducers)�self�args�	__class__s  ��@/opt/alt/python311/lib64/python3.11/multiprocessing/reduction.pyrzForkingPickler.__init__&sN��������$���"�:�?�?�A�A�����"�"�4�#7�8�8�8�8�8�c��||j|<dS)z&Register a reduce function for a type.N)r)�cls�type�reduces   rr	zForkingPickler.register+s��%+���D�!�!�!rNc��tj��}|||���|��|���Sr)�io�BytesIOr
�	getbuffer)r�obj�protocol�bufs    r�dumpszForkingPickler.dumps0s;���j�l�l����C�������$�$�$��}�}���rr)�__name__�
__module__�__qualname__�__doc__r�copyregrrr�classmethodr	r)�pickle�loads�
__classcell__)rs@rrr!s��������3�3��O�%�4��9�9�9�9�9�
�+�+��[�+������[��

�L�E�E�E�E�Errc�L�t||���|��dS)z3Replacement for pickle.dump() using ForkingPickler.N)rr
)r&�filer's   rr
r
:s&���4��"�"�'�'��,�,�,�,�,r)�	DupHandle�	duplicate�steal_handleF)�source_processc�~�tj��}|�|}|�|}tj|||d|tj��S)z<Duplicate a handle.  (target_process is a handle not a pid!)Nr)�_winapi�GetCurrentProcess�DuplicateHandle�DUPLICATE_SAME_ACCESS)�handle�target_process�inheritabler8�current_processs     rr6r6GsN��"�3�5�5���!�,�N��!�,�N��&��F�N�
�{�G�9�;�;�	;rc	� �tjtjd|��}	tj||tj��ddtjtjz��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��&��z�!;�!;��	7��*�%�v��)�+�+�Q���-��0N�N�P�P�

�� 5�6�6�6�6��G�� 5�6�6�6�6���s�AA7�7B
c�f�t|tj|��}|�|��dS�z&Send a handle over a local connection.N)r5r:r=�send)�connr>�destination_pid�dhs    rrr_s)��
�v�w�<�o�
N�
N���	�	�"�
�
�
�
�
rc�N�|������S)�)Receive a handle over a local connection.)�recv�detach)rLs rrrds���y�y�{�{�!�!�#�#�#rc� �eZdZdZdd�Zd�ZdS)r5zPicklable wrapper for a handle.Nc�H�|�tj��}tjtjd|��}	tjtj��|||dd��|_tj|��n#tj|��wxYw||_	||_
dS)NFr)�os�getpidr:rCrDr<r;�_handlerF�_access�_pid)rr>�access�pid�procs     rrzDupHandle.__init__js����{��i�k�k���&�w�'A�5�#�N�N�D�
*�&�6��-�/�/��D�&�%�� 4� 4����#�D�)�)�)�)���#�D�)�)�)�)����!�D�L��D�I�I�Is�/A;�;Bc�j�|jtj��kr|jSt	jtjd|j��}	t	j||jt	j��|j	dtj
��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�B�I�K�K�'�'��|�#��&�w�'A�5�'+�y�2�2�D�
*��.��$�,��(A�(C�(C��L�%��)G�I�I��#�D�)�)�)�)���#�D�)�)�)�)���s�
=B�B2r)r*r+r,r-rrR�rrr5r5hs=������-�-�
	�
	�
	�
	�	*�	*�	*�	*�	*rr5)�DupFd�sendfds�recvfds�darwinc�0�tjd|��}tt|��dzg��}|�|gtjtj|fg��tr(|�d��dkrtd���dSdS)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`�s����k�#�s�#�#���S��X�X��^�$�%�%�����c�U�f�/��1B�C�H�I�J�J�J��	H�4�9�9�Q�<�<�4�/�/��F�G�G�G�	H�	H�/�/rc�"�tjd��}|j|z}|�dtj|����\}}}}|s	|st
�	tr|�d��t|��dkrtdt|��z���|d\}}	}
|tj
kr�|	tjkr�t|
��|jzdkrt�|�
|
��t|��dz|dkr6td�t|��|d�����t!|��Sn#tt"f$rYnwxYwtd���)	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�s����K������Z�$�&�
�$(�L�L��F�4E�j�4Q�4Q�$R�$R�!��W�e�T��	�7�	��N�	��
 ��	�	�$�����7�|�|�q� � �"�#A�#&�w�<�<�$0�1�1�1�/6�q�z�,�J�	�9��f�/�/�/��V�.�.�.��y�>�>�A�J�.�!�3�3�$�$����I�&�&�&��q�6�6�C�<�3�q�6�)�)�(�:�A�A���F�F�C��F�,�,�-�-�-��A�w�w�����J�'�	�	�	��D�	�����2�3�3�3s�DE+�+E?�>E?c���tj|���tjtj��5}t||g��ddd��dS#1swxYwYdSrJ)rj�fromfd�fileno�AF_UNIX�SOCK_STREAMr`)rLr>rM�ss    rrr�s���
�]�4�;�;�=�=�&�.�&�:L�
M�
M�	!�QR��A��x� � � �	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!�	!�	!s�A�A �#A c���tj|���tjtj��5}t|d��dcddd��S#1swxYwYdS)rPrrN)rjr�r�r�r�ra)rLr�s  rrr�s���
�]�4�;�;�=�=�&�.�&�:L�
M�
M�	$�QR��1�a�=�=��#�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�	$�	$s�A � A$�'A$c���tj��}|�(|�|�|����Strddlm}|�|��Std���)zReturn a wrapper for an fd.Nr)�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_�st���.�0�0�	�� ��?�?�9�#@�#@��#D�#D�E�E�E�
�	G�)�)�)�)�)�)�"�(�(��,�,�,��E�F�F�Frc�x�|j�t|j|jjffSt|j|jjffSr)�__self__�getattrr�__func__r*��ms r�_reduce_methodr��s8���z�����a�j�&9�:�:�:����Q�Z�%8�9�9�9rc��eZdZd�ZdS)�_Cc��dSrr^)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�0�0�0rc�<�t|j|j|jpiffSr)�_rebuild_partial�funcr�keywords)�ps r�_reduce_partialr��s���a�f�a�f�a�j�.>�B�?�?�?rc�,�tj|g|�Ri|��Sr)�	functools�partial)r�rr�s   rr�r��s#����T�5�D�5�5�5�H�5�5�5rc�4�ddlm}t||��ffS)Nr)�	DupSocket)r�r��_rebuild_socket)r�r�s  r�_reduce_socketr��s)��.�.�.�.�.�.����1����/�/rc�*�|���Sr)rR)�dss rr�r��s���y�y�{�{�rc�|�t|�����}t||j|j|jffSr)r_r�r��familyr �proto)r��dfs  rr�r��s1��
�1�8�8�:�:�
�
����Q�X�q�v�q�w� ?�?�?rc�Z�|���}tj||||���S)N)r�)rRrj)r�r�r r�r�s     rr�r��s(��
�Y�Y�[�[���}�V�T�5��<�<�<�<rc�p�eZdZdZeZeZeZeZeZe	j
dkreZeZe
Z
neZeZeZeZeZeZeZeZd�ZdS)�AbstractReducerz�Abstract base class for use in implementing a Reduction class
    suitable for use in replacing the standard reduction mechanism
    used in multiprocessing.rc��ttt��j��t��ttt
j��t��tttj	��t��ttjt��ttj
t��dSr)r	r r�r�r�rz�appendr��int�__add__r�r�r�rjr�)rrs  rrzAbstractReducer.__init__s����b�d�d�f���~�.�.�.���d�k�"�"�$=�>�>�>���c�k�"�"�$=�>�>�>���"�O�4�4�4�����/�/�/�/�/rN)r*r+r,r-rr	r
rr�sys�platformr7r6r5r`rar_r�r�r�r�r�rr^rrr�r��s������� � �$�N��H��D��K��K�
�|�w���#���	��	�	�������#�N� 9��'��#�N�%�O�0�0�0�0�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�
N�
N���L�G�+�8��W�V�Z�0�0�7��W�V�\�2�2�7��W�V�]�I�6�6�������V�^����.�"��-�-�-�-��<�7����9�9�9�9�G��N�N�N�
;�$(�
;�
;�
;�
;�
;�
7�
7�
7����
$�$�$�*�*�*�*�*�F�*�*�*�*�F�.�.�.�.�G��L�L�L��,�(�*�K�H�H�H�4�4�4�8!�!�!�
$�$�$�
	G�	G�	G�:�:�:�

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

?>