Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/python/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/python/rebuild.pyc


[XMc@sdZddlZddlZddlZddlZddlmZmZejadddYZ	iZ
dZdZde
fd	YZd
ZdZdd
ZdS(s&
*Real* reloading support for Python.
iN(tlogtreflectt	SensitivecBs/eZdZeZdZdZdZRS(s
    A utility mixin that's sensitive to rebuilds.

    This is a mixin for classes (usually those which represent collections of
    callbacks) to make sure that their code is up-to-date before running.
    cCs|jtk}|S(N(tlastRebuild(tselftyn((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pytneedRebuildUpdate scCstj|_dS(N(ttimeR(R((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pytrebuildUpToDate$scCst|}|tjkr%t|S|tjkrl|jdkrVt|j|j	St|j|j	SnM|tj
krt|dd|S|tjkrt|St
jd|SdS(s
        Get the latest version of an object.

        This can handle just about anything callable; instances, functions,
        methods, and classes.
        tnothingswarning returning anObject!N(ttypettypestFunctionTypetlatestFunctiont
MethodTypetim_selftNonetgetattrtim_classt__name__tInstanceTypet	ClassTypetlatestClassRtmsg(RtanObjecttt((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pytlatestVersionOf's


(Rt
__module__t__doc__RRRR(((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pyRs
		cCs>t|j}tj|}|dkr.|St||jS(s/
    Get the latest version of a function.
    N(tidtfunc_globalst
_modDictIDMaptgetRRR(toldFunctdictIDtmodule((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pyR
Bs
cCstj|j}t||j}g|jD]}t|^q.}yt||_|SWnUtk
r|jdkr|St|dt	}||jt|t
|jSXdS(s,
    Get the latest version of a class.
    t__builtin__t
__metaclass__N(RtnamedModuleRRRt	__bases__Rttuplet	TypeErrorR
tdictt__dict__(toldClassR#tnewClasstbasetnewBasestctor((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pyROs"
tRebuildErrorcBseZdZRS(sT
    Exception raised when trying to rebuild a class whereas it's not possible.
    (RRR(((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pyR1cscCsRyt|j|_Wn5tk
rMt|jdrGtdqNnXdS(s,
    Updates an instance to be current.
    t	__slots__s2Can't rebuild class with __slots__ on Python < 2.6N(Rt	__class__R)thasattrR1(R((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pytupdateInstanceis
cCs[|dkrtdnt|tjdtj|j|ft||}|S(s<
    A getattr method to cause a class to be refreshed.
    t__del__sWithout this, Python segfaults.s#(rebuilding stale %s instance (%s))(tAttributeErrorR5RRRtqualR3R(Rtnametresult((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pyt__getattr__vs
#icCs+tjat|dr6|js6tdq6n|rYtjdt|jnddl	m
}t|_|j
}|tt|<i}i}i}i}|rtjdt|jnx+|jD]\}}	t|	tjkr<|	j|jkrd||	<|r9tjjdtjjq9qqt|	tjkr|	j|j
krd||	<|rtjjd	tjjqqqt|	tr|	j|jkrd||	<|rtjjd
tjjqqqqW|j||j||j}
|j}|j}|j}|rktjdtjdt|jnt|tj |rtjd
t|jnx|D]}t!||j|krtjdt"j#|q|r
tjjdtjjnd|_$|j
j%t&|_&|j|_qW|rNddl'}nx|D]}
t!||
j}||
krtjdt"j#|
qUx;|j(|
D]*}t!|dd|
kr||_*qqWqUW|rtjdtjdt|jnd}xt+j,jD]\}}|d}||ks|dkrRqnt|dsgqnt|dr|qnd}x(|j
jD]\}}	yt-|	Wnt.k
rqnX|
|	rdt|	tjkr|r
tjjdtjjnt/|	}n2|r?tjjd	tjjnt0|	}d}t1|||qt|	tjkrx-|	j$D]}|
|rt/|	qqWqqW|r|r|ddkrtjjdtjjqqWt2|_|r'tjdtjdt|jn|S(sO
    Reload a module and do as much as possible to replace its references.
    tALLOW_TWISTED_REBUILDsI am not allowed to be rebuilt.sRebuilding %s...i(t
componentss  (scanning %s): itctftots  (reload   %s)s  (cleaning %s): s)WARNING: class %s not replaced by reload!txNs-WARNING: new-class %s not replaced by reload!R3s  (fixing   %s): it__file__t
__bundle__i
t.s   Rebuilt %s.((3RRR4R<tRuntimeErrorRRtstrRttwisted.pythonR=tTruetALLOW_DUPLICATESR+RRtitemsR
RRRtlogfiletwritetflushRRt
isinstancetupdatethas_keytkeystreloadt	linecachet
clearcacheRRR8R'tclearR;tgct
get_referrersRR3tsystmodulesthasht	ExceptionRR
tsetattrtFalse(R#tdoLogR=tdt
newclassestclassest	functionstvaluestktvt
fromOldModuletclazzRWtnclasstgatrtmodcounttmktmodtchangedtnvR.((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pytrebuilds			




	



	
	



	
((RRYRRRTRHRRRRRR
RR\R1R5R;Rq(((s:/usr/lib/python2.7/dist-packages/twisted/python/rebuild.pyt<module>s*