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

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


��Qc@s�ddlZddlZddlZddlZddlmZddlmZmZdddddd	d
ddd
ddddgZ	dZ
dZdZdZ
dZdZdZdaead�Zd�Zd�Zd�Zd�Zdd�Zd�Zej�Zej�Zd �Z d!�Z!iZ"ej�Z#d
e$fd"��YZ%dd#�Z&d$�Z'ea(eee&eed%�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.pyRCscGs trtjt||�ndS(N(RRtDEBUG(RR((s*/sys/lib/python2.7/multiprocessing/util.pyRGscGs trtjt||�ndS(N(RRtINFO(RR((s*/sys/lib/python2.7/multiprocessing/util.pyRKscGs trtjt||�ndS(N(RRR(RR((s*/sys/lib/python2.7/multiprocessing/util.pyROscCs�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.pyRSs
	
 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.pyRps	

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
    cCsk|dk	r$tj||�|_n||_||_|p?i|_|tj�f|_	|t
|j	<dS(N(R6tweakreftreft_weakreft	_callbackt_argst_kwargst_finalizer_counterRHt_keyt_finalizer_registry(tselfRDtcallbackRtkwargsR4((s*/sys/lib/python2.7/multiprocessing/util.pyt__init__�s		cCs�yt|j=Wntk
r+td�n^Xtd|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 calling %s with args %s and kwargs %sN(	RRRQtKeyErrorRRMRNROR6RL(RStwrtres((s*/sys/lib/python2.7/multiprocessing/util.pyt__call__�s
%cCsKyt|j=Wntk
r!n&Xd|_|_|_|_|_dS(s3
        Cancel finalization of the object
        N(RRRQRWR6RLRMRNRO(RS((s*/sys/lib/python2.7/multiprocessing/util.pytcancel�s

cCs
|jtkS(sS
        Return whether this finalizer is still waiting to invoke callback
        (RQRR(RS((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(RSRDtx((s*/sys/lib/python2.7/multiprocessing/util.pyt__repr__�s
		(N(	R]t
__module__t__doc__R6RVRZR[R\Rd(((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(Rg(tminpriority(s*/sys/lib/python2.7/multiprocessing/util.pyRhstreverses
calling %si�(
RRR6R>R?R-RR@t	tracebackt	print_exctclear(RitfRcR>tkeyt	finalizerRk((Ris*/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(RRRqRRRg((s*/sys/lib/python2.7/multiprocessing/util.pyR! s	


	
cBseZd�Zd�ZRS(cCs|j�t|tj�dS(N(t_resetR
R
(RS((s*/sys/lib/python2.7/multiprocessing/util.pyRVKs
cCs1tj�|_|jj|_|jj|_dS(N(t	threadingtLockt_locktacquiretrelease(RS((s*/sys/lib/python2.7/multiprocessing/util.pyRxOs(R]ReRVRx(((s*/sys/lib/python2.7/multiprocessing/util.pyR
Js	cBseZd�Zd�ZRS(cCst|d��dS(NcSs
|jj�S(N(t__dict__Rm(RD((s*/sys/lib/python2.7/multiprocessing/util.pyRhVs(R
(RS((s*/sys/lib/python2.7/multiprocessing/util.pyRVUscCst|�dfS(N((ttype(RS((s*/sys/lib/python2.7/multiprocessing/util.pyt
__reduce__Ws(R]ReRVR�(((s*/sys/lib/python2.7/multiprocessing/util.pyRTs	(.t	itertoolsRJRRyt
subprocessRtmultiprocessing.processRRt__all__tNOTSETRRRRRR(R6RtFalseR.RRRRRRR	tWeakValueDictionaryR=tcountRGRFR
RRRPtobjectRRqRRrR!R"R
tlocalR(((s*/sys/lib/python2.7/multiprocessing/util.pyt<module>#sR										I$		"


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].