Your IP : 3.149.24.70


Current Path : /opt/alt/python34/lib64/python3.4/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/multiprocessing/__pycache__/managers.cpython-34.pyc

�
e f���@s�ddddgZddlZddlZddlZddlZddlmZddlmZdd	l	m
Z
dd
l	mZddl	mZddl	m
Z
dd
l	mZddl	mZddl	mZdd�Zejeje�dd�dddfD�Zedek	rMdd�ZxeD]Zejee�q0WnGdd�de�Zfidd�Zdd�ZGdd�de�Zd d!�Zd"d#�ZGd$d%�d%e�ZGd&d'�d'e�Z ie
j!e
j"fd(6e
j#e
j$fd)6Z%Gd*d�de�Z&Gd+d,�d,e'�Z(Gd-d�de�Z)d.d/�Z*id0d1�Z+dddd2d3d4�Z,Gd5d6�d6e�Z-Gd7d8�d8e�Z.d2d9d:�Z/Gd;d<�d<e)�Z0Gd=d>�d>e)�Z1Gd?d@�d@e1�Z2GdAdB�dBe)�Z3GdCdD�dDe)�Z4GdEdF�dFe)�Z5GdGdH�dHe)�Z6e+dIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\f�Z7Gd]d^�d^e7�Z8e+d_dKdLdMdNdRd`dadbdcdddXdddedfdf�Z9e+dgdNdMdRf�Z:e+dhdidjdkdldmdndodpdqdrdsf�Z;idtdj6dtdp6dtdr6dudl6dudm6e;_<Gdvdh�dhe;�Z=Gdwd�de&�Z>e>jdxej?�e>jdyej?�e>jdzej@e3�e>jd{ejAe1�e>jd|ejBe1�e>jd}ejCe1�e>jd~ejDe1�e>jdejEe2�e>jd�ejFe4�e>jd�ejGe=�e>jd�ee8�e>jd�eHe9�e>jd8e.e6�e>jd:e/e:�e>jd6e-e5�e>jdud�e0d�d��e>jdtd�d��dS)��BaseManager�SyncManager�	BaseProxy�Token�N)�time)�
format_exc�)�
connection)�context)�pool)�process)�	reduction)�util)�get_contextcCstj|j|j�ffS)N)�array�typecode�tobytes)�a�r�=/opt/alt/python34/lib64/python3.4/multiprocessing/managers.py�reduce_array%srcCs(g|]}tti|����qSr)�type�getattr)�.0�namerrr�
<listcomp>)s	r�items�keys�valuescCstt|�ffS)N)�list)�objrrr�rebuild_as_list+sr!c@sLeZdZdZdZdd�Zdd�Zd	d
�Zdd�Zd
S)rz4
    Type to uniquely indentify a shared object
    �typeid�address�idcCs!||||_|_|_dS)N)r"r#r$)�selfr"r#r$rrr�__init__:szToken.__init__cCs|j|j|jfS)N)r"r#r$)r%rrr�__getstate__=szToken.__getstate__cCs|\|_|_|_dS)N)r"r#r$)r%�staterrr�__setstate__@szToken.__setstate__cCsd|j|j|jfS)Nz#Token(typeid=%r, address=%r, id=%r))r"r#r$)r%rrr�__repr__CszToken.__repr__N)ztypeidzaddresszid)	�__name__�
__module__�__qualname__�__doc__�	__slots__r&r'r)r*rrrrr4scCsN|j||||f�|j�\}}|dkr;|St||��dS)zL
    Send a message to manager using connection `c` and return response
    z#RETURNN)�send�recv�convert_to_error)�cr$�
methodname�args�kwds�kind�resultrrr�dispatchKs
r9cCs~|dkr|S|dkr>t|�tks4t�t|�S|dkrpt|�tksbt�td|�Std�SdS)Nz#ERRORz
#TRACEBACKz#UNSERIALIZABLEzUnserializable message: %s
zUnrecognized message type)r�str�AssertionError�RemoteError�
ValueError)r7r8rrrr2Us
r2c@seZdZdd�ZdS)r<cCs)ddddt|jd�ddS)N�
�-�Kr)r:r5)r%rrr�__str__bszRemoteError.__str__N)r+r,r-rArrrrr<asr<cCsLg}x?t|�D]1}t||�}t|�r|j|�qqW|S)z4
    Return a list of names of methods of `obj`
    )�dirr�callable�append)r �tempr�funcrrr�all_methodsisrGcCsdd�t|�D�S)zP
    Return a list of names of methods of `obj` which do not start with '_'
    cSs&g|]}|ddkr|�qS)r�_r)rrrrrrxs	z"public_methods.<locals>.<listcomp>)rG)r rrr�public_methodstsrIc	@seZdZdZdddddddd	d
g	Zdd�Zd
d�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zied6ed6e
d6Z
dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0S)1�ServerzM
    Server class which runs in a process controlled by a manager object
    �shutdown�create�accept_connection�get_methods�
debug_info�number_of_objects�dummy�incref�decrefcCs�t|t�st�||_tj|�|_t|\}}|d|dd�|_|jj	|_	idffd6|_
i|_tj
�|_dS)Nr#Zbacklog��0)�
isinstance�bytesr;�registryr�AuthenticationString�authkey�listener_client�listenerr#�	id_to_obj�id_to_refcount�	threading�RLock�mutex)r%rXr#rZ�
serializer�Listener�Clientrrrr&�s		zServer.__init__cCs�tj�|_|tj�_zqtjd|j�}d|_|j	�y*x#|jj
�sq|jjd�qOWWntt
fk
r�YnXWdtjtjkr�tjd�tjt_tjt_ntjd�XdS)z(
        Run the server forever
        �targetTrNzresetting stdout, stderrr)r_�Event�
stop_eventr�current_process�_manager_server�Thread�accepter�daemon�start�is_set�wait�KeyboardInterrupt�
SystemExit�sys�stdout�
__stdout__r�debug�
__stderr__�stderr�exit)r%rkrrr�
serve_forever�s 	
	
zServer.serve_foreverc
Csgx`y|jj�}Wntk
r-wYnXtjd|jd|f�}d|_|j�qWdS)Nrer5T)r\Zaccept�OSErrorr_rj�handle_requestrlrm)r%r3�trrrrk�s
	zServer.accepterc'Cs�d}}}yvtj||j�tj||j�|j�}|\}}}}||jksttd|��t||�}Wn!tk
r�dt	�f}	YnGXy||||�}Wn!tk
r�dt	�f}	Yn
Xd|f}	y|j
|	�Wn�tk
r�}
zdy|j
dt	�f�Wntk
rBYnXtjd|	�tjd|�tjd|
�WYdd}
~
XnX|j
�dS)z)
        Handle a new connection
        Nz%r unrecognizedz
#TRACEBACKz#RETURNzFailure to send message: %rz ... request was %rz ... exception was %r)r	Zdeliver_challengerZZanswer_challenger1�publicr;r�	Exceptionrr0r�info�close)r%r3Zfuncnamer8�request�ignorer5r6rF�msg�errrr{�s4


#zServer.handle_requestc*Cs+tjdtj�j�|j}|j}|j}x�|jj	�s&y/d}}|�}|\}}}	}
||\}}}||kr�t
d|t|�|f��nt||�}
y|
|	|
�}Wn1t
k
r}zd|f}WYdd}~XnpX|o|j|d�}|rh|j|||�\}}t||j|�}d||ff}nd|f}Wn�t
k
r|dkr�dt�f}n\y8|j|}||||||	|
�}d|f}Wn!t
k
r�dt�f}YnXYnXtk
r:tjdtj�j�tjd	�Yn!t
k
rZdt�f}YnXyPy||�Wn;t
k
r�}z|d
t|�f�WYdd}~XnXWq7t
k
r"}zUtjdtj�j�tjd|�tjd
|�|j�tjd�WYdd}~Xq7Xq7WdS)zQ
        Handle requests from the proxies in a particular process/thread
        z$starting server thread to service %rNz+method %r of %r object is not in exposed=%rz#ERRORz#PROXYz#RETURNz
#TRACEBACKz$got EOF -- exiting thread serving %rrz#UNSERIALIZABLEzexception in thread serving %rz ... message was %rz ... exception was %rr)rrur_�current_threadrr1r0r]rgrn�AttributeErrorrrr~�getrLrr#r�fallback_mapping�EOFErrorrrrx�reprrr�)r%�connr1r0r]r4r r��identr5r6�exposedZ	gettypeidZfunction�resr�r�r"ZridentZrexposed�tokenZ
fallback_funcr8rrr�serve_client�sl				
	



	
-	
zServer.serve_clientcCs|S)Nr)r%r�r�r rrr�fallback_getvalueszServer.fallback_getvaluecCs
t|�S)N)r:)r%r�r�r rrr�fallback_str"szServer.fallback_strcCs
t|�S)N)r�)r%r�r�r rrr�
fallback_repr%szServer.fallback_reprrAr*z	#GETVALUEcCsdS)Nr)r%r3rrrrQ.szServer.dummycCs�|jj�z�g}t|jj��}|j�xY|D]Q}|dkr<|jd||j|t|j|d�dd�f�q<q<Wdj	|�SWd|jj
�XdS)zO
        Return some info --- useful to spot problems with refcounting
        rUz  %s:       refcount=%s
    %srNr@r>)ra�acquirerr]r�sortrDr^r:�join�release)r%r3r8rr�rrrrO1s


	
-zServer.debug_infocCst|j�dS)z*
        Number of shared objects
        r)�lenr])r%r3rrrrPCszServer.number_of_objectscCsXzCytjd�|jd�Wnddl}|j�YnXWd|jj�XdS)z'
        Shutdown this process
        z!manager received shutdown message�#RETURNNr)r�N)rrur0�	traceback�	print_excrg�set)r%r3r�rrrrKIs
zServer.shutdownc
Os\|jj�z:|j|\}}}}|dkrat|�dkrN|sTt�|d}	n|||�}	|dkr�t|	�}n|dk	r�t|�tks�t�t|�t|�}ndt	|	�}
t
jd||
�|	t|�|f|j
|
<|
|jkr&d|j|
<n|j||
�|
t|�fSWd|jj�XdS)z>
        Create a new shared object and return its id
        Nrrz%xz&%r callable returned object with id %r)rar�rXr�r;rIr�dictrr$rrur�r]r^rR�tupler�)r%r3r"r5r6rCr��method_to_typeid�	proxytyper r�rrrrLVs(

z
Server.createcCst|j|jd�S)zL
        Return the methods of the shared object indicated by token
        r)r�r]r$)r%r3r�rrrrN|szServer.get_methodscCs-|tj�_|jd�|j|�dS)z=
        Spawn a new thread to serve this connection
        �#RETURNN)r�N)r_r�rr0r�)r%r3rrrrrM�s
zServer.accept_connectionc
Cs7|jj�z|j|d7<Wd|jj�XdS)Nr)rar�r^r�)r%r3r�rrrrR�s
z
Server.increfc
Cs�|jj�zh|j|dks)t�|j|d8<|j|dkrt|j|=|j|=tjd|�nWd|jj�XdS)Nrrzdisposing of obj with id %r)rar�r^r;r]rrur�)r%r3r�rrrrS�s
z
Server.decrefN)r+r,r-r.r}r&ryrkr{r�r�r�r�r�rQrOrPrKrLrNrMrRrSrrrrrJ~s0
"J

&rJc@s+eZdZdgZdZdZdZdS)�State�valuerr�N)r+r,r-r/�INITIAL�STARTED�SHUTDOWNrrrrr��s	r��pickleZ	xmlrpclibc@seZdZdZiZeZdddddd�Zdd�Zdd	�Z	dfd
d�Z
edfdd
��Zdd�Z
ddd�Zdd�Zdd�Zdd�Zdd�Zedd��Zedd��Zeddddddd ��ZdS)!rz!
    Base class for managers
    Nr�cCs�|dkrtj�j}n||_tj|�|_t�|_tj|j_	||_
t|\|_|_
|pt�|_dS)N)rrhrZ�_addressrY�_authkeyr��_stater�r��_serializerr[Z	_Listener�_Clientr�_ctx)r%r#rZrbZctxrrrr&�s		zBaseManager.__init__cCs:|jjtjkst�t|j|j|j|j	�S)zX
        Return server object with serve_forever() method and address attribute
        )
r�r�r�r�r;rJ�	_registryr�r�r�)r%rrr�
get_server�szBaseManager.get_servercCsNt|j\}}||jd|j�}t|dd�tj|j_dS)z>
        Connect manager object to the server process
        rZNrQ)	r[r�r�r�r9r�r�r�r�)r%rcrdr�rrr�connect�szBaseManager.connectcCsm|jjtjkst�|dk	rCt|�rCtd��ntjdd�\}}|j	j
dt|�jd|j
|j|j|j|||f�|_djdd	�|jjD��}t|�jd
||j_|jj�|j�|j�|_|j�tj|j_tj|t|�jd|j|j|j|j|jfdd�|_dS)
z@
        Spawn a server process for this manager object
        Nzinitializer must be a callableZduplexFrer5�:css|]}t|�VqdS)N)r:)r�irrr�	<genexpr>�sz$BaseManager.start.<locals>.<genexpr>r?�exitpriorityr)r�r�r�r�r;rC�	TypeErrorr	ZPiper�ZProcessr�_run_serverr�r�r�r��_processr�Z	_identityr+rrmr�r1r�r�Finalize�_finalize_managerr�rK)r%�initializer�initargs�reader�writerr�rrrrm�s("


zBaseManager.startc	Csl|dk	r||�n|j||||�}|j|j�|j�tjd|j�|j�dS)z@
        Create a server, report its address and run it
        Nzmanager serving at %r)�_Serverr0r#r�rrry)	�clsrXr#rZrbr�r�r��serverrrrr��s

zBaseManager._run_servercOs�|jjtjks!td��|j|jd|j�}z)t|dd|f||�\}}Wd|j	�Xt
||j|�|fS)zP
        Create a new shared object; return the token and exposed tuple
        zserver not yet startedrZNrL)r�r�r�r�r;r�r�r�r9r�r)r%r"r5r6r�r$r�rrr�_creates!)zBaseManager._createcCsA|jdk	r=|jj|�|jj�s=d|_q=ndS)zC
        Join the manager process (if it has been spawned)
        N)r�r��is_alive)r%�timeoutrrrr�szBaseManager.joinc
CsA|j|jd|j�}zt|dd�SWd|j�XdS)zS
        Return some info about the servers shared objects and connections
        rZNrO)r�r�r�r9r�)r%r�rrr�_debug_info$szBaseManager._debug_infoc
CsA|j|jd|j�}zt|dd�SWd|j�XdS)z5
        Return the number of shared objects
        rZNrP)r�r�r�r9r�)r%r�rrr�_number_of_objects.szBaseManager._number_of_objectscCsA|jjtjkr"|j�n|jjtjks=t�|S)N)r�r�r�r�rmr�r;)r%rrr�	__enter__8s
zBaseManager.__enter__cCs|j�dS)N)rK)r%�exc_type�exc_val�exc_tbrrr�__exit__>szBaseManager.__exit__cCs|j�r�tjd�y8||d|�}zt|dd�Wd|j�XWntk
reYnX|jdd�|j�r�tjd�t|d�r�tjd	�|j�|jdd
�|j�r�tjd�q�q�q�nt	j
|_ytj
|=Wntk
rYnXdS)zQ
        Shutdown the manager process; will be registered as a finalizer
        z#sending shutdown message to managerrZNrKr�g�?zmanager still alive�	terminatez'trying to `terminate()` manager processg�������?z#manager still alive after terminate)r�rrr9r�r~r��hasattrr�r�r�r�r�_address_to_local�KeyError)rr#rZr(r�r�rrrr�As.





zBaseManager._finalize_managercCs|jS)N)r�)r%rrr�<lambda>aszBaseManager.<lambda>Tc
s-d|jkr$|jj�|_n�dkr9t�n|pNt�dd�}|pft�dd�}|r�xgt|j��D]P\}}t|�tks�t	d|��t|�tks�t	d|��q�Wn|||�f|j�<|r)��fdd�}	�|	_
t|�|	�ndS)z9
        Register a typeid with the manager type
        r�N�	_exposed_�_method_to_typeid_z%r is not a stringc	s�tjd��|j�||�\}}�||jd|d|jd|�}|j|jd|j�}t|dd|jf�|S)Nz)requesting creation of a shared %r object�managerrZr�rS)	rrur�r�r�r�r#r9r$)r%r5r6r�Zexp�proxyr�)r�r"rrrE~sz"BaseManager.register.<locals>.temp)�__dict__r��copy�	AutoProxyrrrrr:r;r+�setattr)
r�r"rCr�r�r��
create_method�keyr�rEr)r�r"r�registercs 	")
	zBaseManager.register)r+r,r-r.r�rJr�r&r�r�rm�classmethodr�r�r�r�r�r�r��staticmethodr��propertyr#r�rrrrr�s*		$	

 	c@s(eZdZdd�Zdd�ZdS)�ProcessLocalSetcCstj|dd��dS)NcSs
|j�S)N)�clear)r rrrr��sz*ProcessLocalSet.__init__.<locals>.<lambda>)r�register_after_fork)r%rrrr&�szProcessLocalSet.__init__cCst|�ffS)N)r)r%rrr�
__reduce__�szProcessLocalSet.__reduce__N)r+r,r-r&r�rrrrr��sr�c@s�eZdZdZiZej�Zdddddd�Zdd�Z	fidd	�Z
d
d�Zdd
�Ze
dd��Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)rz.
    A base for proxies of shared objects
    NTcCsAtjj�zPtjj|jd�}|dkr\tj�t�f}|tj|j<nWdtjj	�X|d|_
|d|_||_|jj
|_||_||_t|d|_|dk	r�tj|�|_n3|jdk	r|jj|_ntj�j|_|r*|j�ntj|tj�dS)Nrr)r�_mutexr�r�r�r#rZForkAwareLocalr�r��_tls�_idset�_tokenr$�_id�_managerr�r[r�rrYr�rhrZ�_increfr��_after_fork)r%r�rbr�rZr�rRZ	tls_idsetrrrr&�s,


			
zBaseProxy.__init__cCs�tjd�tj�j}tj�jdkrK|dtj�j7}n|j|jj	d|j
�}t|dd|f�||j_
dS)Nzmaking connection to managerZ
MainThread�|rZrM)rrurrhrr_r�r�r�r#r�r9r�r	)r%rr�rrr�_connect�s
zBaseProxy._connectcCsEy|jj}WnAtk
rStjdtj�j�|j�|jj}YnX|j	|j
|||f�|j�\}}|dkr�|S|dkr2|\}}|jj
|jd
}	|jj|_|	||jd|jd|jd|�}
|j|jd|j�}t|dd	|jf�|
St||��dS)zW
        Try to call a method of the referrent and return a copy of the result
        z#thread %r does not own a connectionz#RETURNz#PROXYrr�rZr�NrS���)r�r	r�rrur_r�rr�r0r�r1r�r�r"r�r#r�r�r�r9r$r2)r%r4r5r6r�r7r8r�r�r�r�rrr�_callmethod�s,
	
zBaseProxy._callmethodcCs
|jd�S)z9
        Get a copy of the value of the referent
        z	#GETVALUE)r�)r%rrr�	_getvalue�szBaseProxy._getvaluec
Cs�|j|jjd|j�}t|dd|jf�tjd|jj�|j	j
|j�|jor|jj}tj
|tjd|j|j||j|j	|jfdd�|_dS)NrZrRz	INCREF %rr5r��
)r�r�r#r�r9r�rrur$r��addr�r�r�r�_decrefr�Z_close)r%r�r(rrrr��szBaseProxy._increfcCs
|j|j�|dks.|jtjkr�yEtjd|j�||jd|�}t|dd|jf�Wq�t	k
r�}ztjd|�WYdd}~Xq�Xntjd|j�|rt
|d�rtjdtj�j
�|jj�|`ndS)Nz	DECREF %rrZrSz... decref failed %sz%DECREF %r -- manager already shutdownr	z-thread %r has no more proxies so closing conn)�discardr$r�r�r�rrur#r9r~r�r_r�rr	r�)r�rZr(ZtlsZidsetr�r�r�rrrr�s&	
zBaseProxy._decrefcCsTd|_y|j�Wn6tk
rO}ztjd|�WYdd}~XnXdS)Nzincref failed: %s)r�r�r~rr)r%r�rrrr�s
	zBaseProxy._after_forkcCs�i}tj�dk	r(|j|d<nt|dd�rc|j|d<tt|j|j|ffStt	|�|j|j|ffSdS)NrZ�_isautoFr�)
r
Zget_spawning_popenr�rr��RebuildProxyr�r�r�r)r%r6rrrr�$s
zBaseProxy.__reduce__cCs
|j�S)N)r�)r%�memorrr�__deepcopy__1szBaseProxy.__deepcopy__cCs*dt|�j|jjdt|�fS)Nz<%s object, typeid %r at %s>z0x%x)rr+r�r"r$)r%rrrr*4szBaseProxy.__repr__cCsBy|jd�SWn*tk
r=t|�dd�dSYnXdS)zV
        Return representation of the referent (or a fall-back if that fails)
        r*Nrz; '__str__()' failed>r�)r�r~r�)r%rrrrA8s
zBaseProxy.__str__)r+r,r-r.r�rZForkAwareThreadLockr�r&r�r�r�r�r�r�r�r�r�r*rArrrrr�s%	
cCs�ttj�dd�}|rB|j|jkrB|j|jdS|jdd�ojttj�dd�}|||d||�SdS)z�
    Function used for unpickling proxy objects.

    If possible the shared object is returned, or otherwise a proxy for it.
    riNrrRTZ_inheritingF)rrrhr#r]r$�pop)rFr�rbr6r�rRrrrr�Esr�c
Cs�t|�}y|||fSWntk
r2YnXi}x%|D]}td||f|�q@Wt|tf|�}||_||||f<|S)zC
    Return an proxy type whose methods are given by `exposed`
    zLdef %s(self, *args, **kwds):
        return self._callmethod(%r, args, kwds))r�r��execrrr�)rr��_cacheZdic�meth�	ProxyTyperrr�
MakeProxyTypeZs

	r�Tc
Cs�t|d}|dkr\||jd|�}zt|dd|f�}Wd|j�Xn|dkr�|dk	r�|j}n|dkr�tj�j}ntd|j	|�}|||d|d|d|�}	d|	_
|	S)	z*
    Return an auto-proxy for `token`
    rNrZrNz
AutoProxy[%s]r�rRT)r[r#r9r�r�rrhrZr�r"r�)
r�rbr�rZr�rRr�r�r�r�rrrr�ps		r�c@s(eZdZdd�Zdd�ZdS)�	NamespacecKs|jj|�dS)N)r��update)r%r6rrrr&�szNamespace.__init__cCsyt|jj��}g}x=|D]5\}}|jd�s"|jd||f�q"q"W|j�dtjd|�S)NrHz%s=%rz
Namespace(%s)z, )rr�r�
startswithrDr�r:r�)r%rrErr�rrrr*�s
zNamespace.__repr__N)r+r,r-r&r*rrrrr��sr�c@sReZdZddd�Zdd�Zdd�Zdd	�Zeee�Zd
S)�ValueTcCs||_||_dS)N)�	_typecode�_value)r%rr��lockrrrr&�s	zValue.__init__cCs|jS)N)r)r%rrrr��sz	Value.getcCs
||_dS)N)r)r%r�rrrr��sz	Value.setcCs dt|�j|j|jfS)Nz
%s(%r, %r))rr+rr)r%rrrr*�szValue.__repr__N)	r+r,r-r&r�r�r*r�r�rrrrr�s
rcCstj||�S)N)r)rZsequencerrrr�Array�src@sReZdZdZdd�Zdd�Zd	d
�Zdd�Zd
d�ZdS)�
IteratorProxy�__next__r0�throwr�cCs|S)Nr)r%rrr�__iter__�szIteratorProxy.__iter__cGs|jd|�S)Nr)r�)r%r5rrrr�szIteratorProxy.__next__cGs|jd|�S)Nr0)r�)r%r5rrrr0�szIteratorProxy.sendcGs|jd|�S)Nr)r�)r%r5rrrr�szIteratorProxy.throwcGs|jd|�S)Nr�)r�)r%r5rrrr��szIteratorProxy.closeN)z__next__zsendzthrowzclose)	r+r,r-r�r	rr0rr�rrrrr�src@sLeZdZd
Zdddd�Zdd�Zd	d
�Zdd�ZdS)�
AcquirerProxyr�r�TNcCs1|dkr|fn	||f}|jd|�S)Nr�)r�)r%Zblockingr�r5rrrr��s!zAcquirerProxy.acquirecCs
|jd�S)Nr�)r�)r%rrrr��szAcquirerProxy.releasecCs
|jd�S)Nr�)r�)r%rrrr��szAcquirerProxy.__enter__cCs
|jd�S)Nr�)r�)r%r�r�r�rrrr��szAcquirerProxy.__exit__)zacquirezrelease)r+r,r-r�r�r�r�r�rrrrr
�s
r
c@sLeZdZdZddd�Zd	d
�Zdd�Zdd
d�ZdS)�ConditionProxyr�r�ro�notify�
notify_allNcCs|jd|f�S)Nro)r�)r%r�rrrro�szConditionProxy.waitcCs
|jd�S)Nr)r�)r%rrrr�szConditionProxy.notifycCs
|jd�S)Nr
)r�)r%rrrr
�szConditionProxy.notify_allcCs�|�}|r|S|dk	r/t�|}nd}d}xL|s�|dk	rp|t�}|dkrpPqpn|j|�|�}q>W|S)Nr)�_timero)r%Z	predicater�r8ZendtimeZwaittimerrr�wait_for�s		


zConditionProxy.wait_for)zacquirezreleasezwaitznotifyz
notify_all)r+r,r-r�rorr
rrrrrr�s
rc@sIeZdZdZdd�Zdd�Zd	d
�Zddd
�ZdS)�
EventProxyrnr�r�rocCs
|jd�S)Nrn)r�)r%rrrrn�szEventProxy.is_setcCs
|jd�S)Nr�)r�)r%rrrr��szEventProxy.setcCs
|jd�S)Nr�)r�)r%rrrr��szEventProxy.clearNcCs|jd|f�S)Nro)r�)r%r�rrrro�szEventProxy.wait)zis_setzsetzclearzwait)r+r,r-r�rnr�r�rorrrrr�s
rc@sseZdZdZddd�Zdd	�Zd
d�Zedd
��Zedd��Z	edd��Z
dS)�BarrierProxy�__getattribute__ro�abort�resetNcCs|jd|f�S)Nro)r�)r%r�rrrro�szBarrierProxy.waitcCs
|jd�S)Nr)r�)r%rrrr�szBarrierProxy.abortcCs
|jd�S)Nr)r�)r%rrrr�szBarrierProxy.resetcCs|jdd�S)Nr�parties)zparties)r�)r%rrrr�szBarrierProxy.partiescCs|jdd�S)Nr�	n_waiting)z	n_waiting)r�)r%rrrr�szBarrierProxy.n_waitingcCs|jdd�S)Nr�broken)zbroken)r�)r%rrrr�szBarrierProxy.broken)z__getattribute__zwaitzabortzreset)r+r,r-r�rorrr�rrrrrrrr�src@s:eZdZdZdd�Zdd�Zdd	�Zd
S)�NamespaceProxyr�__setattr__�__delattr__cCsB|ddkr tj||�Stj|d�}|d|f�S)NrrHr�r)�objectr)r%r��
callmethodrrr�__getattr__szNamespaceProxy.__getattr__cCsH|ddkr#tj|||�Stj|d�}|d||f�S)NrrHr�r)rrr)r%r�r�rrrrrszNamespaceProxy.__setattr__cCsB|ddkr tj||�Stj|d�}|d|f�S)NrrHr�r)rrr)r%r�rrrrr
szNamespaceProxy.__delattr__N)z__getattribute__z__setattr__z__delattr__)r+r,r-r�rrrrrrrrsrc@s=eZdZdZdd�Zdd�Zeee�ZdS)	�
ValueProxyr�r�cCs
|jd�S)Nr�)r�)r%rrrr�szValueProxy.getcCs|jd|f�S)Nr�)r�)r%r�rrrr�szValueProxy.setN)zgetzset)r+r,r-r�r�r�r�r�rrrrrsr�
BaseListProxy�__add__�__contains__�__delitem__�__getitem__�__len__�__mul__�__reversed__�__rmul__�__setitem__rD�count�extend�index�insertr��remove�reverser��__imul__c@s(eZdZdd�Zdd�ZdS)�	ListProxycCs|jd|f�|S)Nr*)r�)r%r�rrr�__iadd__$szListProxy.__iadd__cCs|jd|f�|S)Nr/)r�)r%r�rrrr/'szListProxy.__imul__N)r+r,r-r1r/rrrrr0#sr0�	DictProxyr�r�r�Zhas_key�popitem�
setdefaultr��
ArrayProxy�	PoolProxyZapplyZapply_asyncr�ZimapZimap_unorderedr��mapZ	map_async�starmapZ
starmap_asyncr�ZAsyncResult�Iteratorc@s(eZdZdd�Zdd�ZdS)r6cCs|S)Nr)r%rrrr�DszPoolProxy.__enter__cCs|j�dS)N)r�)r%r�r�r�rrrr�FszPoolProxy.__exit__N)r+r,r-r�r�rrrrr6Csc@seZdZdZdS)ra(
    Subclass of `BaseManager` which supports a number of shared object types.

    The types registered are those intended for the synchronization
    of threads, plus `dict`, `list` and `Namespace`.

    The `multiprocessing.Manager()` function creates started instances of
    this class.
    N)r+r,r-r.rrrrrMs	�QueueZ
JoinableQueuerf�Lockr`�	Semaphore�BoundedSemaphore�	Condition�Barrier�Poolrr�r�r�F)I�__all__rrr_rZqueuerrr�r�r	r
rrr
rrrr�Z
view_typesrr!Z	view_typerrr9r2r~r<rGrIrJr�rcrdZXmlListenerZ	XmlClientr[rr�r�rr�r�r�r�rrrr
rrrrrrr0r2r5Z
BasePoolProxyr�r6rr:rfr;r`r<r=r>r?r@r�rrrr�<module>s�


�#
�
�
		



?>