Hacked By AnonymousFox

Current Path : /opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/managers.cpython-39.opt-2.pyc

a

R�fǸ�@sLgd�ZddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZmZmZddlmZdd	lmZdd
lmZddlmZzddlmZWney�d
ZYn0dZe�d�dd�Ze�eje�dd�dD�Zedeu�r8dd�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�Z4dmd3d4�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�rHGdhdi�di�ZRGdjdk�dke(�ZSGdld�de/�ZTdS)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/python39/lib64/python3.9/multiprocessing/managers.py�reduce_array/srcCsg|]}tti|����qSr)�type�getattr��.0�namerrr�
<listcomp>3�r )�items�keys�valuescCstt|�ffSr)�list��objrrr�rebuild_as_list5sr(c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r��typeid�address�idcCs||||_|_|_dSrr))�selfr*r+r,rrr�__init__DszToken.__init__cCs|j|j|jfSrr)�r-rrr�__getstate__GszToken.__getstate__cCs|\|_|_|_dSrr)�r-�staterrr�__setstate__JszToken.__setstate__cCsd|jj|j|j|jfS)Nz %s(typeid=%r, address=%r, id=%r))�	__class__�__name__r*r+r,r/rrr�__repr__Ms�zToken.__repr__N)r5�
__module__�__qualname__�	__slots__r.r0r3r6rrrrr>s
rrcCs8|�||||f�|��\}}|dkr*|St||��dS)N�#RETURN)�send�recv�convert_to_error)�cr,�
methodname�args�kwds�kind�resultrrr�dispatchUs
rDcCsd|dkr|S|dvrRt|t�s4td�||t|����|dkrHtd|�St|�Sntd�|��SdS)N�#ERROR)�
#TRACEBACK�#UNSERIALIZABLEz.Result {0!r} (kind '{1}') type is {2}, not strrGzUnserializable message: %s
zUnrecognized message type {!r})�
isinstance�str�	TypeError�formatr�RemoteError�
ValueError)rBrCrrrr=_s

��
r=c@seZdZdd�ZdS)rLcCsdt|jd�dS)NzM
---------------------------------------------------------------------------
rzK---------------------------------------------------------------------------)rIr@r/rrr�__str__oszRemoteError.__str__N)r5r7r8rNrrrrrLnsrLcCs2g}t|�D] }t||�}t|�r|�|�q|Sr)�dirr�callable�append)r'�tempr�funcrrr�all_methodsvs
rTcCsdd�t|�D�S)NcSsg|]}|ddkr|�qS)r�_rrrrrr �r!z"public_methods.<locals>.<listcomp>)rTr&rrr�public_methods�srVc@s�eZdZgd�Zdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Ze
ee	d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �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)rH�bytesrJrKr�registryr�AuthenticationString�authkey�listener_client�listenerr+�	id_to_obj�id_to_refcount�id_to_local_proxy_obj�	threading�Lock�mutex)r-rer+rg�
serializer�Listener�Clientrrrr.�s
��

zServer.__init__c	Cs�t��|_|t��_z�tj|jd�}d|_|�	�z|j�
�sL|j�d�q4Wntt
fydYn0Wtjtjkr�t�d�tjt_tjt_t�d�n2tjtjkr�t�d�tjt_tjt_t�d�0dS)N)�targetTrzresetting stdout, stderrr)rm�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-ryrrr�
serve_forever�s*



�
zServer.serve_forevercCsLz|j��}Wnty$YqYn0tj|j|fd�}d|_|��qdS)N�rsr@T)riZaccept�OSErrorrmrx�handle_requestrzr{)r-r>�trrrry�s
zServer.acceptercCs6d}}}z>t�||j�t�||j�|��}|\}}}}t||�}Wntyfdt�f}	YnB0z||g|�Ri|��}Wnty�dt�f}	Yn
0d|f}	z|�|	�Wnrt�y(}
zXz|�dt�f�Wnty�Yn0t	�
d|	�t	�
d|�t	�
d|
�WYd}
~
n
d}
~
00|��dS)NrFr:zFailure to send message: %rz ... request was %r� ... exception was %r)r	Zdeliver_challengergZanswer_challenger<r�	Exceptionrr;r�info�close)r-r>�funcnamerC�request�ignorer@rArS�msg�errrr��s2"zServer.handle_requestcCs�t�dt��j�|j}|j}|j}|j�	��sΐz:d}}|�}|\}}}	}
z||\}}}WnPt
y�}
z8z|j|\}}}Wnt
y�|
�Yn0WYd}
~
n
d}
~
00||vr�td|t
|�|f��t||�}z||	i|
��}Wn.t�y}zd|f}WYd}~nXd}~00|�o,|�|d�}|�rb|�|||�\}}t||j|�}d||ff}nd|f}Wn�t�y�|du�r�dt�f}nRz2|j|}|||||g|	�Ri|
��}d|f}Wnt�y�dt�f}Yn0YnLt�yt�dt��j�t�d�Ynt�y2dt�f}Yn0z4z||�Wn"t�yd|d	t�f�Yn0Wq$t�y�}zHt�d
t��j�t�d|�t�d|�|��t�d
�WYd}~q$d}~00q$dS)Nz$starting server thread to service %rz+method %r of %r object is not in exposed=%rrE�#PROXYr:rFz$got EOF -- exiting thread serving %rrrGzexception in thread serving %rz ... message was %rr�r)rr�rm�current_threadrr<r;rjrur|�KeyErrorrl�AttributeErrorrrr��getrYrr+r�fallback_mapping�EOFErrorr�r�r�r�)r-�connr<r;rjr?r'r��identr@rA�exposed�	gettypeid�keZfunction�resr�r�r*ZridentZrexposed�tokenZ
fallback_funcrCrrr�serve_client�s��� ��


�����zServer.serve_clientcCs|Srr�r-r�r�r'rrr�fallback_getvalue7szServer.fallback_getvaluecCst|�Sr�rIr�rrr�fallback_str:szServer.fallback_strcCst|�Sr)�reprr�rrr�
fallback_repr=szServer.fallback_repr)rNr6�	#GETVALUEcCsdSrr�r-r>rrrr^FszServer.dummyc
Cs�|j�vg}t|j���}|��|D]<}|dkr&|�d||j|t|j|d�dd�f�q&d�|�Wd�S1s�0YdS)Nrbz  %s:       refcount=%s
    %sr�K�
)	ror%rkr#�sortrQrIrj�join)r-r>rCr#r�rrrr\Is
��zServer.debug_infocCs
t|j�Sr)�lenrkr�rrrr]YszServer.number_of_objectscCsVzDzt�d�|�d�Wnddl}|��Yn0W|j��n|j��0dS)Nz!manager received shutdown message�r:Nr)rr�r;�	traceback�	print_excru�set)r-r>r�rrrrX`s
zServer.shutdowncOs|j��|j|\}}}}|durD|s2t|�dkr:td��|d}	n||i|��}	|durbt|	�}|dur�t|t�s�td�|t	|����t
|�t
|�}dt|	�}
t�
d||
�|	t|�|f|j|
<|
|jvr�d|j|
<Wd�n1s�0Y|�||
�|
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)rorer�rMrVrH�dictrJrKrr%r,rr�r�rjrkr_�tuple)r-r>r*r@rArPr��method_to_typeid�	proxytyper'r�rrrrYms6�
�

��
(z
Server.createcCst|j|jd�S)Nr)r�rjr,)r-r>r�rrrr[�szServer.get_methodscCs"|t��_|�d�|�|�dS)Nr�)rmr�rr;r�)r-r>rrrrrZ�s

zServer.accept_connectioncCs�|j��z|j|d7<Wnjty�}zR||jvrpd|j|<|j||j|<|j|\}}}t�d|�n|�WYd}~n
d}~00Wd�n1s�0YdS)Nrz&Server re-enabled tracking & INCREF %r)rorkr�rlrjrr�)r-r>r�r�r'r�r�rrrr_�s

�z
Server.increfcCs�||jvr$||jvr$t�d|�dS|j�d|j|dkrXtd�||j||j|���|j|d8<|j|dkr�|j|=Wd�n1s�0Y||jvr�d|j|<t�d|�|j�|j|=Wd�n1s�0YdS)NzServer DECREF skipping %rrz+Id {0!s} ({1!r}) has refcount {2:n}, not 1+r)NrNzdisposing of obj with id %r)rkrlrr�ro�AssertionErrorrKrj)r-r>r�rrrr`�s*
�
��&

z
Server.decrefN)r5r7r8�publicr.r�ryr�r�r�r�r�r�r^r\r]rXrYr[rZr_r`rrrrrW�s,
"Q�
$rWc@seZdZdgZdZdZdZdS)�State�valuerr�N)r5r7r8r9�INITIAL�STARTED�SHUTDOWNrrrrr��sr�)�pickleZ	xmlrpclibc@s�eZdZiZeZd!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\|durt��j}||_t�|�|_t�|_tj|j_	||_
t|\|_|_
|pTt�|_dSr)rrvrg�_addressrf�_authkeyr��_stater�r��_serializerrhZ	_Listener�_Clientr�_ctx)r-r+rgrp�ctxrrrr.�s

zBaseManager.__init__cCsf|jjtjkrP|jjtjkr&td��n*|jjtjkr>td��ntd�|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�rKrW�	_registryr�r�r�r/rrr�
get_server�s

�
�zBaseManager.get_servercCs8t|j\}}||j|jd�}t|dd�tj|j_dS)N�rgr^)	rhr�r�r�rDr�r�r�r�)r-rqrrr�rrr�connectszBaseManager.connectrc	Cs4|jjtjkrP|jjtjkr&td��n*|jjtjkr>td��ntd�|jj���|durht|�sht	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>(r!z$BaseManager.start.<locals>.<genexpr>�-r�r@Zexitpriority)!r�r�r�r�r�rr�rKrPrJr	ZPiper�ZProcessr�_run_serverr�r�r�r��_processr�Z	_identityr5rr{r�r<r�Finalize�_finalize_managerr�rX)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�)	�clsrer+rgrpr�r�r��serverrrrr�:szBaseManager._run_servercOsV|j|j|jd�}z&t|dd|f||�\}}W|��n
|��0t||j|�|fS)Nr�rY)r�r�r�rDr�r)r-r*r@rAr�r,r�rrr�_createQs
zBaseManager._createcCs*|jdur&|j�|�|j��s&d|_dSr)r�r��is_alive�r-�timeoutrrrr�]s

zBaseManager.joincCs8|j|j|jd�}zt|dd�W|��S|��0dS)Nr�r\�r�r�r�rDr��r-r�rrr�_debug_infofs�zBaseManager._debug_infocCs8|j|j|jd�}zt|dd�W|��S|��0dS)Nr�r]r�r�rrr�_number_of_objectsps�zBaseManager._number_of_objectscCsj|jjtjkr|��|jjtjkrf|jjtjkr<td��n*|jjtjkrTtd��ntd�|jj���|S)NzUnable to start serverr�r�)	r�r�r�r�r{r�rr�rKr/rrr�	__enter__zs

�zBaseManager.__enter__cCs|��dSr)rX�r-�exc_typeZexc_valZexc_tbrrr�__exit__�szBaseManager.__exit__cCs�|��r�t�d�z4|||d�}zt|dd�W|��n
|��0WntyXYn0|jdd�|��r�t�d�t|d�r�t�d�|��|jdd�|��r�t�d	�t	j
|_ztj
|=Wnty�Yn0dS)
Nz#sending shutdown message to managerr�rXg�?)r�zmanager still alive�	terminatez'trying to `terminate()` manager processz#manager still alive after terminate)r�rr�rDr�r�r��hasattrr�r�r�r�r�_address_to_localr�)rr+rgr2r�r�rrrr��s.




zBaseManager._finalize_managercCs|jSr)r�r/rrrr+�szBaseManager.addressTc
s�d|jvr|j��|_�dur"t�|p0t�dd�}|p@t�dd�}|r\t|���D]\}}qR|||�f|j�<|r���fdd�}	�|	_t|�|	�dS)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��managerrgr�r�r`)	rr�r�r�r�r�r+rDr,)r-r@rAr�Zexp�proxyr��r�r*rrrR�s�z"BaseManager.register.<locals>.temp)	�__dict__r��copy�	AutoProxyrr%r"r5�setattr)
r�r*rPr�r�r��
create_method�keyr�rRrr�r�register�s"

��

zBaseManager.register)NNr�N)Nr)Nr)N)NNNNT)r5r7r8r�rWr�r.r�r�r{�classmethodr�r�r�r�r�r�r��staticmethodr��propertyr+r�rrrrr�s2�
	
+�
	




�rc@seZdZdd�Zdd�ZdS)�ProcessLocalSetcCst�|dd��dS)NcSs|��Sr)�clearr&rrr�<lambda>�r!z*ProcessLocalSet.__init__.<locals>.<lambda>)r�register_after_forkr/rrrr.�szProcessLocalSet.__init__cCst|�dfSrc)rr/rrr�
__reduce__�szProcessLocalSet.__reduce__N)r5r7r8r.rrrrrr�src@s|eZdZiZe��Zddd�Zdd�Zdifd	d
�Z	dd�Z
d
d�Zedd��Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)rNTFc	Cs�tj�Btj�|jd�}|dur:t��t�f}|tj|j<Wd�n1sN0Y|d|_|d|_	||_
|j
j|_||_
||_t|d|_||_|dur�t�|�|_n"|j
dur�|j
j|_nt��j|_|r�|��t�|tj�dS)Nrr)r�_mutexr�r�r+rZForkAwareLocalr�_tls�_idset�_tokenr,�_id�_managerr�rhr��_owned_by_managerrrfr�rvrg�_increfr�_after_fork)	r-r�rpr�rgr�r_�
manager_ownedZ	tls_idsetrrrr.�s**



zBaseProxy.__init__cCsdt�d�t��j}t��jdkr4|dt��j7}|j|jj	|j
d�}t|dd|f�||j_
dS)Nzmaking connection to managerZ
MainThread�|r�rZ)rr�rrvrrmr�r�r
r+r�rDrr	)r-rr�rrr�_connects

zBaseProxy._connectrcCs�z|jj}Wn4ty@t�dt��j�|��|jj}Yn0|�	|j
|||f�|��\}}|dkrn|S|dkr�|\}}|jj
|jd}	|jj|_|	||j|j|j|d�}
|j|j|jd�}t|dd|jf�|
St||��dS)Nz#thread %r does not own a connectionr:r����r�r�r`)rr	r�rr�rmr�rrr;rr<rr�r*r
r+r�r�r�rDr,r=)r-r?r@rAr�rBrCr�r�r�r�rrr�_callmethods0�

�zBaseProxy._callmethodcCs
|�d�S)Nr��rr/rrr�	_getvalue;szBaseProxy._getvaluec	Cs�|jrt�d|jj�dS|j|jj|jd�}t|dd|j	f�t�d|jj�|j
�|j	�|joj|jj
}tj|tj|j|j||j|j
|jfdd�|_dS)Nz%owned_by_manager skipped INCREF of %rr�r_z	INCREF %r�
r�)r
rr�r
r,r�r+r�rDrr	�addrr�r�r�_decrefrZ_close)r-r�r2rrrrAs
��zBaseProxy._increfc
Cs�|�|j�|dus |jtjkr�z2t�d|j�||j|d�}t|dd|jf�Wq�t	y�}zt�d|�WYd}~q�d}~00nt�d|j�|s�t
|d�r�t�dt��j
�|j��|`dS)Nz	DECREF %rr�r`z... decref failed %sz%DECREF %r -- manager already shutdownr	z-thread %r has no more proxies so closing conn)�discardr,r�r�r�rr�r+rDr�r�rmr�rr	r�)r�rgr2ZtlsZidsetr�r�r�rrrrUs$�
zBaseProxy._decrefc
CsJd|_z|��Wn2tyD}zt�d|�WYd}~n
d}~00dS)Nzincref failed: %s)rrr�rr�)r-r�rrrrns
zBaseProxy._after_forkcCs^i}t�dur|j|d<t|dd�rB|j|d<tt|j|j|ffStt|�|j|j|ffSdS)Nrg�_isautoFr�)	rr�rr��RebuildProxyr�r
r�r�r-rArrrrvs


��zBaseProxy.__reduce__cCs|��Sr)r)r-�memorrr�__deepcopy__�szBaseProxy.__deepcopy__cCsdt|�j|jjt|�fS)Nz<%s object, typeid %r at %#x>)rr5r
r*r,r/rrrr6�s�zBaseProxy.__repr__cCs8z|�d�WSty2t|�dd�dYS0dS)Nr6rz; '__str__()' failed>)rr�r�r/rrrrN�szBaseProxy.__str__)NNNTF)r5r7r8r�rZForkAwareThreadLockrr.rrrrrrrrrr6rNrrrrr�s �
)	

rcCs�tt��dd�}|rT|j|jkrTt�d|�d|d<|j|jvrT|j|j|j|j<|�	dd�optt��dd�}|||fd|i|��S)Nrwz*Rebuild a proxy owned by manager, token=%rTrr_Z_inheritingF)
rrrvr+rr�r,rlrj�pop)rSr�rprAr�r_rrrr�s
�
�rcCsnt|�}z|||fWSty(Yn0i}|D]}td||f|�q2t|tf|�}||_||||f<|S)NzOdef %s(self, /, *args, **kwds):
        return self._callmethod(%r, args, kwds))r�r��execrrr�)rr��_cacheZdicZmeth�	ProxyTyperrr�
MakeProxyType�s ��r$cCs�t|d}|durJ||j|d�}zt|dd|f�}W|��n
|��0|dur`|dur`|j}|durrt��j}td|j	|�}	|	||||||d�}
d|
_
|
S)Nrr�r[z
AutoProxy[%s])r�rgr_rT)rhr+rDr�r�rrvrgr$r*r)r�rpr�rgr�r_rr�r�r#r�rrrr��s 

�r�c@seZdZdd�Zdd�ZdS)�	NamespacecKs|j�|�dSr)r��updaterrrrr.�szNamespace.__init__cCsZt|j���}g}|D]$\}}|�d�s|�d||f�q|��d|jjd�|�fS)NrUz%s=%rz%s(%s)z, )	r%r�r"�
startswithrQr�r4r5r�)r-r"rRrr�rrrr6�s
zNamespace.__repr__N)r5r7r8r.r6rrrrr%�sr%c@s8eZdZddd�Zdd�Zdd�Zdd	�Zeee�Zd
S)�ValueTcCs||_||_dSr)�	_typecode�_value)r-rr��lockrrrr.�szValue.__init__cCs|jSr�r*r/rrrr��sz	Value.getcCs
||_dSrr,�r-r�rrrr��sz	Value.setcCsdt|�j|j|jfS)Nz
%s(%r, %r))rr5r)r*r/rrrr6�szValue.__repr__N)T)	r5r7r8r.r�r�r6rr�rrrrr(�s

r(cCst�||�Sr)r)r�sequencer+rrr�Array�sr/c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�
IteratorProxy)�__next__r;�throwr�cCs|Srrr/rrr�__iter__szIteratorProxy.__iter__cGs|�d|�S)Nr1r�r-r@rrrr1szIteratorProxy.__next__cGs|�d|�S)Nr;rr4rrrr;szIteratorProxy.sendcGs|�d|�S)Nr2rr4rrrr2szIteratorProxy.throwcGs|�d|�S)Nr�rr4rrrr�szIteratorProxy.closeN)	r5r7r8r�r3r1r;r2r�rrrrr0�sr0c@s2eZdZdZddd�Zdd�Zdd	�Zd
d�ZdS)
�
AcquirerProxy)�acquire�releaseTNcCs"|dur|fn||f}|�d|�S�Nr6r)r-Zblockingr�r@rrrr6szAcquirerProxy.acquirecCs
|�d�S�Nr7rr/rrrr7szAcquirerProxy.releasecCs
|�d�Sr8rr/rrrr�szAcquirerProxy.__enter__cCs
|�d�Sr9rr�rrrr�szAcquirerProxy.__exit__)TN)r5r7r8r�r6r7r�r�rrrrr5s

r5c@s6eZdZdZddd�Zd
dd�Zdd	�Zdd
d�ZdS)�ConditionProxy)r6r7r}�notify�
notify_allNcCs|�d|f�S�Nr}rr�rrrr}szConditionProxy.waitrcCs|�d|f�S)Nr;r)r-�nrrrr;szConditionProxy.notifycCs
|�d�S)Nr<rr/rrrr<szConditionProxy.notify_allcCsd|�}|r|S|dur$t��|}nd}d}|s`|durN|t��}|dkrNq`|�|�|�}q,|S)Nr)�time�	monotonicr})r-Z	predicater�rCZendtimeZwaittimerrr�wait_for!s
zConditionProxy.wait_for)N)r)N)r5r7r8r�r}r;r<rArrrrr:s


r:c@s2eZdZdZdd�Zdd�Zdd�Zdd	d
�ZdS)�
EventProxy)r|r�rr}cCs
|�d�S)Nr|rr/rrrr|6szEventProxy.is_setcCs
|�d�S�Nr�rr/rrrr�8szEventProxy.setcCs
|�d�S)Nrrr/rrrr:szEventProxy.clearNcCs|�d|f�Sr=rr�rrrr}<szEventProxy.wait)N)r5r7r8r�r|r�rr}rrrrrB4s
rBc@sNeZdZdZddd�Zdd�Zdd�Zed	d
��Zedd��Z	ed
d��Z
dS)�BarrierProxy)�__getattribute__r}�abort�resetNcCs|�d|f�Sr=rr�rrrr}BszBarrierProxy.waitcCs
|�d�S)NrFrr/rrrrFDszBarrierProxy.abortcCs
|�d�S)NrGrr/rrrrGFszBarrierProxy.resetcCs|�dd�S)NrE)�partiesrr/rrrrHHszBarrierProxy.partiescCs|�dd�S)NrE)�	n_waitingrr/rrrrIKszBarrierProxy.n_waitingcCs|�dd�S)NrE)�brokenrr/rrrrJNszBarrierProxy.broken)N)r5r7r8r�r}rFrGrrHrIrJrrrrrD@s


rDc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�NamespaceProxy)rE�__setattr__�__delattr__cCs0|ddkrt�||�St�|d�}|d|f�S)NrrUrrE)�objectrE�r-r��
callmethodrrr�__getattr__UszNamespaceProxy.__getattr__cCs4|ddkrt�|||�St�|d�}|d||f�S)NrrUrrL)rNrLrE)r-r�r�rPrrrrLZszNamespaceProxy.__setattr__cCs0|ddkrt�||�St�|d�}|d|f�S)NrrUrrM)rNrMrErOrrrrM_szNamespaceProxy.__delattr__N)r5r7r8r�rQrLrMrrrrrKSsrKc@s4eZdZdZdd�Zdd�Zeee�Zee	j
�ZdS)�
ValueProxy)r�r�cCs
|�d�S)Nr�rr/rrrr�hszValueProxy.getcCs|�d|f�SrCrr-rrrr�jszValueProxy.setN)r5r7r8r�r�r�rr�r��types�GenericAlias�__class_getitem__rrrrrRfs

rR�
BaseListProxy)�__add__�__contains__�__delitem__�__getitem__�__len__�__mul__�__reversed__�__rmul__�__setitem__rQ�count�extend�index�insertr �remove�reverser��__imul__c@seZdZdd�Zdd�ZdS)�	ListProxycCs|�d|f�|S)Nrarr-rrr�__iadd__xszListProxy.__iadd__cCs|�d|f�|S)Nrfrr-rrrrf{szListProxy.__imul__N)r5r7r8rhrfrrrrrgwsrg�	DictProxy)rXrYrZr3r[r_rr�r�r"r#r �popitem�
setdefaultr&r$r3�Iterator�
ArrayProxy)r[rZr_�	PoolProxy)Zapply�apply_asyncr��imap�imap_unorderedr��map�	map_async�starmap�
starmap_asyncr�ZAsyncResult)rorsrurprqc@seZdZdd�Zdd�ZdS)rncCs|Srrr/rrrr��szPoolProxy.__enter__cCs|��dSr)r�r�rrrr��szPoolProxy.__exit__N)r5r7r8r�r�rrrrrn�sc@seZdZdS)rN)r5r7r8rrrrr�sr�QueueZ
JoinableQueuertrn�RLock�	Semaphore�BoundedSemaphore�	Condition�Barrier�Poolr%r�)r�r�)r�c@sHeZdZgfdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�_SharedMemoryTrackercCs||_||_dSr�Zshared_memory_context_name�
segment_names)r-rrrrrr.�sz_SharedMemoryTracker.__init__cCs(t�d|�dt����|j�|�dS)NzRegister segment � in pid )rr�rrrQ�r-�segment_namerrr�register_segment�sz%_SharedMemoryTracker.register_segmentcCsBt�d|�dt����|j�|�t�|�}|��|��dS)NzDestroy segment r�)	rr�rrrdr�SharedMemoryr��unlink)r-r�Zsegmentrrr�destroy_segment�s

z$_SharedMemoryTracker.destroy_segmentcCs"|jdd�D]}|�|�qdSr)rr�r�rrrr��sz_SharedMemoryTracker.unlinkcCs(t�d|jj�dt����|��dS)NzCall z.__del__ in )rr�r4r5rr�r/rrr�__del__�sz_SharedMemoryTracker.__del__cCs|j|jfSrr~r/rrrr0�sz!_SharedMemoryTracker.__getstate__cCs|j|�dSr)r.r1rrrr3�sz!_SharedMemoryTracker.__setstate__N)
r5r7r8r.r�r�r�r�r0r3rrrrr}�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�r2t�|�}td|�dt����|_	t
�dt����dS)NZshm_rUz"SharedMemoryServer started by pid )rWr.r+rHrd�os�fsdecoder}r�shared_memory_contextrr�)r-r@�kwargsr+rrrr.�s

�zSharedMemoryServer.__init__cOs:t|j|dd�r|j|d<tj|||g|�Ri|��S)NrZ_shared_memory_proxyr�)r�rer�rWrY)r-r>r*r@r�rrrrY�s
zSharedMemoryServer.createcCs|j��t�||�Sr)r�r�rWrXr�rrrrXs
zSharedMemoryServer.shutdowncCs|j�|�dSr)r�r��r-r>r�rrrr�sz SharedMemoryServer.track_segmentcCs|j�|�dSr)r�r�r�rrrr�sz"SharedMemoryServer.release_segmentcCs|jjSr)r�rr�rrrr�sz SharedMemoryServer.list_segmentsN)r5r7r8rWr�r.rYrXr�r�r�rrrrr��s�

r�c@s8eZdZeZdd�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_runningrr.rr�r4r5r)r-r@r�r�rrrr.'s

zSharedMemoryManager.__init__cCst�|jj�dt����dS)Nz.__del__ by pid )rr�r4r5rr/rrrr�3szSharedMemoryManager.__del__cCsh|jjtjkrP|jjtjkr&td��n*|jjtjkr>td��ntd�|jj���|�|j	|j
|j|j�S)Nz"Already started SharedMemoryServerz!SharedMemoryManager has shut downr�)
r�r�r�r�r�rr�rKr�r�r�r�r�r/rrrr�7s

��zSharedMemoryManager.get_servercCs�|j|j|jd��h}tjdd|d�}zt|dd|jf�Wn0tyj}z|��|�WYd}~n
d}~00Wd�n1s�0Y|S)Nr�T)rY�sizer�)	r�r�r�rr�rDr�
BaseExceptionr�)r-r�r�Zsmsr�rrrr�Ds8z SharedMemoryManager.SharedMemorycCs�|j|j|jd��f}t�|�}zt|dd|jjf�Wn2tyh}z|j�	�|�WYd}~n
d}~00Wd�n1s~0Y|S)Nr�r�)
r�r�r�r�
ShareableListrDZshmrr�r�)r-r.r�Zslr�rrrr�Ps

8z!SharedMemoryManager.ShareableListN)
r5r7r8r�r�r.r�r�r�r�rrrrrs

)NNNTF)T)U�__all__r�rmr�rZqueuer?rSr�rr�rr�r	�contextr
rrr
rrrr�ImportErrorZ	HAS_SHMEMrQrr�Z
view_typesr%r(Z	view_typerNrrDr=r�rLrTrVrWr�rqrrZXmlListenerZ	XmlClientrhrr�rrrr$r�r%r(r/r0r5r:rBrDrKrRrVrgrir�rmZ
BasePoolProxyrnrrvrtrnrwrxryrzr{r|r�r}r�rrrrr�<module>s�



H

�	w
4�



	
�

�

�%-

Hacked By AnonymousFox1.0, Coded By AnonymousFox