AlkantarClanX12

Your IP : 3.147.13.220


Current Path : /usr/lib64/python2.7/Demo/metaclasses/
Upload File :
Current File : //usr/lib64/python2.7/Demo/metaclasses/Trace.pyc

�
��^c@s�dZddlZddlZddd��YZddd��YZddd��YZd	efd
��YZeddidd6�Zd
�Z	e
dkr�e	�ndS(s?Tracing metaclass.

XXX This is very much a work in progress.

i����NtTraceMetaClasscBs>eZdZdZd�Zd�Zd�Zd�ZdZ	RS(sUMetaclass for tracing.

    Classes defined using this metaclass have an automatic tracing
    feature -- by setting the __trace_output__ instance (or class)
    variable to a file object, trace messages about all calls are
    written to the file.  The trace formatting can be changed by
    defining a suitable __trace_call__ method.

    icCs(||_||_||_d|_dS(Ni(t__name__t	__bases__t_TraceMetaClass__dictt_TraceMetaClass__inited(tselftnametbasestdict((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyt__init__s			cCsiy|j|SWnStk
rdx6|jD]+}y|j|�SWq)tk
rSq)Xq)Wt|�nXdS(N(RtKeyErrorRt__getattr__tAttributeError(RRtbase((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyRs

cCs*|js||j|<n
||j|<dS(N(Rt__dict__R(RRtvalue((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyt__setattr__(s	cOsZt�}|j|�y|jd�}Wntk
rEd�}nXt|||�|S(NR	cSsdS(N(tNone(((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyt<lambda>4t(tTracingInstancet
__meta_init__RRtapply(Rtargstkwtinsttinit((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyt__call__.s	


N(
Rt
__module__t__doc__RR	RRRRt__trace_output__(((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR	s					
RcBs)eZdZd�Zd�Zd�ZRS(s9Helper class to represent an instance of a tracing class.cGs|j|d|�dS(Ns
(twrite(RtfptfmtR((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyt__trace_call__=scCs
||_dS(N(t_TracingInstance__class(Rtklass((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR@scCs�y|jj|�}Wntk
r2t|�nXt|�tjkrL|S|jjd|}|jsv|dkr�t|||�St	|||�SdS(Nt.R"(
R#RRttypettypestFunctionTypeRRtNotTracingWrappertTracingWrapper(RRtrawtfullname((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyRCs

(RRRR"RR(((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR:s		R)cBseZd�Zd�ZRS(cCs||_||_||_dS(N(RtfuncR(RRR-R((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR	Ss		cOst|j|jf||�S(N(RR-R(RRR((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyRWs(RRR	R(((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR)Rs	R*cBseZd�ZRS(cOs�|jj|jjd|j|j||�y#t|j|jf||�}WnMtj�\}}}|jj|jjd|j||�|||�n'X|jj|jjd|j|�|SdS(Ns#calling %s, inst=%s, args=%s, kw=%ss'returning from %s with exception %s: %ssreturning from %s with value %s(RR"RRRR-tsystexc_info(RRRtrvtttvttb((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR#
(RRR(((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR*ZstTracedRcCs�dtfd��Yadtfd��Yatd�}|GH|jGH|jd�GH|jd�GH|jd�GH|jd	�GH|jd
�GH|jGHtjGHtjGHtjGHtjGHt�}|GH|jd�GH|jd�GH|jGHdS(NtCcBs/eZdd�Zd�Zd�ZejZRS(icSs
||_dS(N(tx(RR6((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR	sRcSs
||_dS(N(R6(RR6((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pytm1tRcSs|j|S(N(R6(Rty((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pytm2uR(RRR	R7R9R.tstdoutR(((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR5rs		tDcBseZd�ZdZRS(cSsd|fGHtj||�S(NsD.m2(%r)(R5R9(RR8((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR9xsN(RRR9RR(((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyR;ws	i�idi
i!ii�(R4R5R;R6R7R9R	(R6R8((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyt_testps(	t__main__(((((RR'R.RRR)R*RR4R<R(((s./usr/lib64/python2.7/Demo/metaclasses/Trace.pyt<module>s1