AlkantarClanX12

Your IP : 18.119.28.213


Current Path : /opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/managers.cpython-310.opt-2.pyc

o

6��f���@sPgd�ZddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZmZmZddlmZdd	lmZdd
lmZddlmZzddlmZWneykd
ZYnwdZe�d�dd�Ze�eje�dd�dD�Zedeur�dd�ZeD]Ze�ee�q�Gdd�de �Z!difdd�Z"dd�Z#Gdd�de$�Z%d d!�Z&d"d#�Z'Gd$d%�d%e �Z(Gd&d'�d'e �Z)e
j*e
j+fe
j,e
j-fd(�Z.Gd)d*�d*e �Z/Gd+d,�d,e0�Z1Gd-d.�d.e �Z2d/d0�Z3ifd1d2�Z4		
dmd3d4�Z5Gd5d6�d6e �Z6Gd7d8�d8e �Z7dnd9d:�Z8Gd;d<�d<e2�Z9Gd=d>�d>e2�Z:Gd?d@�d@e:�Z;GdAdB�dBe2�Z<GdCdD�dDe2�Z=GdEdF�dFe2�Z>GdGdH�dHe2�Z?e4dIdJ�Z@GdKdL�dLe@�ZAe4dMdN�ZBdOdPieB_Ce4dQdR�ZDe4dSdT�ZEdUdUdUdPdPdV�eE_CGdWdS�dSeE�ZFGdXdY�dYe/�ZGeG�dZejH�eG�d[ejH�eG�d\ejIe<�eG�d]ejJe:�eG�d^ejKe:�eG�d_ejLe:�eG�d`ejMe:�eG�daejNe;�eG�dbejOe=�eG�dcejPeF�eG�ddeeA�eG�deeQeB�eG�d8e7e?�eG�d:e8eD�eG�d6e6e>�eGjdPe9d
df�eGjdUd
dg�e�r&Gdhdi�di�ZRGdjdk�dke(�ZSGdld�de/�ZTdSdS)o)�BaseManager�SyncManager�	BaseProxy�Token�N)�getpid)�
format_exc�)�
connection)�	reduction�get_spawning_popen�ProcessError)�pool)�process)�util)�get_context)�
shared_memoryFT�SharedMemoryManagercCstj|j|��ffS�N)�array�typecode�tobytes)�a�r�?/opt/alt/python310/lib64/python3.10/multiprocessing/managers.py�reduce_array/�rcCsg|]
}tti|����qSr)�type�getattr��.0�namerrr�
<listcomp>3�r!)�items�keys�valuescCstt|�ffSr)�list��objrrr�rebuild_as_list5�r)c@s2eZdZ	dZdd�Zdd�Zdd�Zdd	�Zd
S)r��typeid�address�idcCs||||_|_|_dSrr+)�selfr,r-r.rrr�__init__DszToken.__init__cCs|j|j|jfSrr+�r/rrr�__getstate__G�zToken.__getstate__cCs|\|_|_|_dSrr+�r/�staterrr�__setstate__JrzToken.__setstate__cCsd|jj|j|j|jfS)Nz %s(typeid=%r, address=%r, id=%r))�	__class__�__name__r,r-r.r1rrr�__repr__Ms�zToken.__repr__N)r8�
__module__�__qualname__�	__slots__r0r2r6r9rrrrr>srrcCs6	|�||||f�|��\}}|dkr|St||��)N�#RETURN)�send�recv�convert_to_error)�cr.�
methodname�args�kwds�kind�resultrrr�dispatchUs
rGcCs^|dkr|S|dvr(t|t�std�||t|����|dkr$td|�St|�Std�|��S)N�#ERROR)�
#TRACEBACK�#UNSERIALIZABLEz.Result {0!r} (kind '{1}') type is {2}, not strrJzUnserializable message: %s
zUnrecognized message type {!r})�
isinstance�str�	TypeError�formatr�RemoteError�
ValueError)rErFrrrr@_s

��r@c@seZdZdd�ZdS)rOcCsdt|jd�dS)NzM
---------------------------------------------------------------------------
rzK---------------------------------------------------------------------------)rLrCr1rrr�__str__oszRemoteError.__str__N)r8r:r;rQrrrrrOnsrOcCs4	g}t|�D]}t||�}t|�r|�|�q|Sr)�dirr�callable�append)r(�tempr �funcrrr�all_methodsvs

�rWcCs	dd�t|�D�S)NcSsg|]
}|ddkr|�qS)r�_rrrrrr!�r"z"public_methods.<locals>.<listcomp>)rWr'rrr�public_methods�srYc@s�eZdZ	gd�Zdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zeee
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'S)(�Server)	�shutdown�create�accept_connection�get_methods�
debug_info�number_of_objects�dummy�incref�decrefcCsxt|t�std�|t|����||_t�|�|_t	|\}}||dd�|_
|j
j|_ddi|_i|_
i|_t��|_dS)Nz&Authkey {0!r} is type {1!s}, not bytes�)r-Zbacklog�0�Nr)rK�bytesrMrNr�registryr�AuthenticationString�authkey�listener_client�listenerr-�	id_to_obj�id_to_refcount�id_to_local_proxy_obj�	threading�Lock�mutex)r/rhr-rj�
serializer�Listener�Clientrrrr0�s
��

zServer.__init__c	Cs�	t��|_|t��_zGtj|jd�}d|_|�	�z|j�
�s+|j�d�|j�
�r Wntt
fy7YnwWtjtjkrLt�d�tjt_tjt_t�d�dStjtjkrft�d�tjt_tjt_t�d�w)N)�targetTrzresetting stdout, stderrr)rp�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/r|rrr�
serve_forever�s4



����
�
zServer.serve_forevercCsF	z|j��}Wn	tyYqwtj|j|fd�}d|_|��q)NT�rvrC)rlZaccept�OSErrorrpr{�handle_requestr}r~)r/rA�trrrr|�s��zServer.acceptercCs$d}zt�||j�t�||j�|��}|\}}}}t||�}Wnty/dt�f}Yn!wz
||g|�Ri|��}	WntyKdt�f}Ynwd|	f}z|�|�WdSty�}
z-z
|�dt�f�Wn	tysYnwt	�
d|�t	�
d|�t	�
d|
�WYd}
~
dSd}
~
ww)NrIr=zFailure to send message: %rz ... request was %r� ... exception was %r)r	Zdeliver_challengerjZanswer_challenger?r�	Exceptionrr>r�info)r/rA�request�ignore�funcnamerCrDrV�msgrF�errr�_handle_request�s:�����zServer._handle_requestcCsL	zz|�|�Wn	tyYnwW|��dSW|��dS|��wr)r�r��close�r/�connrrrr��s���zServer.handle_requestcCs�	t�dt��j�|j}|j}|j}|j�	��sez�d}}|�}|\}}}	}
z	||\}}}Wn&t
yV}
zz
|j|\}}}Wn	t
yK|
�wWYd}
~
nd}
~
ww||vrftd|t
|�|f��t||�}z	||	i|
��}Wnty�}z
d|f}WYd}~n*d}~ww|o�|�|d�}|r�|�|||�\}}t||j|�}d||ff}nd|f}Wn`ty�|dur�dt�f}n(z|j|}|||||g|	�Ri|
��}d|f}Wnty�dt�f}YnwYn&t�yt�dt��j�t�d�Ynt�ydt�f}Ynwzz||�Wnt�y*|d	t�f�YnwWn1t�y]}z$t�d
t��j�t�d|�t�d|�|��t�d
�WYd}~nd}~ww|j�	�rdSdS)Nz$starting server thread to service %rz+method %r of %r object is not in exposed=%rrH�#PROXYr=rIz$got EOF -- exiting thread serving %rrrJzexception in thread serving %rz ... message was %rr�r)rr�rp�current_threadr r?r>rmrxr�KeyErrorro�AttributeErrorrrr��getr\rr-r�fallback_mapping�EOFErrorr�r�r�r�)r/r�r?r>rmrBr(r��identrCrD�exposed�	gettypeid�keZfunction�resr�r�r,ZridentZrexposed�tokenZ
fallback_funcrFrrr�serve_client�s���������
���
�������������zServer.serve_clientcCs|Srr�r/r�r�r(rrr�fallback_getvalue?�zServer.fallback_getvaluecC�t|�Sr�rLr�rrr�fallback_strB�zServer.fallback_strcCr�r)�reprr�rrr�
fallback_reprEr�zServer.fallback_repr)rQr9�	#GETVALUEcCsdSrr�r/rArrrraNr�zServer.dummyc
Cs�	|j�;g}t|j���}|��|D]}|dkr2|�d||j|t|j|d�dd�f�qd�|�Wd�S1sBwYdS)Nrez  %s:       refcount=%s
    %sr�K�
)	rrr&rnr$�sortrTrLrm�join)r/rArFr$r�rrrr_Qs
���$�zServer.debug_infocCs	t|j�Sr)�lenrnr�rrrr`as
zServer.number_of_objectscCsb	z)zt�d�|�d�Wnddl}|��YW|j��dSW|j��dS|j��w)Nz!manager received shutdown message�r=Nr)rr�r>�	traceback�	print_excrx�set)r/rAr�rrrr[hs
�zServer.shutdowncOs	|j�q|j|\}}}}|dur#|st|�dkrtd��|d}	n||i|��}	|dur2t|	�}|durMt|t�sEtd�|t	|����t
|�t
|�}dt|	�}
t�
d||
�|	t|�|f|j|
<|
|jvrnd|j|
<Wd�n1sxwY|�||
�|
t|�fS)Nrz4Without callable, must have one non-keyword argumentrz,Method_to_typeid {0!r}: type {1!s}, not dictz%xz&%r callable returned object with id %r)rrrhr�rPrYrK�dictrMrNrr&r.rr�r�rmrnrb�tuple)r/rAr,rCrDrSr��method_to_typeid�	proxytyper(r�rrrr\us<
��

��

��z
Server.createcCs	t|j|jd�S)Nr)r�rmr.)r/rAr�rrrr^�szServer.get_methodscCs$	|t��_|�d�|�|�dS)Nr�)rpr�r r>r�)r/rAr rrrr]�s

zServer.accept_connectioncCs�|j�Rz|j|d7<Wn5tyD}z)||jvr8d|j|<|j||j|<|j|\}}}t�d|�n|�WYd}~n
d}~wwWd�dSWd�dS1sXwYdS)Nrz&Server re-enabled tracking & INCREF %r)rrrnr�rormrr�)r/rAr�r�r(r�r�rrrrb�s$

������
"�z
Server.increfcCs�||jvr||jvrt�d|�dS|j�2|j|dkr,td�||j||j|���|j|d8<|j|dkr@|j|=Wd�n1sJwY||jvryd|j|<t�d|�|j�
|j|=Wd�dS1srwYdSdS)NzServer DECREF skipping %rrz+Id {0!s} ({1!r}) has refcount {2:n}, not 1+r)NrNzdisposing of obj with id %r)rnrorr�rr�AssertionErrorrNrm)r/rAr�rrrrc�s0


����



"��z
Server.decrefN)r8r:r;�publicr0r�r|r�r�r�r�r�r�r�rar_r`r[r\r^r]rbrcrrrrrZ�s2
Q�
$rZc@seZdZdgZdZdZdZdS)�State�valuerr�N)r8r:r;r<�INITIAL�STARTED�SHUTDOWNrrrrr��s
r�)�pickleZ	xmlrpclibc@s�eZdZ	iZeZ		d!dd�Zdd�Zdd�Zd"d
d�Z	e
		d"dd
��Zdd�Zd#dd�Z
dd�Zdd�Zdd�Zdd�Zedd��Zedd��Ze
		d$dd ��ZdS)%rNr�cCs\|dur	t��j}||_t�|�|_t�|_tj|j_	||_
t|\|_|_
|p*t�|_dSr)rryrj�_addressri�_authkeyr��_stater�r��_serializerrkZ	_Listener�_Clientr�_ctx)r/r-rjrs�ctxrrrr0�s

zBaseManager.__init__cCsd	|jjtjkr'|jjtjkrtd��|jjtjkrtd��td�|jj���t|j	|j
|j|j�S)N�Already started server�Manager has shut down�Unknown state {!r})
r�r�r�r�r�rr�rNrZ�	_registryr�r�r�r1rrr�
get_server�s�
�zBaseManager.get_servercCs:	t|j\}}||j|jd�}t|dd�tj|j_dS)N�rjra)	rkr�r�r�rGr�r�r�r�)r/rtrur�rrr�connects
zBaseManager.connectrc	Cs2	|jjtjkr'|jjtjkrtd��|jjtjkrtd��td�|jj���|dur3t|�s3t	d��t
jdd�\}}|jj
t|�j|j|j|j|j|||fd�|_d�d	d
�|jjD��}t|�jd||j_|j��|��|��|_|��tj|j_tj|t|�j|j|j|j|j|jfdd
�|_ dS)Nr�r�r�zinitializer must be a callableF)Zduplexr��:css�|]}t|�VqdSrr�)r�irrr�	<genexpr>0s�z$BaseManager.start.<locals>.<genexpr>�-r�rCZexitpriority)!r�r�r�r�r�rr�rNrSrMr	ZPiper�ZProcessr�_run_serverr�r�r�r��_processr�Z	_identityr8r r~r�r?r�Finalize�_finalize_managerr�r[)r/�initializer�initargs�reader�writerr�rrrr~s@�
��



��zBaseManager.startc	Cs`	t�tjtj�|dur||�|�||||�}|�|j�|��t�d|j�|�	�dS)Nzmanager serving at %r)
�signal�SIGINT�SIG_IGN�_Serverr>r-r�rr�r�)	�clsrhr-rjrsr�r�r��serverrrrr�BszBaseManager._run_servercOsX	|j|j|jd�}zt|dd|f||�\}}W|��n|��wt||j|�|fS)Nr�r\)r�r�r�rGr�r)r/r,rCrDr�r.r�rrr�_createYszBaseManager._createcCs4	|jdur|j�|�|j��sd|_dSdSdSr)r�r��is_alive�r/�timeoutrrrr�es


�zBaseManager.joincC�6	|j|j|jd�}zt|dd�W|��S|��w)Nr�r_�r�r�r�rGr�r�rrr�_debug_infon�
zBaseManager._debug_infocCr�)Nr�r`r�r�rrr�_number_of_objectsxr�zBaseManager._number_of_objectscCsf|jjtjkr|��|jjtjkr1|jjtjkrtd��|jjtjkr(td��td�|jj���|S)NzUnable to start serverr�r�)	r�r�r�r�r~r�rr�rNr1rrr�	__enter__�s�zBaseManager.__enter__cC�|��dSr)r[�r/�exc_typeZexc_valZexc_tbrrr�__exit__��zBaseManager.__exit__cCs�	|��rZt�d�z|||d�}zt|dd�W|��n|��wWn	ty-Ynw|jdd�|��rZt�d�t|d�rZt�d�|��|jdd�|��rZt�d	�t	j
|_ztj
|=WdStyoYdSw)
Nz#sending shutdown message to managerr�r[g�?)r�zmanager still alive�	terminatez'trying to `terminate()` manager processz#manager still alive after terminate)r�rr�rGr�r�r��hasattrr�r�r�r�r�_address_to_localr�)rr-rjr5r�r�rrrr��s4
�



�zBaseManager._finalize_managercC�|jSr)r�r1rrrr-�szBaseManager.addressTc
s�	d|jvr|j��|_�durt�|pt�dd�}|p!t�dd�}|r/t|���D]\}}q*|||�f|j�<|rL��fdd�}	�|	_t|�|	�dSdS)Nr��	_exposed_�_method_to_typeid_csft�d��|j�g|�Ri|��\}}�||j||j|d�}|j|j|jd�}t|dd|jf�|S)Nz)requesting creation of a shared %r object��managerrjr�r�rc)	rr�r�r�r�r�r-rGr.)r/rCrDr�Zexp�proxyr��r�r,rrrU�s�z"BaseManager.register.<locals>.temp)	�__dict__r��copy�	AutoProxyrr&r#r8�setattr)
r�r,rSr�r�r��
create_method�keyr�rUrrr�register�s$

�
�
�zBaseManager.register)NNr�Nrfr)NNNNT)r8r:r;r�rZr�r0r�r�r~�classmethodr�r�r�r�r�r�r��staticmethodr��propertyr-r
rrrrr�s6
�
	+�
	




�rc@�eZdZdd�Zdd�ZdS)�ProcessLocalSetcCst�|dd��dS)NcS�|��Sr)�clearr'rrr�<lambda>�sz*ProcessLocalSet.__init__.<locals>.<lambda>)r�register_after_forkr1rrrr0�rzProcessLocalSet.__init__cCst|�dfSrf)rr1rrr�
__reduce__�r�zProcessLocalSet.__reduce__N)r8r:r;r0rrrrrr��rc@s�eZdZ	iZe��Z		ddd�Zdd�Zdifd	d
�Z	dd�Z
d
d�Zedd��Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)rNTFc	Cs�tj�!tj�|jd�}|durt��t�f}|tj|j<Wd�n1s'wY|d|_|d|_	||_
|j
j|_||_
||_t|d|_||_|durYt�|�|_n|j
durd|j
j|_nt��j|_|rp|��t�|tj�dS)Nrr)r�_mutexr�r�r-rZForkAwareLocalr�_tls�_idset�_tokenr.�_id�_managerr�rkr��_owned_by_managerrrir�ryrj�_increfr�_after_fork)	r/r�rsrrjr�rb�
manager_ownedZ	tls_idsetrrrr0�s.��



zBaseProxy.__init__cCsdt�d�t��j}t��jdkr|dt��j7}|j|jj	|j
d�}t|dd|f�||j_
dS)Nzmaking connection to managerZ
MainThread�|r�r])rr�rryr rpr�r�rr-r�rGrr	)r/r r�rrr�_connects

zBaseProxy._connectrcCs�	z|jj}Wnty!t�dt��j�|��|jj}Ynw|�	|j
|||f�|��\}}|dkr8|S|dkrn|\}}|jj
|jd}	|jj|_|	||j|j|j|d�}
|j|j|jd�}t|dd|jf�|
St||��)Nz#thread %r does not own a connectionr=r����rr�rc)rr	r�rr�rpr�r r!r>rr?rr�r,rr-r�r�r�rGr.r@)r/rBrCrDr�rErFr�r�r�rrrr�_callmethod%s4��

�
zBaseProxy._callmethodcCs	|�d�S)Nr��r#r1rrr�	_getvalueCs
zBaseProxy._getvaluec	Cs�|jr
t�d|jj�dS|j|jj|jd�}t|dd|j	f�t�d|jj�|j
�|j	�|jo5|jj
}tj|tj|j|j||j|j
|jfdd�|_dS)Nz%owned_by_manager skipped INCREF of %rr�rbz	INCREF %r�
r�)rrr�rr.r�r-r�rGrr�addrr�r�r�_decrefrZ_close)r/r�r5rrrrIs
��zBaseProxy._increfc
Cs�|�|j�|dus|jtjkrBzt�d|j�||j|d�}t|dd|jf�Wnt	yA}zt�d|�WYd}~nd}~wwt�d|j�|sbt
|d�rdt�dt��j
�|j��|`dSdSdS)Nz	DECREF %rr�rcz... decref failed %sz%DECREF %r -- manager already shutdownr	z-thread %r has no more proxies so closing conn)�discardr.r�r�r�rr�r-rGr�r�rpr�r r	r�)r�rjr5ZtlsZidsetr�r�r�rrrr(]s$���
�zBaseProxy._decrefc
CsJd|_z|��WdSty$}zt�d|�WYd}~dSd}~ww)Nzincref failed: %s)rrr�rr�)r/r�rrrrvs��zBaseProxy._after_forkcCsZi}t�dur|j|d<t|dd�r!|j|d<tt|j|j|ffStt|�|j|j|ffS)Nrj�_isautoFr�)	rr�rr��RebuildProxyrrr�r�r/rDrrrr~s


��zBaseProxy.__reduce__cCrr)r%)r/Zmemorrr�__deepcopy__�r�zBaseProxy.__deepcopy__cCsdt|�j|jjt|�fS)Nz<%s object, typeid %r at %#x>)rr8rr,r.r1rrrr9�s�zBaseProxy.__repr__cCs6	z|�d�WStyt|�dd�dYSw)Nr9r"z; '__str__()' failed>)r#r�r�r1rrrrQ�s�zBaseProxy.__str__�NNNTF)r8r:r;r�rZForkAwareThreadLockrr0r!r#r%rrr(rrr-r9rQrrrrr�s$
�)	

rcCs�	tt��dd�}|r+|j|jkr+t�d|�d|d<|j|jvr+|j|j|j|j<|�	dd�o9tt��dd�}|||fd|i|��S)Nrzz*Rebuild a proxy owned by manager, token=%rTrrbZ_inheritingF)
rrryr-rr�r.rorm�pop)rVr�rsrDr�rbrrrr+�s

��r+cCsp	t|�}z|||fWStyYnwi}|D]}td||f|�qt|tf|�}||_||||f<|S)NzOdef %s(self, /, *args, **kwds):
        return self._callmethod(%r, args, kwds))r�r��execrrr�)r r��_cacheZdicZmeth�	ProxyTyperrr�
MakeProxyType�s$���r3cCs�	t|d}|dur&||j|d�}zt|dd|f�}W|��n|��w|dur1|dur1|j}|dur:t��j}td|j	|�}	|	||||||d�}
d|
_
|
S)Nrr�r^z
AutoProxy[%s])rrjrbrT)rkr-rGr�r�rryrjr3r,r*)r�rsrrjr�rbrr�r�r2rrrrr�s"

�rc@r)�	NamespacecKs|j�|�dSr)r�updater,rrrr0�r3zNamespace.__init__cCsZt|j���}g}|D]\}}|�d�s|�d||f�q|��d|jjd�|�fS)NrXz%s=%rz%s(%s)z, )	r&rr#�
startswithrTr�r7r8r�)r/r#rUr r�rrrr9�s
�zNamespace.__repr__N)r8r:r;r0r9rrrrr4�rr4c@s8eZdZddd�Zdd�Zdd�Zdd	�Zeee�Zd
S)�ValueTcC�||_||_dSr)�	_typecode�_value)r/rr��lockrrrr0��
zValue.__init__cCr�r�r:r1rrrr��sz	Value.getcCs
||_dSrr=�r/r�rrrr���
z	Value.setcCsdt|�j|j|jfS)Nz
%s(%r, %r))rr8r9r:r1rrrr9�szValue.__repr__N�T)	r8r:r;r0r�r�r9r
r�rrrrr7�s
r7cCst�||�Sr)r)r�sequencer;rrr�Array�r�rBc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�
IteratorProxy)�__next__r>�throwr�cC�|Srrr1rrr�__iter__r�zIteratorProxy.__iter__cG�|�d|�S)NrDr$�r/rCrrrrD
r�zIteratorProxy.__next__cGrH)Nr>r$rIrrrr>r�zIteratorProxy.sendcGrH)NrEr$rIrrrrEr�zIteratorProxy.throwcGrH)Nr�r$rIrrrr�r�zIteratorProxy.closeN)	r8r:r;r�rGrDr>rEr�rrrrrCsrCc@s2eZdZdZddd�Zdd�Zdd	�Zd
d�ZdS)
�
AcquirerProxy)�acquire�releaseTNcCs"|dur|fn||f}|�d|�S�NrKr$)r/Zblockingr�rCrrrrKszAcquirerProxy.acquirecC�
|�d�S�NrLr$r1rrrrLr?zAcquirerProxy.releasecCrNrMr$r1rrrr�r?zAcquirerProxy.__enter__cCrNrOr$r�rrrr�r?zAcquirerProxy.__exit__)TN)r8r:r;r�rKrLr�r�rrrrrJs
rJc@s6eZdZdZddd�Zd
dd�Zdd	�Zdd
d�ZdS)�ConditionProxy)rKrLr��notify�
notify_allNcC�|�d|f�S�Nr�r$r�rrrr�#r*zConditionProxy.waitrcCrS)NrQr$)r/�nrrrrQ%r*zConditionProxy.notifycCrN)NrRr$r1rrrrR'r?zConditionProxy.notify_allcCsj|�}|r|S|durt��|}nd}d}|s3|dur)|t��}|dkr)	|S|�|�|�}|r|S)Nr)�time�	monotonicr�)r/Z	predicater�rFZendtimeZwaittimerrr�wait_for)s"
��zConditionProxy.wait_forr)r)r8r:r;r�r�rQrRrXrrrrrP!s

rPc@s2eZdZdZdd�Zdd�Zdd�Zdd	d
�ZdS)�
EventProxy)rr�rr�cCrN)Nrr$r1rrrr>r?zEventProxy.is_setcCrN�Nr�r$r1rrrr�@r?zEventProxy.setcCrN)Nrr$r1rrrrBr?zEventProxy.clearNcCrSrTr$r�rrrr�Dr*zEventProxy.waitr)r8r:r;r�rr�rr�rrrrrY<srYc@sNeZdZdZddd�Zdd�Zdd�Zed	d
��Zedd��Z	ed
d��Z
dS)�BarrierProxy)�__getattribute__r��abort�resetNcCrSrTr$r�rrrr�Jr*zBarrierProxy.waitcCrN)Nr]r$r1rrrr]Lr?zBarrierProxy.abortcCrN)Nr^r$r1rrrr^Nr?zBarrierProxy.resetcC�|�dd�S)Nr\)�partiesr$r1rrrr`P�zBarrierProxy.partiescCr_)Nr\)�	n_waitingr$r1rrrrbSrazBarrierProxy.n_waitingcCr_)Nr\)�brokenr$r1rrrrcVrazBarrierProxy.brokenr)r8r:r;r�r�r]r^r
r`rbrcrrrrr[Hs


r[c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�NamespaceProxy)r\�__setattr__�__delattr__cCs0|ddkrt�||�St�|d�}|d|f�S)NrrXr#r\)�objectr\�r/r	�
callmethodrrr�__getattr__]�zNamespaceProxy.__getattr__cCs4|ddkr
t�|||�St�|d�}|d||f�S)NrrXr#re)rgrer\)r/r	r�rirrrrebszNamespaceProxy.__setattr__cCs0|ddkrt�||�St�|d�}|d|f�S)NrrXr#rf)rgrfr\rhrrrrfgrkzNamespaceProxy.__delattr__N)r8r:r;r�rjrerfrrrrrd[s
rdc@s4eZdZdZdd�Zdd�Zeee�Zee	j
�ZdS)�
ValueProxy)r�r�cCrN)Nr�r$r1rrrr�pr?zValueProxy.getcCrSrZr$r>rrrr�rr*zValueProxy.setN)r8r:r;r�r�r�r
r�r�types�GenericAlias�__class_getitem__rrrrrlns
rl�
BaseListProxy)�__add__�__contains__�__delitem__�__getitem__�__len__�__mul__�__reversed__�__rmul__�__setitem__rT�count�extend�index�insertr/�remove�reverser��__imul__c@r)�	ListProxycC�|�d|f�|S)Nr{r$r>rrr�__iadd__��zListProxy.__iadd__cCr�)Nr�r$r>rrrr��r�zListProxy.__imul__N)r8r:r;r�r�rrrrr�sr��	DictProxy)rrrsrtrGruryrrr�r#r$r/�popitem�
setdefaultr5r%rG�Iterator�
ArrayProxy)rurtry�	PoolProxy)Zapply�apply_asyncr��imap�imap_unorderedr��map�	map_async�starmap�
starmap_asyncr�ZAsyncResult)r�r�r�r�r�c@r)r�cCrFrrr1rrrr��r�zPoolProxy.__enter__cCr�r)r�r�rrrr��r�zPoolProxy.__exit__N)r8r:r;r�r�rrrrr��rc@seZdZdS)rN)r8r:r;rrrrr�sr�QueueZ
JoinableQueuerwrq�RLock�	Semaphore�BoundedSemaphore�	Condition�Barrier�Poolr&r�)r�r)rc@sJeZdZ	gfdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�_SharedMemoryTrackercCr8r�Zshared_memory_context_name�
segment_names)r/r r�rrrr0�r<z_SharedMemoryTracker.__init__cCs*	t�d|�dt����|j�|�dS)NzRegister segment � in pid )rr�rr�rT�r/�segment_namerrr�register_segment�sz%_SharedMemoryTracker.register_segmentcCsD	t�d|�dt����|j�|�t�|�}|��|��dS)NzDestroy segment r�)	rr�rr�r~r�SharedMemoryr��unlink)r/r�Zsegmentrrr�destroy_segment�s
z$_SharedMemoryTracker.destroy_segmentcCs$	|jdd�D]}|�|�qdSr)r�r�r�rrrr��s�z_SharedMemoryTracker.unlinkcCs(t�d|jj�dt����|��dS)NzCall z.__del__ in )rr�r7r8rr�r1rrr�__del__�sz_SharedMemoryTracker.__del__cCs|j|jfSrr�r1rrrr2�r�z!_SharedMemoryTracker.__getstate__cCs|j|�dSr)r0r4rrrr6�r*z!_SharedMemoryTracker.__setstate__N)
r8r:r;r0r�r�r�r�r2r6rrrrr��s	r�c@sJeZdZejgd�Zdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dS)�SharedMemoryServer)�
track_segment�release_segment�
list_segmentscOs`tj|g|�Ri|��|j}t|t�rt�|�}td|�dt����|_	t
�dt����dS)NZshm_rXz"SharedMemoryServer started by pid )rZr0r-rKrg�os�fsdecoder�r�shared_memory_contextrr�)r/rC�kwargsr-rrrr0�s

�zSharedMemoryServer.__init__cOs<	t|j|dd�r|j|d<tj|||g|�Ri|��S)Nr"Z_shared_memory_proxyr�)r�rhr�rZr\)r/rAr,rCr�rrrr\s
zSharedMemoryServer.createcCs	|j��t�||�Sr)r�r�rZr[r�rrrr[s
zSharedMemoryServer.shutdowncC�	|j�|�dSr)r�r��r/rAr�rrrr�sz SharedMemoryServer.track_segmentcCr�r)r�r�r�rrrr�sz"SharedMemoryServer.release_segmentcCs
	|jjSr)r�r�r�rrrr�sz SharedMemoryServer.list_segmentsN)r8r:r;rZr�r0r\r[r�r�r�rrrrr��s�

r�c@s:eZdZ	eZdd�Zdd�Zdd�Zdd�Zd	d
�Z	dS)rcOsTtjdkrddlm}|��tj|g|�Ri|��t�|j	j
�dt����dS)N�posixr)�resource_trackerz created by pid )r�r �r�Zensure_runningrr0rr�r7r8r)r/rCr�r�rrrr0/s

zSharedMemoryManager.__init__cCst�|jj�dt����dS)Nz.__del__ by pid )rr�r7r8rr1rrrr�;szSharedMemoryManager.__del__cCsf	|jjtjkr'|jjtjkrtd��|jjtjkrtd��td�|jj���|�|j	|j
|j|j�S)Nz"Already started SharedMemoryServerz!SharedMemoryManager has shut downr�)
r�r�r�r�r�rr�rNr�r�r�r�r�r1rrrr�?s��zSharedMemoryManager.get_servercCs�	|j|j|jd��/}tjdd|d�}zt|dd|jf�Wnty0}z|��|�d}~wwWd�|S1s<wY|S)Nr�T)r\�sizer�)	r�r�r�rr�rGr �
BaseExceptionr�)r/r�r�Zsmsr�rrrr�Ls���
��z SharedMemoryManager.SharedMemorycCs�	|j|j|jd��.}t�|�}zt|dd|jjf�Wnty/}z|j�	�|�d}~wwWd�|S1s;wY|S)Nr�r�)
r�r�r�r�
ShareableListrGZshmr r�r�)r/rAr�Zslr�rrrr�Xs

���
��z!SharedMemoryManager.ShareableListN)
r8r:r;r�r�r0r�r�r�r�rrrrr#s	
r.r@)U�__all__r�rpr�r�queuerVrmr�rr�rr�r	�contextr
rrr
rrrr�ImportErrorZ	HAS_SHMEMrTrr
Z
view_typesr&r)Z	view_typergrrGr@r�rOrWrYrZr�rtruZXmlListenerZ	XmlClientrkrr�rrr+r3rr4r7rBrCrJrPrYr[rdrlrpr�r�r�r�Z
BasePoolProxyr�rr�rwrqr�r�r�r�r�r�r�r�r�rrrrr�<module>s�
�


P

�	w
4
�



	�

�

�%-�