AlkantarClanX12

Your IP : 3.147.13.220


Current Path : /opt/alt/python36/lib64/python3.6/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/multiprocessing/__pycache__/reduction.cpython-36.opt-1.pyc

3

� f
$�@sddlmZmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddddd	gZe	j
d
kp�eed�o�eed�o�eejd
�ZGdd�dej�ZejZd5dd	�Ze	j
d
k�redddg7ZddlZd6dd�Zdd�Zdd�Zdd�ZGdd�de�ZnHedddg7ZddlZe	j
dkZdd�Zdd�Zdd�Zd d�Zd!d�Zd"d#�Z Gd$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)�e	j
d
k�r�d,d-�Z,d.d/�Z-eeje,�nd0d-�Z,d1d/�Z-eeje,�Gd2d3�d3ed4�Z.dS)7�)�ABCMeta�abstractmethodN�)�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|�|jj�|_|jj|j�dS)N)�super�__init__�_copyreg_dispatch_table�copy�dispatch_table�update�_extra_reducers)�self�args)�	__class__��>/opt/alt/python36/lib64/python3.6/multiprocessing/reduction.pyr&szForkingPickler.__init__cCs||j|<dS)z&Register a reduce function for a type.N)r)�cls�type�reducerrrr	+szForkingPickler.registerNcCs tj�}|||�j|�|j�S)N)�io�BytesIOr
�	getbuffer)r�obj�protocolZbufrrr�dumps0szForkingPickler.dumps)N)�__name__�
__module__�__qualname__�__doc__r�copyregrrr�classmethodr	r"�pickle�loads�
__classcell__rr)rrr!scCst||�j|�dS)z3Replacement for pickle.dump() using ForkingPickler.N)rr
)r �filer!rrrr
:s�	DupHandle�	duplicate�steal_handleFcCs*|dkrtj�}tjtj�||d|tj�S)z<Duplicate a handle.  (target_process is a handle not a pid!)Nr)�_winapi�GetCurrentProcess�DuplicateHandle�DUPLICATE_SAME_ACCESS)�handleZtarget_processZinheritablerrrr.Gs

cCsBtjtjd|�}z tj||tj�ddtjtjB�Stj|�XdS)z5Steal a handle from process identified by source_pid.FrN)r0�OpenProcess�PROCESS_DUP_HANDLEr2r1r3�DUPLICATE_CLOSE_SOURCE�CloseHandle)Z
source_pidr4Zsource_process_handlerrrr/Os
cCst|tj|�}|j|�dS)z&Send a handle over a local connection.N)r-r0r3�send)�connr4�destination_pidZdhrrrr[scCs|j�j�S)z)Receive a handle over a local connection.)�recv�detach)r:rrrr`sc@s"eZdZdZddd�Zdd�ZdS)r-zPicklable wrapper for a handle.Nc
Cs\|dkrtj�}tjtjd|�}ztjtj�|||dd�|_Wdtj|�X||_	||_
dS)NFr)�os�getpidr0r5r6r2r1�_handler8�_access�_pid)rr4�access�pid�procrrrrfszDupHandle.__init__c
CsV|jtj�kr|jStjtjd|j�}ztj||jtj�|j	dtj
�Stj|�XdS)z1Get the handle.  This should only be called once.FN)rBr>r?r@r0r5r6r2r1rAr7r8)rrErrrr=us
zDupHandle.detach)N)r#r$r%r&rr=rrrrr-ds
�DupFd�sendfds�recvfds�darwincCsVtjd|�}tt|�dg�}|j|gtjtj|fg�trR|jd�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�ACKNOWLEDGEr<�RuntimeError)�sockZfds�msgrrrrG�s
cCs�tjd�}|j|}|jdtj|��\}}}}|r>|r>t�yxtrN|jd�t|�dkrjt	dt|���|d\}}	}
|tj
kr�|	tjkr�t|
�|jdkr�t�|j
|
�t|�SWnttfk
r�YnXt	d��dS)z/Receive an array of fds over an AF_UNIX socket.rJrrLzreceived %d items of ancdatarzInvalid data receivedN)rM�itemsizeZrecvmsgrPZ
CMSG_SPACE�EOFErrorrRr9rOrSrQr�
ValueErrorZ	frombytes�list�
IndexError)rT�size�aZ
bytes_sizerUZancdata�flagsZaddrZ
cmsg_levelZ	cmsg_typeZ	cmsg_datarrrrH�s*





c
Cs2tj|j�tjtj��}t||g�WdQRXdS)z&Send a handle over a local connection.N)rP�fromfd�fileno�AF_UNIX�SOCK_STREAMrG)r:r4r;�srrrr�sc
Cs0tj|j�tjtj��}t|d�dSQRXdS)z)Receive a handle over a local connection.rrN)rPr^r_r`rarH)r:rbrrrr�scCsFtj�}|dk	r |j|j|��Str:ddlm}|j|�Std��dS)zReturn a wrapper for an fd.Nr)�resource_sharerz&SCM_RIGHTS appears not to be available)rZget_spawning_popenrFZduplicate_for_child�HAVE_SEND_HANDLE�rcrX)�fdZ	popen_objrcrrrrF�s
cCs2|jdkrt|j|jjffSt|j|jjffSdS)N)�__self__�getattrr�__func__r#)�mrrr�_reduce_method�s
rkc@seZdZdd�ZdS)�_CcCsdS)Nr)rrrr�f�sz_C.fN)r#r$r%rmrrrrrl�srlcCst|j|jffS)N)rh�__objclass__r#)rjrrr�_reduce_method_descriptor�srocCst|j|j|jpiffS)N)�_rebuild_partial�funcr�keywords)�prrr�_reduce_partial�srtcCstj|f|�|�S)N)�	functools�partial)rqrrrrrrrp�srpcCsddlm}t||�ffS)Nr)�	DupSocket)rcrw�_rebuild_socket)rbrwrrr�_reduce_socket�srycCs|j�S)N)r=)Zdsrrrrx�srxcCs"t|j��}t||j|j|jffS)N)rFr_rx�familyr�proto)rb�dfrrrry�scCs|j�}tj||||d�S)N)r_)r=rP)r|rzrr{rfrrrrx�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.rcGsNttt�j�t�tttj�t�tttj	�t�tt
jt�tt
j
t�dS)N)r	rrlrmrkrY�appendro�int�__add__rurvrtrPry)rrrrrr
s
zAbstractReducer.__init__N)r#r$r%r&rr	r
rr�sys�platformr/r.r-rGrHrFrkrorpryrxrrrrrr}�s&
r})�	metaclass)N)NF)/�abcrrr'rurr>r)rPr�rer�__all__r��hasattrrdZPicklerrr	r
r0r.r/rr�objectr-rMrRrGrHrFrkrlrrmrorYr~rr�rtrprvryrxr}rrrr�<module>
sb




#