
    1h$                       % S SK Jr  S SKrS SKrS SKrS SKrS SKJr  S SKJ	r	J
r
  S SKJrJrJr  SSKJrJrJr  SSKJr  SS	KJr  SS
KJr  SSKJrJr  SSKJrJrJr  SSK J!r!J"r"  SSK#J$r$  Sr%\" S5      r&\!" S5      r'S\(S'   \!" S5      r)S\(S'   \!" S5      r*S\(S'   SSS.         SS jjr+SS jr,SS jr-\.S:X  a  \-" 5         gg)     )annotationsN)deque)module_from_specspec_from_file_location)CallableTypeVarcast   )current_timeget_asynclibget_cancelled_exc_class)BrokenWorkerProcess)open_process)CapacityLimiter)CancelScope
fail_after)ByteReceiveStreamByteSendStreamProcess)RunVarcheckpoint_if_cancelled)BufferedByteReceiveStreami,  T_Retval_process_pool_workerszRunVar[set[Process]]_process_pool_idle_workersz$RunVar[deque[tuple[Process, float]]]_default_process_limiterzRunVar[CapacityLimiter]F)cancellablelimiterc          	     J	  ^^^^#    SUUUU4S jjn[        5       I Sh  vN   [        R                  " SX4[        R                  S9n [        R                  5       m[        R                  5       nU=(       d
    [        5        ISh  vN   U(       Ga!  UR                  5       u  mnTR                  c  [        [         TR"                  5      m[%        [        [&        TR(                  5      5      m[+        5       n/ n	U(       aa  XS   S   -
  [,        :  a  ONUR/                  5       u  mnTR1                  5         TR3                  T5        U	R5                  T5        U(       a  Ma  [7        SS9   U	 H  mTR9                  5       I Sh  vN   M     SSS5        GOUTR3                  T5        U(       a  GM!  [:        R<                  S	S
[>        /n
[A        U
[B        RD                  [B        RD                  S9I Sh  vN m [        [         TR"                  5      m[%        [        [&        TR(                  5      5      m[G        S5         TRI                  S5      I Sh  vN nSSS5        WS:w  a  [K        SU< 35      e[M        [:        RN                  S   SS5      n[        R                  " S[:        RP                  U4[        R                  S9nU" U5      I Sh  vN   TRW                  T5        [7        U(       + S9    [        [X        U" U5      I Sh  vN 5      TT;   a  UR5                  T[+        5       45        sSSS5        sSSS5      ISh  vN   $  GN;! [         a[    [        5       m[        5       n[        R                  T5        [        R                  U5        [        5       R                  T5         GNOf = f GN< GN?! , (       d  f       GN@= f GN GN! , (       d  f       GN= f GN! [J        [S        5       4 a    e [T         a!  nTR1                  5         [K        S5      UeSnAff = f GN$ N! TT;   a  UR5                  T[+        5       45        f f = f! , (       d  f       O= fSSS5      ISh  vN    g! , ISh  vN  (       d  f       g= f7f)a  
Call the given function with the given arguments in a worker process.

If the ``cancellable`` option is enabled and the task waiting for its completion is cancelled,
the worker process running it will be abruptly terminated using SIGKILL (or
``terminateProcess()`` on Windows).

:param func: a callable
:param args: positional arguments for the callable
:param cancellable: ``True`` to allow cancellation of the operation while it's running
:param limiter: capacity limiter to use to limit the total amount of processes running
    (if omitted, the default limiter is used)
:return: an awaitable that yields the return value of the function.

c                  >#     T	R                  U 5      I S h  vN   TR                  SS5      I S h  vN nUR                  S5      u  p#US;  a  [        SU< 35      eTR	                  [        U5      5      I S h  vN n[        R                   " U5      nUS:X  a  [        U[        5      (       d   eUeU$  N N N?! [         a  nT
R                  T5         TR                  5         [        SS9   TR                  5       I S h  vN    S S S 5        O!! , (       d  f       O= f! [         a     Of = f[        U[        5       5      (       a  e [        UeS nAff = f7f)	N   
2       )   RETURN	   EXCEPTION-Worker process returned unexpected response: Tshieldr%   )sendreceive_untilsplitRuntimeErrorreceive_exactlyintBaseExceptiondiscardkillr   acloseProcessLookupError
isinstancer   r   pickleloads)pickled_cmdresponsestatuslengthpickled_responseexcretvalbufferedprocessstdinworkerss          H/var/www/auris/envauris/lib/python3.13/site-packages/anyio/to_process.pysend_raw_command"run_sync.<locals>.send_raw_command4   s<    	3**[)))%33E2>>H%^^D1NF66"CH<P  &.%=%=c&k%JJ ./\!fm4444LM9 *>  K 	3OOG$ -!..*** .--%  #6899)s2	3s   E!B? B9B? B;A	B? =B=>B? 7E!9B? ;B? =B? ?
E	ED(4DD	DD(E
D%	!D($E%D((
D52E4D55$EEE!Nrun)protocolr   r
   Tr'   z-uz-m)r@   stdout         READY
r&   __main____file__initz*Error during worker process initialization)r7   bytesreturnobject)-r   r5   dumpsHIGHEST_PROTOCOLr   getr   LookupErrorsetr   r   #setup_process_pool_exit_at_shutdowncurrent_default_process_limiterpop
returncoder	   r   r@   r   r   rG   r   WORKER_MAX_IDLE_TIMEpopleftr1   removeappendr   r2   sys
executable__name__r   
subprocessPIPEr   receiver   getattrmodulespathr   r/   addr   )funcr   r   argsrC   requestidle_workers
idle_sincenowkilled_processescommandmessagemain_module_pathpickledr<   r>   r?   r@   rA   s                  @@@@rB   run_syncrs      s    , B "
###llE4.9P9PQGD'++-1557 <:<<< "."2"2"4GZ!!)^W]];4*GNN; #n24 "!_Q//2FF*6*>*>*@'GZLLNNN7+$++G4 #l !-#3%nn... $4 . NN7#7 l: ~~tT8<G(zz G^W]];4*GNN;  ^$,$4$4Q$77G $ j(-G{S  $+3;;z+BJPT#U  ,,SXX'78#44 'w/// KK K0CH,<W,E&EFg% '',.(AB 10E =<< $  D%w!!'*"&&|4::7CD =6 / .- 8 $^ 0')@)BC   )@ 'FI =L g% '',.(AB &	 10E =<<<<<sj  R#M)R#
(M 2R#	O
R#CR	'	R	0O	O

O"R	7AR	9O:R	?AO8O#O O#!A:O8O5O8 R	?Q&P?P:P?!Q&?	R	R#P=R#A!O>R#OR#O
O		R	 O##
O2	-	O88P7P22P77R	:P?=R#?$Q##Q&&
Q4	0R	7R#RR#	R RR R#c                      [         R                  5       $ ! [         aA    [        [        R
                  " 5       =(       d    S5      n [         R                  U 5        U s $ f = f)z
Return the capacity limiter that is used by default to limit the number of worker processes.

:return: a capacity limiter object

   )r   rS   rT   r   os	cpu_countrU   )r   s    rB   rW   rW      sM    '++-- !",,."5A6 $$W-s    AA! A!c                    [         R                  n [         R                  n[        [        R
                  5      [         l        [        [        R
                  S5      [         l        UR                  R                  S5         S =p# [        R                  " U R                  5      tpEUS:X  a  Uu  pe U" U6 nOUS:X  a  Uu  [         l        n[         R                  S	 U(       a^   [        SU5      n	U	(       aJ  U	R                  (       a9  [        U	5      n
U	R                  R!                  U
5        U
[         R                  S'    Ub(  Sn[        R$                  " U[        R&                  5      nO(Sn[        R$                  " U[        R&                  5      n UR                  R                  S	U[)        U5      4-  5        UR                  R                  U5        [+        U[,        5      (       a  UeGMr  ! [         a  nUn S nANS nAff = f! [         a  nUn S nANS nAff = f! ["         a     g [         a  nUn S nAGNS nAff = f! [         a3  nUnSn[        R$                  " U[        R&                  5      n S nANS nAff = f)
NwrJ   rE   rM   rK   __mp_main__r%   r$   s   %s %d
)r^   r@   rG   openrv   devnullbufferwriter5   loadr/   rf   re   r   loaderr   exec_moduleEOFErrorrQ   rR   lenr4   
SystemExit)r@   rG   r=   	exceptionro   ri   rh   r<   rq   specmainr9   rr   s                rB   process_workerr      s
    IIEZZFRZZ CIbjj#&CJ
MM
#
!!	(#[[6NG %!
$!4[F F"-1**KK
+#(6}FVWDKK#3D#9D KK33D96:CKK
3
	A$% ,,y&2I2IJ" ,,vv/F/FG 	J&#g,)??@G$ i,,Oa  % $ #I$ ) ($'	(1  	 	I	@  	AI!Fll3(?(?@G	Asm   !H& 2G4 %AH *I .'I 4
H
>HH

H#HH#&
I2	I;II
J)JJrK   )
rh   zCallable[..., T_Retval]ri   rP   r   boolr   zCapacityLimiter | NonerO   r   )rO   r   )rO   None)/
__future__r   rv   r5   ra   r^   collectionsr   importlib.utilr   r   typingr   r   r	   _core._eventloopr   r   r   _core._exceptionsr   _core._subprocessesr   _core._synchronizationr   _core._tasksr   r   abcr   r   r   lowlevelr   r   streams.bufferedr   rZ   r   r   __annotations__r   r   rs   rW   r   r`        rB   <module>r      s    " 	   
  D * * Q Q 2 - 3 1 ; ; 5 7 :.45L.M + MCI D @  5;;U4V 1 V &*	LC
!LCLC LC $	LC
 LC^9x z r   