Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/multiprocessing/util.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@s�ddlZddlZddlZddlZddlZddlmZddlmZm	Z	dddddd	d
ddd
ddddgZ
dZdZdZ
dZdZdZdZdaead�Zd�Zd�Zd�Zd�Zdd�Zd�Zej�Zej�Z d �Z!d!�Z"iZ#ej�Z$d
e%fd"��YZ&dd#�Z'd$�Z(ea)eee'e	ed%�Z*ej+e*�de%fd&��YZ,dej-fd'��YZ.dS((i�N(t_args_from_interpreter_flags(tcurrent_processtactive_childrent	sub_debugtdebugtinfotsub_warningt
get_loggert
log_to_stderrtget_temp_dirtregister_after_forkt
is_exitingtFinalizetForkAwareThreadLocktForkAwareLocaltSUBDEBUGt
SUBWARNINGiii
iitmultiprocessings+[%(levelname)s/%(processName)s] %(message)scGs trtjt||�ndS(N(t_loggertlogR(tmsgtargs((s*/sys/lib/python2.7/multiprocessing/util.pyRDscGs trtjt||�ndS(N(RRtDEBUG(RR((s*/sys/lib/python2.7/multiprocessing/util.pyRHscGs trtjt||�ndS(N(RRtINFO(RR((s*/sys/lib/python2.7/multiprocessing/util.pyRLscGs trtjt||�ndS(N(RRR(RR((s*/sys/lib/python2.7/multiprocessing/util.pyRPscCs�ddl}ddl}|j�z�ts�|jt�adt_|jtd�|jt	d�t
|d�r�|jt�|j
t�q�|jjtdif�|jjtdif�nWd|j�XtS(	s0
    Returns logger used by multiprocessing
    i�NiRRt
unregister(((tloggingtatexitt_acquireLockRt	getLoggertLOGGER_NAMEt	propagatetaddLevelNameRRthasattrRt_exit_functiontregistert
_exithandlerstremovetappendt_releaseLock(RR((s*/sys/lib/python2.7/multiprocessing/util.pyRTs
	
 cCsjddl}t�}|jt�}|j�}|j|�|j|�|r`|j|�nta	t
S(sB
    Turn on logging and add a handler which prints to stderr
    i�N(RRt	FormattertDEFAULT_LOGGING_FORMATt
StreamHandlertsetFormattert
addHandlertsetLeveltTruet_log_to_stderrR(tlevelRtloggert	formatterthandler((s*/sys/lib/python2.7/multiprocessing/util.pyRqs	

cCs�t�jdkrwddl}ddl}|jdd�}td|�td|jd|gdd�|t�_nt�jS(Ni�tprefixspymp-screated temp directory %sRtexitpriorityi��Rt_tempdirtNonetshutilttempfiletmkdtempRRtrmtree(R7R8ttempdir((s*/sys/lib/python2.7/multiprocessing/util.pyR	�s
cCsqttj��}|j�xN|D]F\\}}}}y||�Wq#tk
rh}td|�q#Xq#WdS(Ns after forker raised exception %s(tlistt_afterfork_registrytitemstsortt	ExceptionR(R>tindextidenttfunctobjte((s*/sys/lib/python2.7/multiprocessing/util.pyt_run_after_forkers�s
cCs#|ttj�t|�|f<dS(N(R=t_afterfork_countertnexttid(RDRC((s*/sys/lib/python2.7/multiprocessing/util.pyR
�scBsGeZdZdddd�Zdd�Zd�Zd�Zd�ZRS(sA
    Class which supports object finalization using weakrefs
    cCsz|dk	r$tj||�|_n||_||_|p?i|_|tj�f|_	t
j�|_|t
|j	<dS(N(R6tweakreftreft_weakreft	_callbackt_argst_kwargst_finalizer_counterRHt_keytostgetpidt_pidt_finalizer_registry(tselfRDtcallbackRtkwargsR4((s*/sys/lib/python2.7/multiprocessing/util.pyt__init__�s		cCs�yt|j=Wntk
r+td�n�X|jtj�krTtd�d}n4td|j|j	|j
�|j|j	|j
�}d|_|_|_	|_
|_|SdS(sQ
        Run the callback unless it has already been called or cancelled
        sfinalizer no longer registereds+finalizer ignored because different processs/finalizer calling %s with args %s and kwargs %sN(RURQtKeyErrorRRTRRRSR6RMRNRORL(RVtwrtres((s*/sys/lib/python2.7/multiprocessing/util.pyt__call__�s

	%cCsKyt|j=Wntk
r!n&Xd|_|_|_|_|_dS(s3
        Cancel finalization of the object
        N(RURQRZR6RLRMRNRO(RV((s*/sys/lib/python2.7/multiprocessing/util.pytcancel�s

cCs
|jtkS(sS
        Return whether this finalizer is still waiting to invoke callback
        (RQRU(RV((s*/sys/lib/python2.7/multiprocessing/util.pytstill_active�scCs�y|j�}Wnttfk
r/d}nX|dkr@dSdt|jd|j�}|jr|dt|j�7}n|jr�|dt|j�7}n|j	ddk	r�|dt|j	d�7}n|dS(	Ns<Finalize object, dead>s<Finalize object, callback=%st__name__s, args=s	, kwargs=is, exitprority=t>(
RLtAttributeErrort	TypeErrorR6tgetattrRMRNtstrRORQ(RVRDtx((s*/sys/lib/python2.7/multiprocessing/util.pyt__repr__�s
		(N(	R`t
__module__t__doc__R6RYR]R^R_Rg(((s*/sys/lib/python2.7/multiprocessing/util.pyR�s		cs�tdkrdS�dkr(d�}n�fd�}gtj�D]}||�rD|^qD}|jdt�xV|D]N\}}td|�y|�Wqytk
r�ddl}|j�qyXqyW�dkr�j	�ndS(s�
    Run all finalizers whose exit priority is not None and at least minpriority

    Finalizers with highest priority are called first; finalizers with
    the same priority will be called in reverse order of creation.
    NcSs|dddk	S(Ni(R6(tp((s*/sys/lib/python2.7/multiprocessing/util.pyt<lambda>scs&|dddk	o%|dd�kS(Ni(R6(Rj(tminpriority(s*/sys/lib/python2.7/multiprocessing/util.pyRk
streverses
calling %si�(
RUR6R>R?R-RR@t	tracebackt	print_exctclear(RltfRfR>tkeyt	finalizerRn((Rls*/sys/lib/python2.7/multiprocessing/util.pyt_run_finalizers�s +

cCstptdkS(s6
    Returns true if the process is shutting down
    N(t_exitingR6(((s*/sys/lib/python2.7/multiprocessing/util.pyRscCs�|d�|d�|d�|�dk	r�x:|�D]/}|jr7|d|j�|jj�q7q7Wx.|�D] }|d|j�|j�qtWn|d�|�dS(Nsprocess shutting downs2running all "atexit" finalizers with priority >= 0is!calling terminate() for daemon %sscalling join() for process %ss)running the remaining "atexit" finalizers(R6t	_daemonictnamet_popent	terminatetjoin(RRRtRRRj((s*/sys/lib/python2.7/multiprocessing/util.pyR!&s	


	
cBseZd�Zd�ZRS(cCs|j�t|tj�dS(N(t_resetR
R
(RV((s*/sys/lib/python2.7/multiprocessing/util.pyRYQs
cCs1tj�|_|jj|_|jj|_dS(N(t	threadingtLockt_locktacquiretrelease(RV((s*/sys/lib/python2.7/multiprocessing/util.pyR{Us(R`RhRYR{(((s*/sys/lib/python2.7/multiprocessing/util.pyR
Ps	cBseZd�Zd�ZRS(cCst|d��dS(NcSs
|jj�S(N(t__dict__Rp(RD((s*/sys/lib/python2.7/multiprocessing/util.pyRk\s(R
(RV((s*/sys/lib/python2.7/multiprocessing/util.pyRY[scCst|�dfS(N((ttype(RV((s*/sys/lib/python2.7/multiprocessing/util.pyt
__reduce__]s(R`RhRYR�(((s*/sys/lib/python2.7/multiprocessing/util.pyRZs	(/RRt	itertoolsRJRR|t
subprocessRtmultiprocessing.processRRt__all__tNOTSETRRRRRR(R6RtFalseR.RRRRRRR	tWeakValueDictionaryR=tcountRGRFR
RURPtobjectRRtRRuR!R"R
tlocalR(((s*/sys/lib/python2.7/multiprocessing/util.pyt<module>#sT										N$		"


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].