+
    iR  c            
       s	   . RdOt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RI
Ht ^ RIHt ^RIHt ^RIHtHtHt ^R	IHt ^R
IHt ^RIHt ^RIHt  ^RIHt Rt] P5                  R4       R t]P:                  ! ]P                  ]4       Re U u. uF  p ]! ]! / V 4      ! 4       4      NK  	  up t R t!]  F  t"]P:                  ! ]"]!4       K  	  A"A  ! R R]#4      t$Rf/ 3R lt%R t& ! R R]'4      t(R t)R t* ! R R]#4      t+ ! R R]#4      t,R]PZ                  ]P\                  3R]P^                  ]P`                  3/t1 ! R  R ]#4      t2 ! R! R"]34      t4 ! R# R]#4      t5R$ t6/ 3R% lt7RgR& lt8 ! R' R(]#4      t9 ! R) R*]#4      t:RhR+ lt; ! R, R-]54      t< ! R. R/]54      t= ! R0 R1]=4      t> ! R2 R3]54      t? ! R4 R5]54      t@ ! R6 R7]54      tA ! R8 R9]54      tB]7! R:Ri4      tC ! R; R<]C4      tD]P                  P                  P;                  ]C4       ]7! R=Rj4      tGR>R?/]GnH         ! R@ RA]G4      tI]P                  P                  P;                  ]G4       ]7! RBRk4      tK ! RC RD]K4      tL]P                  P                  P;                  ]K4       ]7! RERl4      tM]7! RFRm4      tNRGRLRJRLRKRLRHR?RIR?/]NnH         ! RM RF]N4      tO ! RN R]24      tP]PP;                  RO]P                  4       ]PP;                  RP]P                  4       ]PP;                  RQ]P                  ]?4       ]PP;                  RR]P                  ]=4       ]PP;                  RS]P                  ]=4       ]PP;                  RT]P                  ]=4       ]PP;                  RU]P                  ]=4       ]PP;                  RV]P                  ]>4       ]PP;                  RW]P                  ]@4       ]PP;                  RX]P                  ]O4       ]PP;                  RY]Z]D4       ]PP;                  RZ][]I4       ]PP;                  R[]3]L4       ]PP;                  R*]:]B4       ]PP;                  R\];]M4       ]PP;                  R(]9]A4       ]PP;                  R?]<RR]7       ]PP;                  RLRR^7       ]'       d#    ! R_ R`4      t\ ! Ra Rb]+4      t] ! Rc R]24      t^R# R#   ] d    Rt ELHi ; iu up i )nBaseManagerSyncManager	BaseProxyTokenN)getpid)
format_exc)
connection)	reductionget_spawning_popenProcessError)pool)process)util)get_context)shared_memoryTSharedMemoryManagerFc                 sZ    \         P                   V P                  V P                  4       33# N)arraytypecodeZtobytes)Za   &1/usr/lib64/python3.14/multiprocessing/managers.pyreduce_arrayr   0   s     ;;QYY[111    c                 s&    \         \        V 4      33# r   )listobjr   r   rebuild_as_listr   5   s    $s)r   c                   s@   a  ] tR t^?t o RtRtR tR tR tR t	Rt
V tR# )	r   z+
Type to uniquely identify a shared object
c                s0    WVuV n         V n        V n        R # r   typeidaddressid)selfr   r   r      &&&&r   __init__ZToken.__init__E   s    06,dlDGr   c                sH    V P                   V P                  V P                  3# r   r   r   r   r   __getstate__ZToken.__getstate__H   s    T\\47733r   c                s0    Vw  V n         V n        V n        R # r   r   r   state   &&r   __setstate__ZToken.__setstate__K   s    /4,dlDGr   c                s    V P                   P                  : R V P                  : RV P                  : RV P                  : R2# )z(typeid=z
, address=z, id=))	__class____name__r   r   r   r"   r   r   __repr__ZToken.__repr__N   s-    ''dllDGGM 	Mr   )r   r   r   Nr   )r*   
__module____qualname____firstlineno____doc__	__slots__r!   r#   r'   r+   __static_attributes____classdictcell__Z__classdict__   @r   r   r   ?   s-      ,IE45M Mr   c                s    V P                  WW434       V P                  4       w  rVVR8X  d   V#  \        WV4      h  ?i ; i)zD
Send a message to manager using connection `c` and return response
#RETURN)sendrecvconvert_to_error)cr   
methodnameargskwdskindresult   &&&&&  r   dispatchr@   V   sD     FFBD'(668LDyt,,s   ; >c           	      s   V R 8X  d   V# V R9   d_   \        V\        4      '       g%   \        RP                  W\	        V4      4      4      hV R8X  d   \        RV,          4      # \        V4      # \        RP                  V 4      4      # )#ERROR#UNSERIALIZABLEz.Result {0!r} (kind '{1}') type is {2}, not strzUnserializable message: %s
zUnrecognized message type {!r})
#TRACEBACKrB   )
isinstancestr	TypeErrorformattypeRemoteError
ValueError)r=   r>   r&   r   r8   r8   c   s    x	2	2&#&&@GG$v,01 1 $$=FGGv&&:AA$GHHr   c                   s&   a  ] tR t^rt o R tRtV tR# )rI   c                sV    R\        V P                  ^ ,          4      ,           R,           # )
zK---------------------------------------------------------------------------zM
---------------------------------------------------------------------------
)rE   r;   r"   r   r   __str__ZRemoteError.__str__s   s    $s499Q<'886ABr    N)r*   r,   r-   r.   rL   r1   r2   r3   r4   r   rI   rI   r   s     C Cr   rI   c                s    . p\        V 4       F2  p\        W4      p\        V4      '       g   K!  VP                  V4       K4  	  V# )z,
Return a list of names of methods of `obj`
)Zdirgetattrcallableappend)r   tempnamefunc   &   r   all_methodsrU   z   s=     DCs!D>>KK  Kr   c                s`    \        V 4       Uu. uF  q^ ,          R8w  g   K  VNK  	  up# u upi )zH
Return a list of names of methods of `obj` which do not start with '_'
_)rU   )r   rR      & r   public_methodsrX      s-     )-@-TaCDD-@@@s   ++c                   s   a  ] tR t^t o Rt. ROtR tR tR tR t	R t
R tR tR	 tR
 tR]R]R]/tR tR tR tR tR tR tR tR tR tRtV tR# )ServerzE
Server class which runs in a process controlled by a manager object
c                s   \        V\        4      '       g%   \        R P                  V\	        V4      4      4      hWn        \        P                  ! V4      V n        \        V,          w  rVV! V^R7      V n
        V P                  P                  V n        RR/V n        / V n        / V n        \        P                   ! 4       V n        R# )z&Authkey {0!r} is type {1!s}, not bytes)r   Zbacklog0NNrM   )rD   bytesrF   rG   rH   registryr   AuthenticationStringauthkeylistener_clientlistenerr   	id_to_objid_to_refcountid_to_local_proxy_obj	threadingLockmutex)r   r]   r   r_   
serializerListenerClientr?   r   r!   ZServer.__init__   s    '5))8??T'],- - !33G<*:6 !#>}},,z* %'"^^%
r   c                s   \         P                  ! 4       V n        V \        P                  ! 4       n         \         P                  ! V P                  R7      pRVn        VP                  4         V P                  P                  4       '       g   V P                  P                  ^4       K=   \        P                  \        P                   8w  dI   \"        P$                  ! R4       \        P                   \        n        \        P&                  \        n        \        P*                  ! ^ 4       R#   \        \        3 d     Li ; i  \        P                  \        P                   8w  dI   \"        P$                  ! R4       \        P                   \        n        \        P&                  \        n        \        P*                  ! ^ 4       i ; i)z
Run the server forever
)targetTzresetting stdout, stderrN)re   Event
stop_eventr   current_process_manager_serverThreadaccepterdaemonstartis_setwaitZKeyboardInterrupt
SystemExitsysZstdoutZ
__stdout__r   debugZ
__stderr__Zstderrexit)r   rq   rW   r   serve_foreverZServer.serve_forever   s    $//+48!1	 ''t}}=H"HONN//0022OO((+ 3
 zzS^^+

56 ^^
 ^^
HHQK &z2  zzS^^+

56 ^^
 ^^
HHQKs6   8E /D0 D0 ,E 0EE EE BG
c                s      V P                   P                  4       p\        P                  ! T P
                  T3R7      pR Tn        TP                  4        KX    \         d     Kf  i ; i)Trk   r;   )ra   ZacceptZOSErrorre   rp   handle_requestrr   rs   )r   r9   Zt   &  r   rq   ZServer.accepter   s\    MM((*   (;(;1$GAAHGGI	  s   A A('A(c                s   R p \         P                  ! WP                  4       \         P                  ! WP                  4       VP	                  4       pVw  r4rVW@P
                  9   g   Q RV,          4       h\        W4      p V! V.VO5/ VB pRV3p	 TP                  T	4       R #   \         d    R\        4       3p	 L-i ; i  \         d    R\        4       3p	 LJi ; i  \         d   p
 TP                  R\        4       34       M  \         d     Mi ; i\        P                  ! RT	4       \        P                  ! RT4       \        P                  ! RT
4        R p
?
R # R p
?
ii ; i)Nz%r unrecognizedr5   rC   zFailure to send message: %rz ... request was %r ... exception was %r)r   Zdeliver_challenger_   Zanswer_challenger7   publicrN   	Exceptionr   r6   r   info)r   r9   requestZignoreZfuncnamer;   r<   rS   r>   msges   &&         r   _handle_requestZServer._handle_request   sC   	*((LL9''<<8ffhG+2(Fd{{*H,=,HH*4*D*a/$/$/ !&)		2FF3K  3#Z\23  	/.C	/  	2jl34 II3S9II+W5II-q11	2s[   A>C B' C! 'C CCC!E*-D	E%	DE%DAE%%E*c                s     V P                  V4       VP                  4        R#   \         d     Li ; i  TP                  4        i ; i)z
Handle a new connection
N)r   rv   closer   connr&   r   r|   ZServer.handle_request   s@    	  &
 JJL	  		 JJLs   % 36 36 Ac                sh   \         P                  ! R\        P                  ! 4       P                  4       VP
                  pVP                  pV P                  pV P                  P                  4       '       g    R;rVV! 4       pVw  rr WH,          w  rkpY[9  d!   \        RT: R\        T4      : RT: 24      h\        Ye4      p T! T	/ T
B pT;'       d    TP                  TR4      pT'       d5   T P!                  TTT4      w  pp\#        TT P$                  T4      pRTT33pMRT3p   T! X4       K  R#   \         d3   p T P                  T,          w  rkp Rp?L  \         d    Thi ; iRp?ii ; i  \&         d   pRT3p Rp?LbRp?ii ; i  \         dZ    Xf   R	\)        4       3p L T P*                  T,          pT! YXX.X	O5/ X
B pRT3p L  \&         d    R	\)        4       3p  Li ; i\,         dO    \         P                  ! R
\        P                  ! 4       P                  4       \.        P0                  ! ^ 4        EL$\&         d    R	\)        4       3p EL=i ; i  \&         d    T! R\)        4       34        EK5  i ; i  \&         d   p\         P2                  ! R\        P                  ! 4       P                  4       \         P2                  ! RX4       \         P2                  ! RT4       TP5                  4        \.        P0                  ! ^4        Rp?EK  Rp?ii ; i)zA
Handle requests from the proxies in a particular process/thread
z$starting server thread to service %rNzmethod z of z object is not in exposed=#PROXYr5   rA   rC   z$got EOF -- exiting thread serving %rrB   zexception in thread serving %rz ... message was %rr~   )r   rx   re   current_threadrR   r7   r6   rb   rm   rt   KeyErrorrd   AttributeErrorrH   rN   getcreater   r   r   r   fallback_mappingZEOFErrorrw   ry   r   r   )r   r   r7   r6   rb   r:   r   r   identr;   r<   exposedZ	gettypeidkeZfunctionZresr   ZridentZrexposedtokenr   r   Zfallback_funcr>   s   &&                      r   serve_clientZServer.serve_client   s    	

9++-22	4 yyyyNN	//((**53#''
&07-4!.7.>+C) ,(#T#Y9 
 #33/"D1D1C 'JJ9==T+JF+/;;tVS+I( %fdllF C'(E):;(#..<Iw +   !! 66u= 0i# ! !	!" ! (#Q-C( " ;%'6C;(,(=(=j(I!. s"59"=A"  )&1$ ;+Z\:;  

A$335::< 3#Z\23 ! <+Z\:;;< 		:!002779		/5		115

s   :F 
D: 1F E: #F 33F 'F .I- :E7E!F !E//E22E77F :FF	F FF I*4%GG62I*5G66I*AI*I*I*)I*-J
J JJ L1BL,,L1c                s    V# r   rM   r   r   r   r   r    r   fallback_getvalueZServer.fallback_getvalueC  s    
r   c                    \        V4      # r   rE   r   r    r   fallback_strZServer.fallback_strF  s    3xr   c                r   r   )reprr   r    r   fallback_reprZServer.fallback_reprI  s    Cyr   rL   r+   	#GETVALUEc                s    R # r   rM   r   r9   r&   r   dummyZServer.dummyR  s    r   c                s   V P                   ;_uu_ 4        . p\        V P                  P                  4       4      pVP	                  4        V Fb  pVR8w  g   K  VP                  RV: RV P                  V,          : R\        V P                  V,          ^ ,          4      R,          : 24       Kd  	  RP                  V4      uuRRR4       #   + '       g   i     R# ; i)z?
Return some info --- useful to spot problems with refcounting
rZ   z  z:       refcount=z
    :NiK   NrK   N)	rg   r   rc   keyssortrP   rE   rb   join)r   r9   r>   r   r      &&   r   
debug_infoZServer.debug_infoU  s    
 ZZZF++0023DIIKC<MM#($*=*=e*D*D#&t~~e'<Q'?#@#E#G H 
 99V$ ZZZs   ?CA*CC	c                s,    \        V P                  4      # )z
Number of shared objects
)lenrc   r   r&   r   number_of_objectsZServer.number_of_objectse  s    
 4&&''r   c                s     \         P                  ! R4       VP                  R4       T P
                  P                  4        R#    ^ RIpTP	                  4         L4; i  T P
                  P                  4        i ; i)z
Shutdown this process
z!manager received shutdown messageNr5   N)r   rx   r6   	tracebackZ	print_excrm   set)r   r9   r      && r   shutdownZServer.shutdownl  sZ    	"JJ:;FF$%
 OO!		"!OO!s   'A AA   A<c          
     s   V P                   ;_uu_ 4        V P                  V,          w  rVrxVf.   V'       g   \        V4      ^8w  d   \        R4      hV^ ,          p	MV! V/ VB p	Vf   \	        V	4      pVeV   \        V\        4      '       g%   \        RP                  V\        V4      4      4      h\        V4      \        V4      ,           pR\        V	4      ,          p
\        P                  ! RW*4       V	\        V4      V3V P                  V
&   WP                   9  d   ^ V P                   V
&   RRR4       V P#                  VX
4       V
\%        X4      3#   + '       g   i     L/; i)z.
Create a new shared object and return its id
Nz4Without callable, must have one non-keyword argumentz,Method_to_typeid {0!r}: type {1!s}, not dictz%xz&%r callable returned object with id %r)rg   r]   r   rJ   rX   rD   dictrF   rG   rH   r   r   r   rx   r   rb   rc   increftuple)r   r9   r   r;   r<   rO   r   method_to_typeid	proxytyper   r   s   """*,      r   r   ZServer.createy  sB    ZZZmmF+ ;H/ CIN$NP P1g--(-+!"2D99#FMM,d3C.DFG G w-$/?*@@2c7NEJJ?O%(#g,8H$IDNN5!///-.##E*7 : 	AueGn$$= Zs   "EC8EE'	c                s\    \        V P                  VP                  ,          ^,          4      # )z<
Return the methods of the shared object indicated by token
)r   rb   r   )r   r9   r      &&&r   get_methodsZServer.get_methods  s!     T^^EHH-a011r   c                s~    V\         P                  ! 4       n        VP                  R4       V P	                  V4       R# )z-
Spawn a new thread to serve this connection
Nr   )re   r   rR   r6   r   )r   r9   rR   r   r   accept_connectionZServer.accept_connection  s0     +/	  "'	 !!r   c                s   V P                   ;_uu_ 4         V P                  V;;,          ^,          uu&   RRR4       R#   \         dc   pY P                  9   dL   ^T P                  T&   T P                  T,          T P                  T&   \
        P                  ! RT4        Rp?LpThRp?ii ; i  + '       g   i     R# ; i)   z&Server re-enabled tracking & INCREF %rN)rg   rc   r   rd   rb   r   rx   )r   r9   r   r      &&& r   r   ZServer.incref  s    ZZZ##E*a/* Z  
 66612D''.2259 NN5)JJGOOH ZZs5   B0A  B-AB(!B0&B((B--B00C	c           
     s   W P                   9  d*   W P                  9   d   \        P                  ! R V4       R# V P                  ;_uu_ 4        V P                   V,          ^ 8:  d>   \        RP                  W P                  V,          V P                   V,          4      4      hV P                   V;;,          ^,          uu&   V P                   V,          ^ 8X  d   V P                   V RRR4       W P                   9  dS   RV P                  V&   \        P                  ! RV4       V P                  ;_uu_ 4        V P                  V RRR4       R# R#   + '       g   i     Lt; i  + '       g   i     R# ; i)zServer DECREF skipping %rNz+Id {0!s} ({1!r}) has refcount {2:n}, not 1+zdisposing of obj with id %r)NrM   N)rc   rd   r   rx   rg   ZAssertionErrorrG   rb   )r   r9   r   r   r   decrefZServer.decref  s   +++///JJ2E:ZZZ""5)Q.$AHH~~e4++E245 5 &!+&""5)Q.''.  +++ %5DNN5!JJ4e<NN5)  , Z$ s   BE:E'E$	'E8	)	r   r_   rd   rb   rc   ra   rg   r]   rm   N)	r   r   r   r   r   r   r   r   r   )r*   r,   r-   r.   r/   r   r!   rz   rq   r   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r1   r2   r3   r4   r   rY   rY      s     NF&$,2<
Ob 	,=%
% (""%H2"* *r   rY   c                   s(    ] tR tRtR.t^ t^t^tRtR# )Statei  valuerM   N)	r*   r,   r-   r.   r0   INITIALSTARTEDSHUTDOWNr1   rM   r   r   r   r     s    	IGGHr   r   pickleZ	xmlrpclibc                   s   a  ] tR tRt o Rt/ t]tRRR/R lltR t	R t
RR	 lt]RR
 l4       tR tRR ltR tR tR tR t]R 4       t]R 4       t]RR l4       tRtV tR# )r    i  z
Base class for managers
Nshutdown_timeoutg      ?c               sh   Vf    \         P                  ! 4       P                  pWn        \         P                  ! V4      V n        \        4       V n        \        P                  V P                  n	        W0n
        \        V,          w  V n        V n        T;'       g    \        4       V n        WPn        R # r   )r   rn   r_   _addressr^   _authkeyr   _stater   r   _serializerr`   	_Listener_Clientr   _ctx_shutdown_timeout)r   r   r_   rh   Zctxr   s   &&&&&$r   r!   ZBaseManager.__init__  s{    ?--/77G44W=g!MM%'6z'B$((;=	!1r   c                s   V P                   P                  \        P                  8w  d   V P                   P                  \        P                  8X  d   \        R4      hV P                   P                  \        P                  8X  d   \        R4      h\        RP                  V P                   P                  4      4      h\        V P                  V P                  V P                  V P                  4      # )zH
Return server object with serve_forever() method and address attribute
Already started serverManager has shut downUnknown state {!r})r   r   r   r   r   r	   r   rG   rY   	_registryr   r   r   r"   r   r   
get_serverZBaseManager.get_server  s     ;;-{{  EMM1"#;<<""enn4"#:;;"(//0A0ABD DdnndmmmmT%5%57 	7r   c                s    \         V P                  ,          w  rV! V P                  V P                  R7      p\	        VRR4       \
        P                  V P                  n        R# )z.
Connect manager object to the server process
r_   Nr   )	r`   r   r   r   r@   r   r   r   r   )r   ri   rj   r   rT   r   connectZBaseManager.connect  sG     +4+;+;<dmmT]];tW%!MMr   c           
     s<   V P                   P                  \        P                  8w  d   V P                   P                  \        P                  8X  d   \        R4      hV P                   P                  \        P                  8X  d   \        R4      h\        RP                  V P                   P                  4      4      hVe   \        V4      '       g   \        R4      h\        P                  ! RR7      w  r4V P                  P                  \        V 4      P                  V P                   V P"                  V P$                  V P&                  WAV3R7      V n        R	P+                  R
 V P(                  P,                   4       4      p\        V 4      P.                  R,           V,           V P(                  n        V P(                  P3                  4        VP5                  4        VP7                  4       V n        VP5                  4        \        P                  V P                   n        \8        P:                  ! V \        V 4      P<                  V P(                  V P"                  V P$                  V P                   V P>                  V P@                  3^ R7      V n!        R# )z0
Spawn a server process for this manager object
r   r   r   Nzinitializer must be a callableF)Zduplexr{   Z:c              3   s8   "   T F  p\        V4      x  K  	  R # 5ir   r   )Z.0ZirW   r   Z	<genexpr>Z$BaseManager.start.<locals>.<genexpr>4  s     A)@AQ)@s   Z-r;   Zexitpriority)"r   r   r   r   r   r	   r   rG   rO   rF   r   ZPiper   ZProcessrH   _run_serverr   r   r   r   _processr   Z	_identityr*   rR   rs   r   r7   r   Finalize_finalize_managerr   r   r   )r   initializerinitargsZreaderwriterr      &&&   r   rs   ZBaseManager.start  s    ;;-{{  EMM1"#;<<""enn4"#:;;"(//0A0ABD D "8K+@+@<== $6 		)):))..$--""FC * 
 A)@)@AA!$Z00C7%? 	 "MM$t*..--t{{,, 6 68	r   c                s\   \         P                   ! \         P                  \         P                  4       Ve   V! V!   V P                  WW44      pVP	                  VP
                  4       VP                  4        \        P                  ! RVP
                  4       VP                  4        R# )z0
Create a server, report its address and run it
Nzmanager serving at %r)
signalZSIGINTZSIG_IGN_Serverr6   r   r   r   r   rz   )	clsr]   r   r_   rh   r   r   r   server	   &&&&&&&& r   r   ZBaseManager._run_serverF  sv     	fmmV^^4"" XD 	FNN# 			)6>>:r   c               s^   V P                   P                  \        P                  8X  g   Q R4       hV P	                  V P
                  V P                  R7      p \        VRRV3V,           V4      w  rVVP                  4        \        WP
                  V4      V3#   TP                  4        i ; i)z@
Create a new shared object; return the token and exposed tuple
zserver not yet startedr   Nr   )
r   r   r   r   r   r   r   r@   r   r   )r   r   r;   r<   r   r   r   s   ""*,   r   _createZBaseManager._create]  s     {{  EMM1K3KK1||DMM4==|A	"4x&4NKBJJLV]]B/88 JJLs   B B,c                s    V P                   eG   V P                   P                  V4       V P                   P                  4       '       g
   RV n         R# R# R# )z3
Join the manager process (if it has been spawned)
N)r   r   is_aliver   timeoutr&   r   r   ZBaseManager.joini  sD     ==$MMw'==))++ $ , %r   c                    V P                  V P                  V P                  R7      p \        VRR4      VP	                  4        #   TP	                  4        i ; i)zC
Return some info about the servers shared objects and connections
r   Nr   r   r   r   r@   r   r   rW   r   _debug_infoZBaseManager._debug_infor  sB     ||DMM4==|A	D$5JJLDJJL   A Ac                r   )z%
Return the number of shared objects
r   Nr   r   r   rW   r   _number_of_objectsZBaseManager._number_of_objects|  sC     ||DMM4==|A	D$(;<JJLDJJLr   c                s   V P                   P                  \        P                  8X  d   V P	                  4        V P                   P                  \        P
                  8w  d   V P                   P                  \        P                  8X  d   \        R 4      hV P                   P                  \        P                  8X  d   \        R4      h\        RP                  V P                   P                  4      4      hV # )zUnable to start serverr   r   )	r   r   r   r   rs   r   r	   r   rG   r"   r   r   	__enter__ZBaseManager.__enter__  s    ;;-JJL;;-{{  EMM1"#;<<""enn4"#:;;"(//0A0ABD Dr   c                &    V P                  4        R # r   )r   r   Zexc_typeZexc_valZexc_tbr    r   __exit__ZBaseManager.__exit__  s    r   c                s(   V P                   ! 4       '       Ed   \        P                  ! R4        V! WR7      p \        VRR4       VP	                  4        T P                  ! TR7       T P                   ! 4       '       d   \        P                  ! R4       \        T R4      '       d   \        P                  ! R4       T P                  ! 4        T P                  ! TR7       T P                   ! 4       '       d9   \        P                  ! R	4       T P                  ! 4        T P                  ! 4        \        P                  Vn         \        P                  V R#   TP	                  4        i ; i  \
         d     EL'i ; i  \         d     R# i ; i)
zA
Shutdown the manager process; will be registered as a finalizer
z#sending shutdown message to managerr   Nr   )r   zmanager still alive	terminatez'trying to `terminate()` manager processz#manager still alive after terminate)r   r   r   r@   r   r   r   hasattrr   Zkillr   r   r   r   _address_to_localr   )r   r   r_   r%   r   r   r   s   &&&&&& r   r   ZBaseManager._finalize_manager  s$    II;<w8!T44JJL LL!12!!		/07K00IIGH%%'LL)9:''))		"GHnn	++G4% JJL $  		s:   	E0 E E0 F E--E0 0E?>E?FFc                    V P                   # r   )r   r"   r   r   r   ZBaseManager.address  s    }}r   c                s   aa RV P                   9  d    V P                  P                  4       V n        Sf   \        oT;'       g    \	        SRR4      pT;'       g    \	        SRR4      pV'       de   \        VP                  4       4       FG  w  rx\        V4      \        J g   Q RV,          4       h\        V4      \        J d   K;  Q RV,          4       h	  W$VS3V P                  S&   V'       d   VV3R lp	SV	n	        \        V SV	4       R# R# )z)
Register a typeid with the manager type
r   N	_exposed__method_to_typeid_z%r is not a stringc                s&  < \         P                  ! R S4       V P                  ! S.VO5/ VB w  r4S! W0P                  V V P                  VR7      pV P                  VP                  V P                  R7      p\        VRRVP                  34       V# )z)requesting creation of a shared %r objectmanagerr_   r   r   Nr   )	r   rx   r   r   r   r   r   r@   r   )	r   r;   r<   r   Zexpproxyr   r   r   s	   "*,    r   rQ   Z"BaseManager.register.<locals>.temp  s    

FO!\\&@4@4@
!++T MM3 ||EMM4==|ItX{;r   )__dict__r   copy	AutoProxyrN   r   itemsrH   rE   r*   Zsetattr)
r   r   rO   r   r   r   create_methodkeyr   rQ   s
   &f&f&&&   r   registerZBaseManager.register  s     cll*MM..0CM!IBBWYTB+ J J"9.BDI 	 "#3#9#9#;<
CyC'C)=)CC'E{c)G+?%+GG) =
 /!f 	 #DMC& r   )
r   r   r   r   r   r   r   r   r   r   )NNr   Nr[   r   )NNNNT)r*   r,   r-   r.   r/   r   rY   r   r!   r   r   rs   classmethodr   r   r   r   r   r   r   staticmethodr   propertyr   r   r1   r2   r3   r4   r   r    r      s      IG2/227*)V  ,
9%    D   %' %'r   c                   ,   a  ] tR tRt o R tR tRtV tR# )ProcessLocalSeti  c                s6    \         P                  ! V R  4       R# )c                 "    V P                  4       # r   clearr   r   r   Z<lambda>Z*ProcessLocalSet.__init__.<locals>.<lambda>  s
    399;r   N)r   register_after_forkr"   r   r   r!   ZProcessLocalSet.__init__  s      '>?r   c                s    \        V 4      R3# r[   )rH   r"   r   r   
__reduce__ZProcessLocalSet.__reduce__  s    Dz2~r   rM   N)r*   r,   r-   r.   r!   r   r1   r2   r3   r4   r   r   r     s     @ r   r   c                   s   a  ] tR tRt o Rt/ t]P                  ! 4       t^t	RR lt
R tR/ 3R ltR tR t]R	 4       tR
 tR tR tR tR tRtV tR# )r   i  z&
A base for proxies of shared objects
Nc                s   \         P                  ;_uu_ 4        \         P                  P                  VP                  R 4      pVf=   \
        P                  ! 4       \        4       3pV\         P                  VP                  &   \         P                  V n	        \         ;P                  ^,          un        R R R 4       X^ ,          V n
        V^,          V n        Wn        V P                  P                  V n        W0n        W n        \"        V,          ^,          V n        Wpn        Ve   \(        P*                  ! V4      V n        MNV P                  e   V P                  P,                  V n        M$\(        P.                  ! 4       P0                  V n        V'       d   V P3                  4        \
        P4                  ! V \         P6                  4       R #   + '       g   i     EL&; ir   )r   _mutexr   r   r   r   ZForkAwareLocalr   _next_serial_serial_tls_all_serials_tokenr   _id_managerr   r`   r   _owned_by_managerr   r^   r   rn   r_   _increfr   _after_fork)	r   r   rh   r   r_   r   r   manager_ownedZtls_serialsr   r   r!   ZBaseProxy.__init__  sH   #5599%--NK""113_5FF=H	++EMM:$11DL""a'"   N	
 (N;;>>%&z215 "/#88ADM]]& MM22DM#335==DMLLN  y'<'<=Q s   BGG$	c                s   \         P                  ! R 4       \        P                  ! 4       P                  p\
        P                  ! 4       P                  R8w  d.   VR\
        P                  ! 4       P                  ,           ,          pV P                  V P                  P                  V P                  R7      p\        VRRV34       W P                  n        R# )zmaking connection to managerZ
MainThreadZ|r   Nr   )r   rx   r   rn   rR   re   r   r   r  r   r   r@   r  r   )r   rR   r   r}   r   _connectZBaseProxy._connect*  s    

12&&(--##%**l:C)2249999D||DKK//|Gt04':#		r   c                s    V P                   P                  pVP                  V P                  WV34       VP                  4       w  rVVR8X  d   V# VR8X  d   Vw  rxV P                  P                  VP                  ,          R,          p	V P                  P                   Vn        V	! WP"                  V P                  V P$                  VR7      p
V P'                  VP                   V P$                  R7      p\)        VRRVP*                  34       V
#  \-        WV4      h  \         d_    \        P                  ! R\
        P                  ! 4       P                  4       T P                  4        T P                   P                  p ELmi ; i  ?i ; i)	zF
Try to call a method of the referent and return a copy of the result
z#thread %r does not own a connectionr5   r   r   r   Nr   )r  r   r   r   rx   re   r   rR   r  r6   r  r7   r  r   r   r  r   r   r   r   r@   r   r8   )r   r:   r;   r<   r   r=   r>   r   r   r   r   s   &&&&       r   _callmethodZBaseProxy._callmethod3  s=   	(99''D 			488Zt45yy{9MX#NG//=bAI KK//EM''wE <<t}}<EDT4EHH;7L	"400/  	(JJ< //1668MMO99''D		(2 s   D F	 A%FF	Fc                s$    V P                  R4      # )z)
Get a copy of the value of the referent
r   r  r"   r   r   	_getvalueZBaseProxy._getvalueT  s     ,,r   c                s   V P                   '       d.   \        P                  ! R V P                  P                  4       R# V P                  V P                  P                  V P                  R7      p\        VRRV P                  34       \        P                  ! RV P                  P                  4       V P                  P                  V P                  4       V P                  ;'       d    V P                  P                  p\        P                  ! V \         P"                  V P                  V P                  V P                  VV P$                  V P                  V P
                  3^
R7      V n        R# )z%owned_by_manager skipped INCREF of %rNr   r   z	INCREF %rr   )r	  r   rx   r  r   r   r   r   r@   r  r  addr  r  r   r   r   _decrefr  _close)r   r   r%   r}   r   r
  ZBaseProxy._increfZ  s    !!!JJ>O||DKK//|GtX{3

;/dll+66$--"6"6mm)##++t||T]]E))T..>	r   c                s   VP                  V4       Ve    VP                  \        P                  8X  dQ    \        P
                  ! RV P                  4       V! V P                  VR7      p\        VR RV P                  34       M!\        P
                  ! RV P                  4       V'       gg   \        VR4      '       dS   \        P
                  ! R\        P                  ! 4       P                  4       VP                  P                  4        V=R # R # R #   \         d"   p\        P
                  ! RT4        R p?LR p?ii ; i)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   rx   r   r   r@   r   r   re   r   rR   r   r   )	r   Zserialr_   r%   ZtlsZidsetr   r   r   s	   &&&&&&&  r   r  ZBaseProxy._decrefn  s    f =EKK5==86

;1u}}g>tX{;
 JJ>I l33JJF //1668NN  "	 4u  6

11556s   AD E!D==Ec                s    R V n          V P                  4        R #   \         d)   p\        P                  ! RT,          4        R p?R # R p?ii ; i)Nzincref failed: %s)r  r
  r   r   r   )r   r   rW   r   r  ZBaseProxy._after_fork  s<    	/LLN 	/II)A-..	/s    AA		Ac                s   / p\        4       e   V P                  VR&   \        V RR4      '       d4   V P                  VR&   \        \
        V P                  V P                  V33# \        \        V 4      V P                  V P                  V33# )Nr_   _isautoFr   )	r   r   rN   r   RebuildProxyr   r  r   rH   r   r<   rW   r   r   ZBaseProxy.__reduce__  s    +"mmDO4E**"nnDO T-=-=tDF F !$Zd.>.>EG Gr   c                r   r   )r  )r   Zmemor&   r   __deepcopy__ZBaseProxy.__deepcopy__  s    ~~r   c                sz    R \        V 4      P                  V P                  P                  \	        V 4      3,          # )z<%s object, typeid %r at %#x>)rH   r*   r  r   r   r"   r   r   r+   ZBaseProxy.__repr__  s3    .T
##T[[%7%7DBC 	Cr   c                sr     V P                  R4      #   \         d    \        T 4      RR R,           u # i ; i)zF
Return representation of the referent (or a fall-back if that fails)
r+   Nz; '__str__()' failed>r  )r  r   r   r"   r   r   rL   ZBaseProxy.__str__  s=    	=##J// 	=:cr?%<<<	=s     66)r   r  r   r  r  r  r	  r  r   r  r  NNNTFrM   )r*   r,   r-   r.   r/   r   r   ZForkAwareThreadLockr  r  r!   r  r  r  r
  r   r  r  r   r  r+   rL   r1   r2   r3   r4   r   r   r     s}      %%'F L*>X$ ,.B B-(  0/G C= =r   c                s   \        \        P                  ! 4       RR4      pV'       d   VP                  VP                  8X  dl   \        P
                  ! RV4       RVR&   VP                  VP                  9  d5   VP                  VP                  ,          VP                  VP                  &   VP                  RR4      ;'       d&    \        \        P                  ! 4       RR4      '       * pV ! W3RV/VB # )	z-
Function used for unpickling proxy objects.
ro   Nz*Rebuild a proxy owned by manager, token=%rTr  r   Z_inheritingF)
rN   r   rn   r   r   rx   r   rd   rb   pop)rS   r   rh   r<   r   r   s   &&&&  r   r  r    s     W,,.0A4HF&..EMM1

?G $_886777  * ((2 	4  	E 	EG++-}eDD  9&9D99r   c                s    \        V4      p W V3,          #   \         d     Mi ; i/ pT F  p\        RT: RT: R2T4       K  	  \        T \        3T4      pYn        YRY3&   T# )z:
Return a proxy type whose methods are given by `exposed`
zdef z:(self, /, *args, **kwds):
        return self._callmethod(z, args, kwds))r   r   ZexecrH   r   r   )rR   r   Z_cacheZdicZmeth	ProxyTyper   r   MakeProxyTyper    s     GnGWo&&  C6:DBCF	H  TI<-I!'D?s   	 %%c           	     s   \         V,          ^,          pVf5   V! V P                  VR7      p \        VRRV 34      pVP                  4        Vf   Ve   VP                  pVf    \
        P                  ! 4       P                  p\        RV P                  ,          V4      p	V	! WW#WVR7      p
RV
n
        V
#   TP                  4        i ; i)z"
Return an auto-proxy for `token`
Nr   r   zAutoProxy[%s])r   r_   r   r  T)r`   r   r@   r   r   r   rn   r_   r  r   r  )r   rh   r   r_   r   r   r  r   r   r  r   s   &&&&&&&    r   r   r     s    
 j)!,Gu}}g6	tT=5(CGJJL7.""))+33o<gFIe#BEEML JJLs   B5 5Cc                   r   )	Namespacei  c               s<    V P                   P                  V4       R # r   )r   updater  s   ",r   r!   ZNamespace.__init__  s    T"r   c                s>   \        V P                  P                  4       4      p. pV F6  w  r4VP                  R 4      '       d   K  VP	                  V: RV: 24       K8  	  VP                  4        V P                  P                  : RRP                  V4      : R2# )rV   Z=(, r(   )	r   r   r   Z
startswithrP   r   r)   r*   r   )r   r   rQ   rR   r   s   &    r   r+   ZNamespace.__repr__  sr    T]]((*+ KD??3''tU34 ! 			>>22DIIdODDr   rM   N)r*   r,   r-   r.   r!   r+   r1   r2   r3   r4   r   r  r    s     #E Er   r  c                   sN   a  ] tR tRt o RR ltR tR tR t]! ]]4      t	Rt
V tR# )	Valuei  c                    Wn         W n        R # r   	_typecode_value)r   r   r   lockr    r   r!   ZValue.__init__  s    !r   c                r   r   r&  r"   r   r   r   Z	Value.get  s    {{r   c                s    Wn         R # r   r(  r   r   r&   r   r   Z	Value.set
  s    r   c                sl    \        V 4      P                  : R V P                  : RV P                  : R2# )r   r!  r(   )rH   r*   r%  r&  r"   r   r   r+   ZValue.__repr__  s!    !$Z00$..$++NNr   r$  NT)r*   r,   r-   r.   r!   r   r   r+   r   r   r1   r2   r3   r4   r   r"  r"    s&     OS#Er   r"  c                 s.    \         P                   ! W4      # r   )r   )r   sequencer'  r   r   Arrayr,    s    ;;x**r   c                   sB   a  ] tR tRt o R	tR tR tR tR tR t	Rt
V tR# )
IteratorProxyi  c                    V # r   rM   r"   r   r   __iter__ZIteratorProxy.__iter__      r   c                &    V P                  R V4      # )__next__r  r   r;      &*r   r2  ZIteratorProxy.__next__  s    
D11r   c                r1  )r6   r  r3  r4  r   r6   ZIteratorProxy.send  s    --r   c                r1  )throwr  r3  r4  r   r5  ZIteratorProxy.throw      ..r   c                r1  )r   r  r3  r4  r   r   ZIteratorProxy.close!  r6  r   rM   N)r2  r6   r5  r   )r*   r,   r-   r.   r   r/  r2  r6   r5  r   r1   r2   r3   r4   r   r-  r-    s(     6I2.// /r   r-  c                   sF   a  ] tR tRt o R	tR
R ltR tR tR tR t	Rt
V tR# )AcquirerProxyi%  Nc                s:    Vf   V3MW3pV P                  RV4      # )Nacquirer  )r   Zblockingr   r;   r   r   r8  ZAcquirerProxy.acquire'  s%    %o{H3F	400r   c                $    V P                  R 4      # releaser  r"   r   r   r;  ZAcquirerProxy.release*      	**r   c                r9  )lockedr  r"   r   r   r=  ZAcquirerProxy.locked,      ))r   c                r9  )r8  r  r"   r   r   r   ZAcquirerProxy.__enter__.  r<  r   c                r9  r:  r  r   r    r   r   ZAcquirerProxy.__exit__0  r<  r   rM   )r8  r;  r=  )TN)r*   r,   r-   r.   r   r8  r;  r=  r   r   r1   r2   r3   r4   r   r7  r7  %  s(     0I1+*++ +r   r7  c                   sH   a  ] tR tRt o RtR	R ltR
R ltR tR	R ltRt	V t
R# )ConditionProxyi4  Nc                (    V P                  R V34      # ru   r  r   r&   r   ru   ZConditionProxy.wait6      
33r   c                r@  )notifyr  )r   Znr&   r   rC  ZConditionProxy.notify8  s    1$//r   c                r9  )
notify_allr  r"   r   r   rD  ZConditionProxy.notify_all:  s    --r   c                s
   V! 4       pV'       d   V# Ve   \         P                  ! 4       V,           pMR pR pV'       gE   Ve'   V\         P                  ! 4       ,
          pV^ 8:  d    V# V P                  X4       V! 4       pKL  V# r   )timeZ	monotonicru   )r   Z	predicater   r>   ZendtimeZwaittimer   r   wait_forZConditionProxy.wait_for<  sw    Mnn&0GGH""T^^%55q=  IIh[Fr   rM   )r8  r;  r=  ru   rC  rD  r   )r   )r*   r,   r-   r.   r   ru   rC  rD  rF  r1   r2   r3   r4   r   r?  r?  4  s#     PI40. r   r?  c                   s@   a  ] tR tRt o RtR tR tR tR	R ltRt	V t
R# )

EventProxyiO  c                r9  )rt   r  r"   r   r   rt   ZEventProxy.is_setQ  r>  r   c                r9  r   r  r"   r   r   r   ZEventProxy.setS      &&r   c                r9  r   r  r"   r   r   r   ZEventProxy.clearU      ((r   Nc                r@  rA  r  r   r&   r   ru   ZEventProxy.waitW  rB  r   rM   )rt   r   r   ru   r   )r*   r,   r-   r.   r   rt   r   r   ru   r1   r2   r3   r4   r   rG  rG  O  s#     2I*')4 4r   rG  c                   sj   a  ] tR tRt o R
tRR ltR tR t]R 4       t	]R 4       t
]R 4       tR	tV tR# )BarrierProxyi[  Nc                r@  rA  r  r   r&   r   ru   ZBarrierProxy.wait]  rB  r   c                r9  )abortr  r"   r   r   rL  ZBarrierProxy.abort_  rJ  r   c                r9  )resetr  r"   r   r   rM  ZBarrierProxy.reseta  rJ  r   c                &    V P                  R R4      # )__getattribute__)partiesr  r"   r   r   rP  ZBarrierProxy.partiesc  s     2LAAr   c                rN  )rO  )	n_waitingr  r"   r   r   rQ  ZBarrierProxy.n_waitingf  s     2NCCr   c                rN  )rO  )brokenr  r"   r   r   rR  ZBarrierProxy.brokeni  s     2K@@r   rM   )rO  ru   rL  rM  r   )r*   r,   r-   r.   r   ru   rL  rM  r   rP  rQ  rR  r1   r2   r3   r4   r   rK  rK  [  sU     >I4))B BD DA Ar   rK  c                   s6   a  ] tR tRt o RtR tR tR tRtV t	R# )NamespaceProxyin  c                s    V^ ,          R8X  d   \         P                  W4      # \         P                  V R4      pV! RV34      # )    rV   r  rO  )objectrO  r   r   
callmethodr   r   __getattr__ZNamespaceProxy.__getattr__p  s@    q6S=**455,,T=A
,sf55r   c                s    V^ ,          R8X  d   \         P                  WV4      # \         P                  V R4      pV! RW34      # )rT  rV   r  __setattr__)rU  rY  rO  )r   r   r   rW  r   r   rY  ZNamespaceProxy.__setattr__u  sA    q6S=%%d77,,T=A
-#66r   c                s    V^ ,          R8X  d   \         P                  W4      # \         P                  V R4      pV! RV34      # )rT  rV   r  __delattr__)rU  rZ  rO  rV  r   r   rZ  ZNamespaceProxy.__delattr__z  s?    q6S=%%d00,,T=A
-#00r   rM   N)rO  rY  rZ  )
r*   r,   r-   r.   r   rX  rY  rZ  r1   r2   r3   r4   r   rS  rS  n  s     BI6
7
1 1r   rS  c                   sf   a  ] tR tRt o RtR tR t]! ]]4      t]	! ]
P                  4      tRtV tR# )
ValueProxyi  c                r9  )r   r  r"   r   r   r   ZValueProxy.get  rI  r   c                r@  rH  r  r)  r&   r   r   ZValueProxy.set  s    x00r   rM   N)r   r   )r*   r,   r-   r.   r   r   r   r   r   r   typesGenericAlias__class_getitem__r1   r2   r3   r4   r   r[  r[    s1     I'1S#E#E$6$67r   r[  BaseListProxyc                   sP   a  ] tR tRt o R tR t]! ]P                  4      t	Rt
V tR# )	ListProxyi  c                ,    V P                  R V34       V # )extendr  r)  r&   r   __iadd__ZListProxy.__iadd__  s    E8,r   c                ra  )__imul__r  r)  r&   r   rd  ZListProxy.__imul__      eX.r   rM   N)r*   r,   r-   r.   rc  rd  r   r\  r]  r^  r1   r2   r3   r4   r   r`  r`    s"      $E$6$67r   r`  _BaseDictProxyr/  ZIteratorc                   sJ   a  ] tR tRt o R t]! ]P                  4      tRt	V t
R# )	DictProxyi  c                ra  __ior__r  r)  r&   r   ri  ZDictProxy.__ior__      UH-r   rM   N)r*   r,   r-   r.   ri  r   r\  r]  r^  r1   r2   r3   r4   r   rg  rg    s      $E$6$67r   rg  _BaseSetProxyc                   s\   a  ] tR tRt o R tR tR tR t]! ]	P                  4      tRtV tR# )SetProxyi  c                ra  rh  r  r)  r&   r   ri  ZSetProxy.__ior__  rj  r   c                ra  )__iand__r  r)  r&   r   rm  ZSetProxy.__iand__  re  r   c                ra  )__ixor__r  r)  r&   r   rn  ZSetProxy.__ixor__  re  r   c                ra  )__isub__r  r)  r&   r   ro  ZSetProxy.__isub__  re  r   rM   N)r*   r,   r-   r.   ri  rm  rn  ro  r   r\  r]  r^  r1   r2   r3   r4   r   rl  rl    s,      $E$6$67r   rl  
ArrayProxy	PoolProxyapply_asyncimapimap_unordered	map_asyncstarmap_asyncZAsyncResultc                   r   )rq  i  c                r.  r   rM   r"   r   r   r   ZPoolProxy.__enter__  r0  r   c                r   r   )r   r   r    r   r   ZPoolProxy.__exit__  s    r   rM   N)r*   r,   r-   r.   r   r   r1   r2   r3   r4   r   rq  rq    s      r   c                   s    ] tR tRtRtRtR# )r   i  a  
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.
rM   N)r*   r,   r-   r.   r/   r1   rM   r   r   r   r     s    r   QueueZJoinableQueuerl   rf   RLock	SemaphoreBoundedSemaphore	ConditionBarrierPoolr   r   r   r,  )r   r   )r   c                   sT   a  ] tR tRt o Rt. 3R ltR tR tR tR t	R t
R	 tR
tV tR# )_SharedMemoryTrackeri  z+Manages one or more shared memory segments.c                r#  r   shared_memory_context_namesegment_names)r   rR   r  r   r   r!   Z_SharedMemoryTracker.__init__  s    .2+!.r   c                s    \         P                  ! RV: R\        4        24       V P                  P	                  V4       R# )z6Adds the supplied shared memory block name to tracker.zRegister segment  in pid N)r   rx   r   r  rP   r   segment_namer&   r   register_segmentZ%_SharedMemoryTracker.register_segment  s3    JJ*<*:(68*MN%%l3r   c                s    \         P                  ! RV: R\        4        24       V P                  P	                  V4       \
        P                  ! V4      pVP                  4        VP                  4        R# )zvCalls unlink() on the shared memory block with the supplied name
and removes it from the list of blocks being tracked.zDestroy segment r  N)	r   rx   r   r  remover   SharedMemoryr   unlink)r   r  Zsegmentr   r   destroy_segmentZ$_SharedMemoryTracker.destroy_segment  sX     JJ),)9&(LM%%l3#00>GMMONNr   c                s\    V P                   R,           F  pV P                  V4       K  	  R# )z<Calls destroy_segment() on all tracked shared memory blocks.:NNNN)r  r  r  rW   r   r  Z_SharedMemoryTracker.unlink#  s(     $ 2 21 5 5$$\2 !6r   c                s    \         P                  ! R V P                  P                   R\	        4        24       V P                  4        R# )zCall z.__del__ in N)r   rx   r)   r*   r   r  r"   r   r   __del__Z_SharedMemoryTracker.__del__(  s1    JJt~~667|FH:NOKKMr   c                s2    V P                   V P                  3# r   r  r"   r   r   r#   Z!_SharedMemoryTracker.__getstate__,  s    33T5G5GHHr   c                s&    V P                   ! V!   R # r   )r!   r$   r&   r   r'   Z!_SharedMemoryTracker.__setstate__/  s    MM5!r   )r  r  N)r*   r,   r-   r.   r/   r!   r  r  r  r  r#   r'   r1   r2   r3   r4   r   r~  r~    s4     5/1 	/	4
		3
		I	" 	"r   r~  c                   sn   a  ] tR tRt o ]P
                  . R
O,           tR tR tR tR t	R t
R tRtV tR	# )SharedMemoryServeri3  c                s(   \         P                  ! V .VO5/ VB  V P                  p\        V\        4      '       d   \
        P                  ! V4      p\        R V R\        4        24      V n	        \        P                  ! R\        4        24       R# )Zshm_rV   z"SharedMemoryServer started by pid N)rY   r!   r   rD   r\   osZfsdecoder~  r   shared_memory_contextr   rx   )r   r;   kwargsr      &*, r   r!   ZSharedMemoryServer.__init__8  sq    OOD24262llG'5))++g.$tG9AfhZ%@A &JJ;FH:FGr   c               s    \        V P                  V,          R,          R4      '       d   V P                  VR&   \        P                  ! WV.VO5/ VB # )z|Create a new distributed-shared object (not backed by a shared
memory block) and return its id to be used in a Proxy Object.Z_shared_memory_proxyr  r  )r   r]   r  rY   r   )r   r9   r   r;   r  s   """*,r   r   ZSharedMemoryServer.createB  sL     t}}V,R02HII262L2L./==&B4B6BBr   c                s`    V P                   P                  4        \        P                  W4      # )zACall unlink() on all tracked shared memory, terminate the Server.)r  r  rY   r   r   r&   r   r   ZSharedMemoryServer.shutdownL  s#    &&--/??4++r   c                <    V P                   P                  V4       R# )z?Adds the supplied shared memory block name to Server's tracker.N)r  r  r   r9   r  r   r   track_segmentZ SharedMemoryServer.track_segmentQ  s    &&77Er   c                r  )z|Calls unlink() on the shared memory block with the supplied name
and removes it from the tracker instance inside the Server.N)r  r  r  r   r   release_segmentZ"SharedMemoryServer.release_segmentU  s     &&66|Dr   c                s.    V P                   P                  # )zVReturns a list of names of shared memory blocks that the Server
is currently tracking.)r  r  r   r&   r   list_segmentsZ SharedMemoryServer.list_segmentsZ  s     --;;;r   )r  N)r  r  r  )r*   r,   r-   r.   rY   r   r!   r   r   r  r  r  r1   r2   r3   r4   r   r  r  3  s>     FG	H	C	,
	F	E
	< 	<r   r  c                   sF   a  ] tR tRt o Rt]tR tR tR t	R t
R tRtV tR	# )
r   i`  aq  Like SyncManager but uses SharedMemoryServer instead of Server.

It provides methods for creating and returning SharedMemory instances
and for creating a list-like object (ShareableList) backed by shared
memory.  It also provides methods that create and return Proxy Objects
that support synchronization across processes (i.e. multi-process-safe
locks and semaphores).
c                s    \         P                  R 8X  d   ^RIHp VP	                  4        \
        P                  ! V .VO5/ VB  \        P                  ! V P                  P                   R\        4        24       R# )Zposix)resource_trackerz created by pid N)r  rR    r  Zensure_runningr    r!   r   rx   r)   r*   r   )r   r;   r  r  r  r   r!   ZSharedMemoryManager.__init__l  s\    ww'! / //1  777JJ$..1122B68*MNr   c                st    \         P                  ! V P                  P                   R \	        4        24       R# )z.__del__ by pid N)r   rx   r)   r*   r   r"   r   r   r  ZSharedMemoryManager.__del__x  s'    JJ$..1122B68*MNr   c                s   V P                   P                  \        P                  8w  d   V P                   P                  \        P                  8X  d   \        R4      hV P                   P                  \        P                  8X  d   \        R4      h\        RP                  V P                   P                  4      4      hV P                  V P                  V P                  V P                  V P                  4      # )z@Better than monkeypatching for now; merge into Server ultimatelyz"Already started SharedMemoryServerz!SharedMemoryManager has shut downr   )r   r   r   r   r   r	   r   rG   r   r   r   r   r   r"   r   r   r   ZSharedMemoryManager.get_server{  s    {{  EMM1;;$$5&'KLL[[&&%..8&'JKK&,33DKK4E4EFH H<< $t/?/?A Ar   c                sP   V P                  V P                  V P                  R7      ;_uu_ 4       p\        P                  ! RRVR7      p \        VRRVP                  34        RRR4       T#   \         d   pTP                  4        ThRp?ii ; i  + '       g   i     X# ; i)zcReturns a new SharedMemory instance with the specified size in
bytes, to be tracked by the manager.r   NT)r   sizer  )	r   r   r   r   r  r@   rR   BaseExceptionr  )r   r  r   Zsmsr   r   r   r  Z SharedMemoryManager.SharedMemory  s     dmmT]]CCt#00dNT4388+F D J % JJLG	 DC Js)   BA//B:BBBB%	c                sr   V P                  V P                  V P                  R7      ;_uu_ 4       p\        P                  ! V4      p \        VRRVP                  P                  34        RRR4       T#   \         d"   pTP                  P                  4        ThRp?ii ; i  + '       g   i     X# ; i)zuReturns a new ShareableList instance populated with the values
from the input sequence, to be tracked by the manager.r   Nr  )
r   r   r   r   ShareableListr@   ZshmrR   r  r  )r   r+  r   Zslr   r   r   r  Z!SharedMemoryManager.ShareableList  s     dmmT]]CCt"00:T4266;;.I D I % FFMMOG	 DC Is)   B%#A66B"BB""B%%B6	rM   N)r*   r,   r-   r.   r/   r  r   r!   r  r   r  r  r1   r2   r3   r4   r   r   r   `  s2     	 %
	O	O	A
	
	 
	r   )r    r   r   r   )r   r   valuesrM   r  r*  )Z__add____contains____delitem____getitem__rd  __len__Z__mul____reversed__Z__rmul____setitem__rP   r   r   Zcountrb  ZindexZinsertr  r  Zreverser   )r  r  r  ri  r/  r  __or__r  __ror__r  r   r   Zfromkeysr   r   r   r  ZpopitemZ
setdefaultr  r  )%Z__and__r^  r  rm  ri  ro  r/  rn  r  r  Z__rand__r  Z__rsub__Z__rxor__Z__sub__Z__xor__Z__ge__Z__gt__Z__le__Z__lt__r  r   r   Z
differenceZdifference_updater  ZintersectionZintersection_updateZ
isdisjointZissubsetZ
issupersetr  r  Zsymmetric_differenceZsymmetric_difference_updateZunionr  )r  r  r  )Zapplyrr  r   rs  rt  r   Zmapru  Zstarmaprv  r   )_Z__all__rw   re   r   r   Zcollections.abcZcollectionsZqueuerE  r\  r  r   r   r   r  r   Zcontextr   r   r	   r
   r   r   r   r   Z	HAS_SHMEMrP   ZImportErrorr   r   rH   rN   Z
view_typesr   Z	view_typerU  r   r@   r8   r   rI   rU   rX   rY   r   ri   rj   ZXmlListenerZ	XmlClientr`   r    r   r   r   r  r  r   r  r"  r,  r-  r7  r?  rG  rK  rS  r[  r_  r`  ZabcZMutableSequencerf  r   rg  ZMutableMappingrk  rl  rp  ZBasePoolProxyrq  r   rw  rl   rf   rx  ry  rz  r{  r|  r}  r   r   r~  r  r   )rR   s   0r   <module>r     s   A         	     @ @    * INN()2 	  5;; -4MN4MDd72t$&'4MN
Iy/2 zMF M. &(b IC) C	AF*V F*Z
F  
##Z%6%67:)):+?+?@t'& t'tc w= w=z:* )+ ,:
E 
E
F 
+/I /+I +] 6	4 	4A9 A&1Y 1&8 8 o 0 8 8    ( ( 7/ 2  
% !8 8    ' ' 7o 	0 	8} 8     ' ' 6 < * 

 k , 
 =]
Jj$   	+ 	   Wekk *   _ekk 2   Wiooz :   VY^^] ;   Wioo} =   [)"5"5} E   ')C)C"$   [)"5"5~ F   Y	 1 1< @   VTYY	 2   VT9 -   VT9 -   UC *   WeZ 0   WeZ 0   [)^ <   Z=  N   ]%  8 "" ""J*<V *<Z>k >g O'  I Os   R3 S3	S ?S 