�`^c@s�ddlZddlZddlZddlZddlmZmZmZmZm Z m
Z
ddddgZeZeZ
eZddd��YZdS( i�N(t
WHAT_ENTERt WHAT_EXITtWHAT_LINENOtWHAT_DEFINE_FILEtWHAT_DEFINE_FUNCt
WHAT_ADD_INFOt LogReadertENTERtEXITtLINEcBsweZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z dd �Z
d
�Zd�Zd�Z
RS(
cCs�i|_i|_tj|�|_|jj|_|jj|_d|jkrd|jd|_ n d|_ g|_|jj|_
|jj|_dS(Nscurrent-directory(t_filemapt_funcmapt_hotshott logreadert_readertnextt _nextitemtinfot_infotcwdtNonet_stacktappendt_appendtpopt_pop(tselftlogfn((s!/sys/lib/python2.7/hotshot/log.pyt__init__s cCs|jj�dS(N(Rtclose(R((s!/sys/lib/python2.7/hotshot/log.pyR/scCs
|jj�S(s8Return the file descriptor of the log reader's log file.(Rtfileno(R((s!/sys/lib/python2.7/hotshot/log.pyR2scCsdS(s�This method is called for each additional ADD_INFO record.
This can be overridden by applications that want to receive
these events. The default implementation does not need to be
called by alternate implementations.
The initial set of ADD_INFO records do not pass through this
mechanism; this is only needed to receive notification when
new values are added. Subclasses can inspect self._info after
calling LogReader.__init__().
N((Rtkeytvalue((s!/sys/lib/python2.7/hotshot/log.pytaddinfo6scCs0y|j|SWntk
r+td�nXdS(Nsunknown fileno(R
tKeyErrort
ValueError(RR((s!/sys/lib/python2.7/hotshot/log.pytget_filenameDs
cCs
|jj�S(N(R
tvalues(R((s!/sys/lib/python2.7/hotshot/log.pyt
get_filenamesJscCs[tjjtjj|��}x-|jj�D]\}}||kr.|Sq.Wtd�dS(Nsunknown filename(tostpathtnormcasetnormpathR
titemsR#(RtfilenameRtname((s!/sys/lib/python2.7/hotshot/log.pyt
get_filenoMs
cCs6y|j||fSWntk
r1td�nXdS(Nsunknown function location(RR"R#(RRtlineno((s!/sys/lib/python2.7/hotshot/log.pytget_funcnameTs
ic
Cs�x�|j�\}}}}|tkrh|j||�\}}|||f}|j|�|||fS|tkr�y||j�|fSWq�tk
r�t�q�Xn|tkr�j d\}} }||||f|fS|t
krtjj
tjj|��}||j|<q|tkrO|j|}||f|j||f<q|tkr�|dkrs||_n|j||�qtd�qdS(Ni�scurrent-directorysunknown event type(RRt_decode_locationRRRt
IndexErrort
StopIterationRRRR'R(R)R*R
RRRRR!R#(
RtindextwhatttdeltaRR/R,tfuncnametttfirstlineno((s!/sys/lib/python2.7/hotshot/log.pyR_s4
cCs|S(N((R((s!/sys/lib/python2.7/hotshot/log.pyt__iter__�scCs�y|j||fSWn�tk
r�|j|�rAd}}ny|j||f\}}Wq�tk
r�|jj|�}d}||f|j||f<q�XnX||fS(N(RR"t _loadfileRR
tget(RRR/R,R7((s!/sys/lib/python2.7/hotshot/log.pyR1�s
!cCs�y|j|}Wntk
r.dG|GHdSX|dkr?dStjjtjj|j|��}yt|�}Wnt k
r�dSXt
j|j��}|j
�tj}tj}|jd�g}x�|r�|j�} y| d}
Wnttfk
r
q�nX|
|krC|| ddf|j|| ddf<n0|
|krs|df|j|| ddf<n|jt| d��q�WdS(NsCould not identify fileIdiiis<lambda>(R
R"RR'R(R)tjoinRtopentIOErrortparsertsuitetreadRtsymboltfuncdeftlambdefttotupleRR2t TypeErrorRtextendtlist(RRR,tabsnametfptstRDREtstackttreetsym((s!/sys/lib/python2.7/hotshot/log.pyR;�s8
$
,$(t__name__t
__module__RRRR!R$R&R.R0RR:R1R;(((s!/sys/lib/python2.7/hotshot/log.pyRs ' ((Rtos.pathR'R@RCRRRRRRt__all__RRR R(((s!/sys/lib/python2.7/hotshot/log.pyt<module>s.
|