%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/paste/debug/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyo

�
a�Nc@s�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddgZde
fd��YZd�Zd	�Zd
e
fd��YZdd
d�ZdS(se
Middleware that profiles the request and displays profiling
information at the bottom of each page.
i����N(tStringIO(tresponsetProfileMiddlewaretprofile_decoratorcBs/eZdZdZdddd�Zd�ZRS(s�
    Middleware that profiles all requests.

    All HTML pages will have profiling information appended to them.
    The data is isolated to that single request, and does not include
    data from previous requests.

    This uses the ``hotshot`` module, which affects performance of the
    application.  It also runs in a single-threaded mode, so it is
    only usable in development environments.
    sWclear: both; background-color: #ff9; color: #000; border: 2px solid #000; padding: 5px;sprofile.log.tmpi(cCs.||_tj�|_||_||_dS(N(tappt	threadingtLocktlocktlog_filenametlimit(tselfRtglobal_confRR	((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyt__init__&s		c
s�g�g�d���fd������fd�}�jj�z+tj�j�}|jd�jdd��z|j|�Wd|j	�Xdj
����d}tj|d�}|dks�|j
d�r��gStjj�j�}|j�|jd	d
�t|j�j�}t|j�j�}	�d�jtj|�tj|	�f7��gSWd�jj�XdS(Ncs*�j||g��|||��jS(N(textendtappend(tstatustheaderstexc_info(tbodytcatch_responsetstart_response(sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pytreplace_start_response1scsG�j���}z�j|�Wdt|d�rB|j�nXdS(Ntclose(RR
thasattrR(tapp_iter(RtenvironRR
(sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pytrun_app5s
tURLt	PATH_INFOtiscontent-types	text/htmlttimetcallss<pre style="%s">%s
%s</pre>(tNoneRtacquirethotshottProfileRtaddinfotgettruncallRtjoinRtheader_valuet
startswithtstatstloadt
strip_dirst
sort_statstcapture_outputtprint_statsR	t
print_callerststyletcgitescapetrelease(
R
RRRtprofRtcontent_typeR*toutputtoutput_callers((RRRRR
RsD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyt__call__.s4


&N(t__name__t
__module__t__doc__R1R RR9(((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyRscOsCt�}tj}|t_z|||�Wd|t_X|j�S(N(Rtsyststdouttgetvalue(tfunctargstkwtoutt
old_stdout((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyR.Vs			
cs/�jd�rd�}|S�fd�}|S(s�
    Profile a single function call.
    
    Used around a function, like::

        @profile_decorator(options...)
        def ...

    All calls to the function will be profiled.  The options are
    all keywords, and are:

        log_file:
            The filename to log to (or ``'stdout'`` or ``'stderr'``).
            Default: stderr.
        display_limit:
            Only show the top N items, default: 20.
        sort_stats:
            A list of string-attributes to sort on.  Default
            ``('time', 'calls')``.
        strip_dirs:
            Strip directories/module names from files?  Default True.
        add_info:
            If given, this info will be added to the report (for your
            own tracking).  Default: none.
        log_filename:
            The temporary filename to log profiling data to.  Default;
            ``./profile_data.log.tmp``
        no_profile:
            If true, then don't actually profile anything.  Useful for
            conditional profiling.
    t
no_profilecSs|S(N((R@((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyt	decorator�scs��fd�}|S(Ncst���||�S(N(tDecoratedProfile(RARB(R@toptions(sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pytreplacement�s((R@RI(RH(R@sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyRF�s(R%(RHRF((RHsD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyRbs
"	RGcBs8eZej�Zd�Zd�Zd�Zd�ZRS(cKs||_||_dS(N(R@RH(R
R@RH((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyR�s	cOs<|jj�z|j|j||�SWd|jj�XdS(N(RR!tprofileR@R4(R
RARB((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyR9�s
cOse|j}|jdd�}tj|�}|jd|j|||��|jd�ro|jd|d�nd}zKtj�}y|j|||�}	Wnt	j
�}nXtj�}
Wd|j�Xtjj
|�}tj|�|jdt�r|j�n|j|jdd��|jd
d�}t|j|�}
t|j|�}|jd�}|dkr�t	j}nV|dkr�t	j}n>t|d�}|jddd�|jdtjd��|jd|j|||��|jd|
|�|j|
�|j|�|dkr@|j�n|ra|d|d|d�n|	S(NRsprofile_data.log.tmps
Function Calltadd_infos
Extra infoR,R-RRt
display_limititlog_filetstderrt-R>tas
%s
i<s	Date: %s
s%csFunction call: %s
sWall time: %0.2f seconds
iii(stimescalls(Nsstderr(ROsstdout(NROsstdoutsstderr(RHR%R"R#R$tformat_functionR RR&R=RRR*R+tostunlinktTrueR,R-R.R/R0RNR>topentwritetstrftime(R
R@RARBtopst
prof_filenameR5Rt
start_timetresulttend_timeR*RLR7R8toutput_filetf((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyRJ�sX		

		


cOs_tt|�}|jg|j�D]\}}d||f^q"�d|jdj|�fS(Ns%s=%rs%s(%s)s, (tmaptreprR
titemsR:R'(R
R@RARBtktv((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyRQ�s0(	R:R;RRRRR9RJRQ(((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyRG�s
			1sprofile.log.tmpi(cCs"t|�}t|d|d|�S(s

    Wrap the application in a component that will profile each
    request.  The profiling data is then appended to the output
    of each page.

    Note that this serializes all requests (i.e., removing
    concurrency).  Therefore never use this in production.
    RR	(tintR(RRRR	((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pytmake_profile_middleware�s(R<R=RRR"t
hotshot.statsRR2Rt	cStringIORtpasteRt__all__tobjectRR.RRGRe(((sD/opt/alt/python27/lib/python2.7/site-packages/paste/debug/profile.pyt<module>s A		,I

Zerion Mini Shell 1.0