Your IP : 18.222.182.226


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/cgitb.cpython-33.pyc

�
��f	/c@s%dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
dd�ZgZdd�Z
dd�Zd	d
�Zdd�Zd
d�Zddd�Zddd�ZGdd�d�Ze�jZdddddd�ZdS(u�More comprehensive traceback formatting for Python scripts.

To enable this module, do:

    import cgitb; cgitb.enable()

at the top of your script.  The optional arguments to enable() are:

    display     - if true, tracebacks are displayed in the web browser
    logdir      - if set, tracebacks are written to files in this directory
    context     - number of lines of source code to show for each stack frame
    format      - 'text' or 'html' controls the output format

By default, tracebacks are displayed but not saved, the context is 5 lines
and the output format is 'html' (for backwards compatibility with the
original use of this module)

Alternatively, if you have caught an exception and want cgitb to display it
for you, call cgitb.handler().  The optional argument to handler() is a
3-item tuple (etype, evalue, etb) just like the value of sys.exc_info().
The default handler displays output as HTML.

iNcCsdS(uAReturn a string that resets the CGI and browser to a known state.u'<!--: spam
Content-Type: text/html

<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font>((((u*/opt/alt/python33/lib64/python3.3/cgitb.pyureset#suresetcCs|rd|dSdSdS(Nu<small>u</small>u((utext((u*/opt/alt/python33/lib64/python3.3/cgitb.pyusmall.susmallcCs|rd|dSdSdS(Nu<strong>u	</strong>u((utext((u*/opt/alt/python33/lib64/python3.3/cgitb.pyustrong4sustrongcCs|rd|dSdSdS(Nu<font color="#909090">u</font>u((utext((u*/opt/alt/python33/lib64/python3.3/cgitb.pyugrey:sugreycCs�||krd||fS||jkr:d|j|fSd|jkr�|jd}t|�ti�kr�||kr�d||fSq�t||�r�dt||�fSndtfS(u9Find the value for a given name in the given environment.ulocaluglobalu__builtins__ubuiltinN(u	f_globalsutypeuhasattrugetattruNoneu	__UNDEF__(unameuframeulocalsubuiltins((u*/opt/alt/python33/lib64/python3.3/cgitb.pyulookup@s
ulookupcCs2gdddtf\}}}}}xtj|�D]�\}}	}
}}|tjkr\Pn|tjkr�|	tjkr�|dkr�|tk	r�t||	t�}|j	||	||f�q�q$t
|	||�\}
}|j	|	|
|f�n/|	dkr||d7}|}nd\}}|	}q4W|S(uEScan one logical line of Python and look up values of variables used.uu.N(Nu(uNoneu	__UNDEF__utokenizeugenerate_tokensuNEWLINEuNAMEukeywordukwlistugetattruappendulookup(ureaderuframeulocalsuvarsu	lasttokenuparentuprefixuvalueuttypeutokenustartuendulineuwhere((u*/opt/alt/python33/lib64/python3.3/cgitb.pyuscanvarsPs"$% 	
uscanvarsic"
s�|\}}}t|t�r*|j}ndtjj�ddtj}tjtj��}dt	j
jdtt	j
j
t|���dd|d|�d	}d
tdd�d
}g}	tj||�}
x�|
D]�\}�}}
}}�r.tjj���d�t	j
j
��f}n
d�}tj|�\}}}}d}|
dkr�dt|
�tj||||ddd��}ni�|g��fdd�}t|||�}dd||fg}|d)k	r�||}x�|D]�}tddtt|��t|��d}|�krpd|t	j
j|�f}|jd|�n3d|t	j
j|�f}|jdt|��|d7}qWnig}}x�|D]�\}}} ||kr�q�nd||<| tk	r�|d-kr"d |t|�}n8|d!kr=t|�}n|t|jd"�d.�}|jd#|t	j
j| �f�q�|j|d$�q�W|jdttd%j|����|	jd&d'j|��q�Wd(tt	j
j
t|���t	j
j
t|��fg}!xet |�D]W}|d)d�d*krEq#nt	j
jt!||��} |!jd+||| f�q#W|dj|	�dj|!�d,t	j
j
djt"j#|||���S(/u9Return a nice HTML document describing a given traceback.uPython iu: u<body bgcolor="#f0f0f8">u<big><big>%s</big></big>u#ffffffu#6622aau<br>u�
<p>A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.</p>u<tt>u&nbsp;iu&nbsp;</tt>u<a href="file://%s">%s</a>u?uuin uformatvaluecSsdtjj|�S(Nu=(upydocuhtmlurepr(uvalue((u*/opt/alt/python33/lib64/python3.3/cgitb.pyu<lambda>�suhtml.<locals>.<lambda>c
s<d�|d<ztj�|d�SWd|dd7<XdS(Nii(u	linecacheugetline(ulnum(ufileu	highlight(u*/opt/alt/python33/lib64/python3.3/cgitb.pyureader�suhtml.<locals>.readeru+<tr><td bgcolor="#d8bbff">%s%s %s</td></tr>u<big>&nbsp;</big>u<tt>=&gt;%s%s</tt>u&<tr><td bgcolor="#ffccee">%s</td></tr>u<tt>&nbsp;&nbsp;%s%s</tt>u<tr><td>%s</td></tr>iuglobalubuiltinu<em>%s</em> ulocalu.u%s&nbsp;= %su <em>undefined</em>u, uF
<table width="100%%" cellspacing=0 cellpadding=0 border=0>
%s</table>u
u	<p>%s: %sNu_u
<br>%s%s&nbsp;=
%su�


<!-- The above is a description of an error in a Python program, formatted
     for a Web browser because the 'cgitb' module was enabled.  In case you
     are not reading this in a Web browser, here is the original traceback:

%s
-->
(uglobalubuiltini����($u
isinstanceutypeu__name__usysuversionusplitu
executableutimeuctimeupydocuhtmluheadingustronguescapeustrusmalluinspectugetinnerframesuosupathuabspathugetargvaluesuformatargvaluesuscanvarsuNoneulenu	preformatuappendugreyu	__UNDEF__ureprujoinudirugetattru	tracebackuformat_exception("ueinfoucontextuetypeuevalueuetbupyverudateuheaduindentuframesurecordsuframeulnumufunculinesuindexulinkuargsuvarargsuvarkwulocalsucallureaderuvarsurowsuiulineunumudoneudumpunameuwhereuvalueu	exception((ufileu	highlightu*/opt/alt/python33/lib64/python3.3/cgitb.pyuhtmles|"@



.

&&	uhtmlc sl|\}}}t|t�r*|j}ndtjj�ddtj}tjtj��}dt	|�||fd}g}t
j||�}	x*|	D]"\}
�}}}
}�r�tj
j��p�d�t
j|
�\}}}}d}|dkr/d|t
j||||d	d
d��}ni�|g��fdd
�}t||
|�}d�|fg}|dk	r�||}x<|
D]1}d|}|j||j��|d7}q�Wnig}}x�|D]�\}}}||kr�q�nd||<|tk	rz|dkr.d|}n&|dkrT||jd�d}n|jd|tjj|�f�q�|j|d�q�W|jdj|��|jddj|��q�Wdt	|�t	|�fg}xIt|�D];}tjjt||��}|jdd ||f�q�W|dj|�dj|�ddjtj|||��S(!u:Return a plain text document describing a given traceback.uPython iu: u	%s
%s
%s
u�
A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.
u?uuin uformatvaluecSsdtjj|�S(Nu=(upydocutexturepr(uvalue((u*/opt/alt/python33/lib64/python3.3/cgitb.pyu<lambda>�sutext.<locals>.<lambda>c
s<d�|d<ztj�|d�SWd|dd7<XdS(Nii(u	linecacheugetline(ulnum(ufileu	highlight(u*/opt/alt/python33/lib64/python3.3/cgitb.pyureader�sutext.<locals>.readeru %s %su%5d iuglobaluglobal ulocalu.u%s = %su
 undefinedu
u
%s
u%s: %su

%s%s = %su iuc

The above is a description of an error in a Python program.  Here is
the original traceback:

%s
Ni����u    (u
isinstanceutypeu__name__usysuversionusplitu
executableutimeuctimeustruinspectugetinnerframesuosupathuabspathugetargvaluesuformatargvaluesuscanvarsuNoneuappendurstripu	__UNDEF__upydocutextureprujoinudirugetattru	tracebackuformat_exception( ueinfoucontextuetypeuevalueuetbupyverudateuheaduframesurecordsuframeulnumufunculinesuindexuargsuvarargsuvarkwulocalsucallureaderuvarsurowsuiulineunumudoneudumpunameuwhereuvalueu	exception((ufileu	highlightu*/opt/alt/python33/lib64/python3.3/cgitb.pyutext�s^"





&utextcBsP|EeZdZdZddddddd�Zdd�Zdd	d
�ZdS(uHooku?A hook to replace sys.excepthook that shows tracebacks in HTML.iiuhtmlcCs:||_||_||_|p'tj|_||_dS(N(udisplayulogdirucontextusysustdoutufileuformat(uselfudisplayulogdirucontextufileuformat((u*/opt/alt/python33/lib64/python3.3/cgitb.pyu__init__s
			u
Hook.__init__cCs|j|||f�dS(N(uhandle(uselfuetypeuevalueuetb((u*/opt/alt/python33/lib64/python3.3/cgitb.pyu__call__su
Hook.__call__c
Cs�|ptj�}|jdkr7|jjt��n|jdkrLtpOt}d}y|||j	�}Wn&dj
tj|��}d}YnX|jr�|r�|jdd�jdd�}|jjd|d�q|jj|d	�n|jjd
�|jdk	r�ddg|jdk}tjd
|d|j�\}}y7tj|d�}|j|�|j�d|}	Wnd|}	YnX|jdkr�|jjd|	�q�|jj|	d	�ny|jj�WnYnXdS(Nuhtmluu&u&amp;u<u&lt;u<pre>u</pre>
u
u*<p>A problem occurred in a Python script.
u.txtu.htmlusuffixudiruwu*%s contains the description of this error.u*Tried to save traceback to %s, but failed.u
<p>%s</p>
FT(usysuexc_infouformatufileuwriteuresetuhtmlutextuFalseucontextujoinu	tracebackuformat_exceptionuTrueudisplayureplaceulogdiruNoneutempfileumkstempuosufdopenucloseuflush(
uselfuinfou	formatteruplainudocusuffixufdupathufileumsg((u*/opt/alt/python33/lib64/python3.3/cgitb.pyuhandlesB	!

uHook.handleN(u__name__u
__module__u__qualname__u__doc__uNoneu__init__u__call__uhandle(u
__locals__((u*/opt/alt/python33/lib64/python3.3/cgitb.pyuHooks
uHookic	Cs(td|d|d|d|�t_dS(uInstall an exception handler that formats tracebacks as HTML.

    The optional argument 'display' can be set to 0 to suppress sending the
    traceback to the browser, and 'logdir' can be set to a directory to cause
    tracebacks to be written to files there.udisplayulogdirucontextuformatN(uHookusysu
excepthook(udisplayulogdirucontextuformat((u*/opt/alt/python33/lib64/python3.3/cgitb.pyuenable9suenable(u__doc__uinspectukeywordu	linecacheuosupydocusysutempfileutimeutokenizeu	tracebackuresetu	__UNDEF__usmallustrongugreyulookupuscanvarsuhtmlutextuHookuhandleuhandleruNoneuenable(((u*/opt/alt/python33/lib64/python3.3/cgitb.pyu<module>s,
ZA8

?>