python (3.12.0)

(root)/
lib/
python3.12/
concurrent/
futures/
__pycache__/
process.cpython-312.opt-2.pyc

ˑeG 	dZddlZddlmZddlZddlZddlZddlm	Z	ddl
Z
ddlZddlm
Z
ddlZddlZddlmZej$ZdaGdd	Zd
Ze
j.edZdZGd
deZGddZdZGddeZGddeZ GddeZ!Gdde	Z"dZ#dZ$		d&dZ%d'dZ&Gdde
jNZ(da)da*d Z+d!Z,Gd"d#ejZZ.Gd$d%ej^Z0y)(z"Brian Quinlan (brian@sweetapp.com)N)_base)Queue)partial)format_exceptionFc$eZdZdZdZdZdZy)
_ThreadWakeupcXd|_tjd\|_|_y)NF)duplex)_closedmpPipe_reader_writerselfs N/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/concurrent/futures/process.py__init__z_ThreadWakeup.__init__Es %'WWE%:"dlc|js<d|_|jj|jjyyNT)rrcloserrs rrz_ThreadWakeup.closeIs5||DLLL LL rcT|js|jjdyy)Nr)rr
send_bytesrs rwakeupz_ThreadWakeup.wakeupOs ||LL##C(rc|jsQ|jjr6|jj|jjr5yyyN)rrpoll
recv_bytesrs rclearz_ThreadWakeup.clearSs@||,,##%''),,##%rN)__name__
__module____qualname__rrrrrrrrDs;!)*rrcdattj}|D]\}}|j	|D]\}}|jyr)_global_shutdownlist_threads_wakeupsitemsrjoin)r(_
thread_wakeupts    r_python_exitr-YsZ!'')*E!=1	r=ceZdZdZdZy)_RemoteTracebackc||_yrtb)rr4s  rrz_RemoteTraceback.__init__ys	rc|jSrr3rs r__str__z_RemoteTraceback.__str__{swwrN)r r!r"rr6r#rrr1r1xsrr1ceZdZdZdZy)_ExceptionWithTracebackcdjtt|||}||_d|j_d|z|_y)Nz

"""
%s""")r)rtypeexc
__traceback__r4)rr<r4s   rrz _ExceptionWithTraceback.__init__s?
WW%d3ib9
:"& 2%rc>t|j|jffSr)_rebuild_excr<r4rs r
__reduce__z"_ExceptionWithTraceback.__reduce__sdhh000rN)r r!r"rr@r#rrr8r8~s&1rr8c&t||_|Sr)r1	__cause__)r<r4s  rr?r?s$R(CMJrceZdZdZy)	_WorkItemc<||_||_||_||_yr)futurefnargskwargs)rrFrGrHrIs     rrz_WorkItem.__init__s	rNr r!r"rr#rrrDrDrrDceZdZddZy)_ResultItemNc<||_||_||_||_yr)work_id	exceptionresultexit_pid)rrOrPrQrRs     rrz_ResultItem.__init__s" 
rNNNrJr#rrrMrMs!rrMceZdZdZy)	_CallItemc<||_||_||_||_yr)rOrGrHrI)rrOrGrHrIs     rrz_CallItem.__init__s	rNrJr#rrrUrUrKrrUc,eZdZ	dfd	ZfdZxZS)
_SafeQueuecR||_||_||_t|||y)N)ctx)pending_work_items
shutdown_lockr+superr)rmax_sizerZr[r\r+	__class__s      rrz_SafeQueue.__init__s-"4**
s+rct|trtt|||j}tdj
dj||_|jj|jd}|j5|jjddd||jj!|yyt"|I||y#1swY9xYw)Nz

"""
{}"""r:)
isinstancerUrr;r=r1formatr)rBr[poprOr\r+rrF
set_exceptionr]_on_queue_feeder_error)reobjr4	work_itemr_s     rrez!_SafeQueue._on_queue_feeder_errorsc9%!$q'1aoo>B*>+@+@+MNAK//33CKKFI##
,""))+
,
$  ..q1%
G*1c2
,
,sC%%C.)r)r r!r"rre
__classcell__r_s@rrXrXsG,
3
3rrXc'lK	t|}	ttj||}|sy|'wr)ziptuple	itertoolsislice)	chunksize	iterablesitchunks    r_get_chunksrts<6	iB
i&&r956	s24c4	|Dcgc]}||	c}Scc}wrr#)rGrsrHs   r_process_chunkrvs!#(($BI(((sc		|jt||||y#t$r=}t||j}|jt|||Yd}~yd}~wwxYw)N)rQrPrRrPrR)putrM
BaseExceptionr8r=)result_queuerOrQrPrRrfr<s       r_sendback_resultr|sk89WV/88M	N9%a9W.68	9	99s"	A(3A##A(cD	|	||d}d}	|j	d}|$|jt
jy||dz
}||k\rt
j}	|j|ji|j}t||j||~~|y#t$r$tjjddYywxYw#t$r9}	t|	|	j}
t||j|
|Yd}	~	rd}	~	wwxYw)	NzException in initializer:T)exc_inforblockr.)rQrRrx)rzrLOGGERcriticalgetryosgetpidrGrHrIr|rOr8r=)
call_queuer{initializerinitargs	max_tasks	num_tasksrR	call_itemrrfr<s           r_process_workerrs8	"IH
NNN.	RYY[) NII%99;			innA	0@0@AA
\9+<+<Q&.
0
9	LL!!"=!M
		*	0)!Q__=C\9+<+<&.
0
0	0s)B-(&C-*CC	D&/DDc\eZdZ	fdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
xZS)_ExecutorManagerThreadc|j|_|j|_|j|jfd}t	j
|||_|j|_|j|_
|j|_|j|_|j|_|j"|_t&|Qy)Nctjjd|5|jdddy#1swYyxYw)Nz?Executor collected: triggering callback for QueueManager wakeup)rutildebugr)r*r+r\s   r
weakref_cbz3_ExecutorManagerThread.__init__.<locals>.weakref_cb.s=
GGMM1
2
'$$&
'
'
's	<A)_executor_manager_thread_wakeupr+_shutdown_lockr\weakrefrefexecutor_reference
_processes	processes_call_queuer
_result_queuer{	_work_idswork_ids_queue_max_tasks_per_childmax_tasks_per_child_pending_work_itemsr[r]r)rexecutorrr_s   rrz_ExecutorManagerThread.__init__ s
&EE%44&*%7%7%)%7%7	'#*++h
"C",,#..%22'00$,#@#@ #+">">
rc	|j|j\}}}|r|j|y||j||jdu}|r5|j
j
|j}|j~|jx}rC|r&|j5|jdddn|jj~|jr=|j|j|js|j!y5#1swYYxYwr)add_call_item_to_queuewait_result_broken_or_wakeupterminate_brokenprocess_result_itemrRrrcr)rr\_adjust_process_count_idle_worker_semaphorereleaseis_shutting_downflag_executor_shutting_downr[join_executor_internals)rresult_item	is_brokencauseprocess_exitedprs       rrunz_ExecutorManagerThread.runOs.''),0,M,M,O)KE%%e,&((5!,!5!5T!A!**;+?+?@AFFH #668888%!//=$::<==!77??A $$&002
++-..002Q,==s3D77Ec	|jjry	|jjd}|j|}|j
j
rH|jjt||j|j|jdn|j|=#tj$rYywxYw)NTFr)rfullrrr[rFset_running_or_notify_cancelryrUrGrHrIqueueEmpty)rrOrhs   rrz-_ExecutorManagerThread.add_call_item_to_queue|s##%
--111>!33G<	##@@BOO''	'2;,,2;..2;2B2B)D/3	(4//8%
;;

sB::CCcX|jj}|jj}||g}t|jjDcgc]}|j}}tjj||z}d}d}d}	||vr	|j}	d}n||vrd}|j5|jj!ddd|	||fScc}w#t$r*}
tt|
|
|
j}Yd}
~
gd}
~
wwxYw#1swYIxYwNTF)r{rr+r&rvaluessentinelr
connectionwaitrecvrzrr;r=r\r)r
result_reader
wakeup_readerreadersrworker_sentinelsreadyrrrrfs           rrz3_ExecutorManagerThread.wait_result_broken_or_wakeups"))11
**22
 -004T^^5J5J5L0MN1AJJNN

""7-=#=>	E!
F+002!	e
#I


	'$$&	'Iu,,'O!
F(a!Q__E
F	'	's*C%C*=D *	D3 DD D)ct|trI|jj|}|j	|js|jyy|jj|jd}|X|jr&|jj|jy|jj|jyyr)
raintrrcr)rr[rOrPrFrd
set_resultrQ)rrrrhs    rrz*_ExecutorManagerThread.process_result_itemsk3'"";/A
FFH>>,,."
//33K4G4GNI$(($$22;3H3HI$$//0B0BC	%rcV|j}txs|duxs|jSr)rr%_shutdown_thread)rrs  rrz'_ExecutorManagerThread.is_shutting_downs4**,
!-H$4-,,	.rc|j}|d|_d|_d}td}|#t	ddj|d|_|jjD]!\}}|jj|~#|jj|jjD]}|j|jj j#|j%y)NzKA child process terminated abruptly, the process pool is not usable anymoreTz^A process in the process pool was terminated abruptly while the future was running or pending.z
'''
r:z''')r_brokenrBrokenProcessPoolr1r)rBr[r(rFrdrrr	terminaterrrr)rrrbperOrhrs       rrz'_ExecutorManagerThread.terminate_brokens**,!1H)-H%H !67,"''%.)-/CM#'"9"9"?"?"A	GY**3/		
%%'&&(	A
KKM	
	
%%'	
$$&rcd|j}|}d|_|jrii}|jj	D]%\}}|j
j
r!|||<'||_		|jjyyy#tj$rYnwxYwd|_$r)rr_cancel_pending_futuresr[r(rFcancelr
get_nowaitrr)rrnew_pending_work_itemsrOrhs     rrz2_ExecutorManagerThread.flag_executor_shutting_downs**,(,H%//*,&*.*A*A*G*G*ID&GY$++224:C.w7D+A'++6680  !;;490s3BB'&B'c,|j}d}||krc|jdkDrOt||z
D]#}	|jjd|dz
}%||kr|jdkDrMyyyy#tj
$rY3wxYw)Nrr.)get_n_children_aliveranger
put_nowaitrFull)rn_children_to_stopn_sentinels_sentis    rshutdown_workersz'_ExecutorManagerThread.shutdown_workerss!668 "44--/!3-0@@A
OO..t4$)$
 "44--/!3535zzs A<<BBc`|j|jj|jj|j5|j
jddd|jjD]}|jy#1swY9xYwr)	rrrjoin_threadr\r+rrr)rrs  rrz._ExecutorManagerThread.join_executor_internals%s##%


	'$$&	'&&(	A
FFH			'	'sB$$B-cVtd|jjDS)Nc3<K|]}|jywr)is_alive).0rs  r	<genexpr>z>_ExecutorManagerThread.get_n_children_alive.<locals>.<genexpr>3sAA1::<As)sumrrrs rrz+_ExecutorManagerThread.get_n_children_alive1s A)>)>)@AAAr)r r!r"rrrrrrrrrrrrirjs@rrrsD	-^+Z.->D..('T94
Brrctrtrttda	ddl}	tjd}|dk(ry|dk\ryd|zatt#t$rdattwxYw#ttf$rYywxYw)NTrzxThis Python build lacks multiprocessing.synchronize, usually due to named semaphores being unavailable on this platform.SC_SEM_NSEMS_MAXz@system provides too few semaphores (%d available, 256 necessary))	_system_limits_checked_system_limitedNotImplementedErrormultiprocessing.synchronizeImportErrorrsysconfAttributeError
ValueError)multiprocessing	nsems_maxs  r_check_system_limitsr:s%o66!3*JJ12	B	C	46?@O
o
..+3
F	"/223
J'sAA7A47B	B	c#lK	|D]*}|j|s|j|r,ywr)reverserc)iterableelements  r_chain_from_iterable_of_listsrZs:
 ++- s444ceZdZy)rN)r r!r"r#rrrrfsrrceZdZ		ddddZdZdZdZdZdZe	jjje_dd	d
fd
Zddd
dZ
e	jjje
_xZS)ProcessPoolExecutorN)rc	t|Ptjxsd|_tj
dk(ret
t|j|_nE|dkrtdtj
dk(r|tkDrtdt||_|,|tjd}ntj}||_|jjdd	k7|_
|t|std
||_||_|Ut%|t&std|dkrtd|jjdd	k(rtd
||_d|_i|_d|_t1j2|_t1j6d|_d|_d|_i|_d|_ tC|_"|jtFz}tI||j|j>|j4|jD|_%d|jJ_&|jO|_(tSjT|_+y)Nr.win32rz"max_workers must be greater than 0zmax_workers must be <= spawnF)
allow_noneforkzinitializer must be a callablez&max_tasks_per_child must be an integerz max_tasks_per_child must be >= 1zpmax_tasks_per_child is incompatible with the 'fork' multiprocessing start method; supply a different mp_context.)r^rZr[r\r+T),rr	cpu_count_max_workerssysplatformmin_MAX_WINDOWS_WORKERSrrget_context_mp_contextget_start_method#_safe_to_dynamically_spawn_childrencallable	TypeError_initializer	_initargsrarr_executor_manager_threadrr	threadingLockr	Semaphorerr_queue_countrrrrEXTRA_QUEUED_CALLSrXr
_ignore_epipeSimpleQueuerrrr)rmax_workers
mp_contextrrr
queue_sizes       rrzProcessPoolExecutor.__init__nsf	$	 " 3!D||w&$'(<(,(9(9%;!a !EFF,,')22 -.B-CDFF!,D".^^G4
^^-
%  11U1CvM	
0"8K+@<=='!*137 HII$) !CDD00E0BfL "CDD%8!)-%!&'nn.&/&9&9!&<##% ',$0=,&&);;
%T%5%5#77-->>	@*.&'335rc|jd|js|jt||_|jj	|j
t|j<yyr)rr_launch_processesrstartrr'rs r_start_executor_manager_threadz2ProcessPoolExecutor._start_executor_manager_threads`((0;;&&(,B4,HD)))//144
T::;
1rc|jjdryt|j}||jkr|jyy)NF)blocking)racquirelenrr_spawn_process)r
process_counts  rrz)ProcessPoolExecutor._adjust_process_countsK&&...>DOO,
4,,,
!-rctt|j|jD]}|j	yr)rr#rrr$)rr*s  rrz%ProcessPoolExecutor._launch_processess5
s4??+T->->?	"A!	"rc|jjt|j|j|j
|j|jf}|j||j|j<y)N)targetrH)r
Processrrrrrrrrpidrs  rr$z"ProcessPoolExecutor._spawn_processsm$$"""$$##..++	-
%
.	
	!"rcR|j5|jrt|j|jrt	dt
rt	dt
j}t||||}||j|j<|jj|j|xjdz
c_
|jj|jr|j!|j#|cdddS#1swYyxYw)Nz*cannot schedule new futures after shutdownz6cannot schedule new futures after interpreter shutdownr.)rrrrRuntimeErrorr%rFuturerDrrrryrrrrr)rrGrHrIfws      rsubmitzProcessPoolExecutor.submits

 
 	||'55$$"#OPP"$:;;A!Rv.A:;D$$T%6%67NNt001"0077977**,//1+			sDDD&r.)timeoutrpc	|dkrtdt|	tt|t|d|i|}t
|S)Nr.zchunksize must be >= 1.rp)r1)rr]maprrvrtr)rrGr1rprqresultsr_s      rr3zProcessPoolExecutor.mapsV	(q=677'+gnb9)9J	J&-/-W55rF)cancel_futuresc|j5||_d|_|j|jj	ddd|j
|r|j
j
d|_d|_|j|r|jjd|_d|_
d|_y#1swY}xYwr)rrrrrrr)rrrr)rrr5s   rshutdownzProcessPoolExecutor.shutdown;s

 
 	>+9D($(D!33?44;;=	>((4))..0)-%)d$$&!/3,#	>	>s5B>>C)NNNr#)T)r r!r"rrrrr$r0rExecutor__doc__r3r7rirjs@rrrms~48,.i'GKi'V5
""	#.^^**22FN*.!6:4E4(~~..66HrrrSr)1
__author__rconcurrent.futuresrrrrmultiprocessing.connectionmultiprocessing.queuesrrr	functoolsrrnr	tracebackrWeakKeyDictionaryr'r%rr-_register_atexitrr	Exceptionr1r8r?objectrDrMrUrXrtrvr|rThreadrrrrrBrokenExecutorrr8rr#rr<module>rFs?(T2
	$"(
&-7,,.***	<(y	1	1!&!332	)DH"	93l_BY--_BD	/@	 ,,b7%..b7r