ok

Mini Shell

Direktori : /usr/lib64/python3.6/multiprocessing/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/multiprocessing/__pycache__/reduction.cpython-36.pyc

3


 \
$�@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__��1/usr/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�y�trN|jd�t|�dkrjt	dt|���|d\}}	}
|tj
kr�|	tjkr�t|
�|jdkr�t�|j
|
�t|�d|dks�t�t|�SWnttfk
r�YnXt	d��dS)	z/Receive an array of fds over an AF_UNIX socket.rJrrLzreceived %d items of ancdatarrKzInvalid data receivedN)rM�itemsizeZrecvmsgrPZ
CMSG_SPACE�EOFErrorrRr9rOrSrQr�
ValueErrorZ	frombytes�AssertionError�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`rarbrH)r:rcrrrr�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�rdrX)�fdZ	popen_objrdrrrrF�s
cCs2|jdkrt|j|jjffSt|j|jjffSdS)N)�__self__�getattrr�__func__r#)�mrrr�_reduce_method�s
rlc@seZdZdd�ZdS)�_CcCsdS)Nr)rrrr�f�sz_C.fN)r#r$r%rnrrrrrm�srmcCst|j|jffS)N)ri�__objclass__r#)rkrrr�_reduce_method_descriptor�srpcCst|j|j|jpiffS)N)�_rebuild_partial�funcr�keywords)�prrr�_reduce_partial�srucCstj|f|�|�S)N)�	functools�partial)rrrrsrrrrq�srqcCsddlm}t||�ffS)Nr)�	DupSocket)rdrx�_rebuild_socket)rcrxrrr�_reduce_socket�srzcCs|j�S)N)r=)Zdsrrrry�srycCs"t|j��}t||j|j|jffS)N)rFr`ry�familyr�proto)rc�dfrrrrz�scCs|j�}tj||||d�S)N)r`)r=rP)r}r{rr|rgrrrry�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	rrmrnrlrZ�appendrp�int�__add__rvrwrurPrz)rrrrrr
s
zAbstractReducer.__init__N)r#r$r%r&rr	r
rr�sys�platformr/r.r-rGrHrFrlrprqrzryrrrrrr~�s&
r~)�	metaclass)N)NF)/�abcrrr'rvrr>r)rPr�rfr�__all__r��hasattrreZPicklerrr	r
r0r.r/rr�objectr-rMrRrGrHrFrlrmrrnrprZrr�r�rurqrwrzryr~rrrr�<module>
sb




#


Zerion Mini Shell 1.0