AlkantarClanX12

Your IP : 18.119.133.138


Current Path : /proc/thread-self/root/lib64/python3.8/multiprocessing/__pycache__/
Upload File :
Current File : //proc/thread-self/root/lib64/python3.8/multiprocessing/__pycache__/reduction.cpython-38.pyc

U

e5d(%�@sddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddddd	gZejd
kp�e
ed�o�e
ed�o�e
ejd
�ZGdd�dej�ZejZd6dd	�Zejd
k�redddg7ZddlZd7dd�dd�Zdd�Zdd�Zdd�ZGdd�de�ZnHedddg7ZddlZej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d
k�r�d-d.�Z+d/d0�Z,eeje+�nd1d.�Z+d2d0�Z,eeje+�Gd3d4�d4ed5�Z-dS)8�)�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__��1/usr/lib64/python3.8/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
cCst||��|�dS)z3Replacement for pickle.dump() using ForkingPickler.N)rr	)r"�filer#rrrr	:s�	DupHandle�	duplicate�steal_handleF)�source_processcCs6t��}|dkr|}|dkr |}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�c	CsFt�tjd|�}z$t�||t��ddtjtjB�W�St�|�XdS)z5Steal a handle from process identified by source_pid.FrN)r3�OpenProcess�PROCESS_DUP_HANDLE�CloseHandler5r4r6�DUPLICATE_CLOSE_SOURCE)Z
source_pidr7Zsource_process_handlerrrr1Ss�
�cCst|tj|�}|�|�dS�z&Send a handle over a local connection.N)r/r3r6�send)�connr7�destination_pidZdhrrrr_scCs|����S)�)Receive a handle over a local connection.)�recv�detach)r>rrrrdsc@s"eZdZdZddd�Zdd�ZdS)r/zPicklable wrapper for a handle.Nc	Cs\|dkrt��}t�tjd|�}zt�t��|||dd�|_W5t�|�X||_	||_
dS)NFr)�os�getpidr3r8r9r:r5r4�_handle�_access�_pid)rr7�access�pid�procrrrrjs�
zDupHandle.__init__c	CsZ|jt��kr|jSt�tjd|j�}z"t�||jt�	�|j
dtj�W�St�|�XdS)z1Get the handle.  This should only be called once.FN)rGrCrDrEr3r8r9r:r5r4rFr;)rrJrrrrBys
��zDupHandle.detach)N)r%r&r'r(rrBrrrrr/hs
�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
c	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tfk
r�YnXt	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<


�
�
��c	Cs2t�|��tjtj��}t||g�W5QRXdSr<)rU�fromfd�fileno�AF_UNIX�SOCK_STREAMrL)r>r7r?�srrrr�sc
Cs<t�|��tjtj��}t|d�dW5QR�SQRXdS)r@rrN)rUrerfrgrhrM)r>rirrrr�scCsFt��}|dk	r |�|�|��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
cCs2|jdkrt|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|f|�|�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

�
�	
�#