AlkantarClanX12

Your IP : 3.141.21.199


Current Path : /opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/reduction.cpython-39.pyc

a

R�f(%�@sddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
gd�Zejdkp�e
ed�o�e
ed�o�e
ejd	�ZGd
d�dej�ZejZd8dd
�Zejdk�r�egd�7ZddlZd9dd�dd�Zdd�Zdd�Zdd�ZGdd�de�ZnFegd�7ZddlZejdkZdd�Zdd �Zd!d�Zd"d�Zd#d$�Zd%d&�ZGd'd(�d(�Z ee!e �j"�e�d)d*�Z#ee!e$j%�e#�ee!e&j'�e#�d+d,�Z(d-d.�Z)eej*e(�ejdk�r�d/d0�Z+d1d2�Z,eeje+�nd3d0�Z+d4d2�Z,eeje+�Gd5d6�d6ed7�Z-dS):�)�ABCMetaN�)�context)�send_handle�recv_handle�ForkingPickler�register�dump�win32ZCMSG_LEN�
SCM_RIGHTS�sendmsgcsJeZdZdZiZejZ�fdd�Ze	dd��Z
e	d	dd��Zej
Z
�ZS)
rz)Pickler subclass used by multiprocessing.cs*t�j|�|j��|_|j�|j�dS�N)�super�__init__�_copyreg_dispatch_table�copy�dispatch_table�update�_extra_reducers��self�args��	__class__��>/opt/alt/python39/lib64/python3.9/multiprocessing/reduction.pyr&szForkingPickler.__init__cCs||j|<dS)z&Register a reduce function for a type.N)r)�cls�type�reducerrrr+szForkingPickler.registerNcCs t��}|||��|�|��Sr
)�io�BytesIOr	�	getbuffer)r�obj�protocolZbufrrr�dumps0szForkingPickler.dumps)N)�__name__�
__module__�__qualname__�__doc__r�copyregrrr�classmethodrr$�pickle�loads�
__classcell__rrrrr!s
rcCst||��|�dS)z3Replacement for pickle.dump() using ForkingPickler.N)rr	)r"�filer#rrrr	:sr	)�	DupHandle�	duplicate�steal_handleF)�source_processcCs6t��}|dur|}|dur |}t�|||d|tj�S)z<Duplicate a handle.  (target_process is a handle not a pid!)Nr)�_winapi�GetCurrentProcess�DuplicateHandle�DUPLICATE_SAME_ACCESS)�handleZtarget_processZinheritabler2Zcurrent_processrrrr0Gs�r0c	CsNt�tjd|�}z,t�||t��ddtjtjB�Wt�|�St�|�0dS)z5Steal a handle from process identified by source_pid.FrN)r3�OpenProcess�PROCESS_DUP_HANDLEr5r4r6�DUPLICATE_CLOSE_SOURCE�CloseHandle)Z
source_pidr7Zsource_process_handlerrrr1Ss�

�
�r1cCst|tj|�}|�|�dS�z&Send a handle over a local connection.N)r/r3r6�send)�connr7�destination_pidZdhrrrr_srcCs|����S)�)Receive a handle over a local connection.)�recv�detach)r>rrrrdsrc@s"eZdZdZddd�Zdd�ZdS)r/zPicklable wrapper for a handle.Nc	Csf|durt��}t�tjd|�}z(t�t��|||dd�|_Wt�|�nt�|�0||_	||_
dS)NFr)�os�getpidr3r8r9r5r4�_handler;�_access�_pid)rr7�access�pid�procrrrrjs
�zDupHandle.__init__c	Csb|jt��kr|jSt�tjd|j�}z*t�||jt��|j	dtj
�Wt�|�St�|�0dS)z1Get the handle.  This should only be called once.FN)rGrCrDrEr3r8r9r5r4rFr:r;)rrJrrrrBys
�
�
�zDupHandle.detach)N)r%r&r'r(rrBrrrrr/hs
r/)�DupFd�sendfds�recvfds�darwincCsVt�d|�}tt|�dg�}|�|gtjtj|fg�trR|�d�dkrRt	d��dS)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�ACKNOWLEDGErA�RuntimeError)�sockZfds�msgrrrrL�s
rLc	Cst�d�}|j|}|�dt�|��\}}}}|s:|s:t�z�trJ|�d�t|�dkrft	dt|���|d\}}	}
|tj
kr�|	tjkr�t|
�|jdkr�t�|�
|
�t|�d|dkr�td�t|�|d���t|�WSWnttfy�Yn0t	d��d	S)
z/Receive an array of fds over an AF_UNIX socket.rOrrQzreceived %d items of ancdatarrPz Len is {0:n} but msg[0] is {1!r}zInvalid data receivedN)rR�itemsizeZrecvmsgrUZ
CMSG_SPACE�EOFErrorrWr=rTrXrVr�
ValueErrorZ	frombytes�AssertionError�format�list�
IndexError)rY�size�aZ
bytes_sizerZZancdata�flagsZaddrZ
cmsg_levelZ	cmsg_typeZ	cmsg_datarrrrM�s:


�
�
��rMcCsFt�|��tjtj��}t||g�Wd�n1s80YdSr<)rU�fromfd�fileno�AF_UNIX�SOCK_STREAMrL)r>r7r?�srrrr�scCsHt�|��tjtj��}t|d�dWd�S1s:0YdS)r@rrN)rUrerfrgrhrM)r>rirrrr�scCsFt��}|dur |�|�|��Str:ddlm}|�|�Std��dS)zReturn a wrapper for an fd.Nr)�resource_sharerz&SCM_RIGHTS appears not to be available)rZget_spawning_popenrKZduplicate_for_child�HAVE_SEND_HANDLE�rjr])�fdZ	popen_objrjrrrrK�s
rKcCs2|jdurt|j|jjffSt|j|jjffSdSr
)�__self__�getattrr�__func__r%��mrrr�_reduce_method�s
rsc@seZdZdd�ZdS)�_CcCsdSr
r)rrrr�f�sz_C.fN)r%r&r'rurrrrrt�srtcCst|j|jffSr
)ro�__objclass__r%rqrrr�_reduce_method_descriptor�srwcCst|j|j|jpiffSr
)�_rebuild_partial�funcr�keywords)�prrr�_reduce_partial�sr|cCstj|g|�Ri|��Sr
)�	functools�partial)ryrrzrrrrx�srxcCsddlm}t||�ffS)Nr)�	DupSocket)rjr�_rebuild_socket)rirrrr�_reduce_socket�sr�cCs|��Sr
)rB)Zdsrrrr��sr�cCs"t|���}t||j|j|jffSr
)rKrfr��familyr�proto)ri�dfrrrr��scCs|��}tj||||d�S)N)rf)rBrU)r�r�rr�rmrrrr��sc@sdeZdZdZeZeZeZeZeZe	j
dkr8eZeZe
Z
neZeZeZeZeZeZeZeZdd�ZdS)�AbstractReducerz�Abstract base class for use in implementing a Reduction class
    suitable for use in replacing the standard reduction mechanism
    used in multiprocessing.r
cGsNttt�j�t�tttj�t�tttj	�t�tt
jt�tt
j
t�dSr
)rrrtrursr`�appendrw�int�__add__r}r~r|rUr�rrrrrs
zAbstractReducer.__init__N)r%r&r'r(rrr	rr�sys�platformr1r0r/rLrMrKrsrwrxr�r�rrrrrr��s&
r�)�	metaclass)N)NF).�abcrr)r}rrCr+rUr�rlr�__all__r��hasattrrkZPicklerrrr	r3r0r1rr�objectr/rRrWrLrMrKrsrtrrurwr`r�r�r�r|rxr~r�r�r�rrrr�<module>
sj

�
�	
�#