AlkantarClanX12

Your IP : 18.117.12.181


Current Path : /proc/self/root/lib64/python3.6/__pycache__/
Upload File :
Current File : //proc/self/root/lib64/python3.6/__pycache__/cgitb.cpython-36.opt-1.pyc

3


 \�.�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
dd�ZgZdd�Z
dd�Zd	d
�Zdd�Zd
d�Zddd�Zddd�ZGdd�d�Ze�jZddd�ZdS)a�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.

�NcCsdS)zAReturn a string that resets the CGI and browser to a known state.a'<!--: 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>�rrr�/usr/lib64/python3.6/cgitb.py�reset#srcCs|rd|dSdSdS)Nz<small>z</small>�r)�textrrr�small.srcCs|rd|dSdSdS)Nz<strong>z	</strong>rr)rrrr�strong4srcCs|rd|dSdSdS)Nz<font color="#909090">z</font>rr)rrrr�grey:sr	cCs�||krd||fS||jkr,d|j|fSd|jkr~|jd}t|�ti�krf||kr~d||fSnt||�r~dt||�fSdtfS)z9Find the value for a given name in the given environment.�local�global�__builtins__�builtinN)�	f_globals�type�hasattr�getattr�	__UNDEF__)�name�frame�locals�builtinsrrr�lookup@s



rcCs�gdddtf\}}}}}x�tj|�D]�\}}	}
}}|tjkr>P|tjkr�|	tjkr�|dkr�|tk	r�t||	t�}|j||	||f�q�t	|	||�\}
}|j|	|
|f�n"|	dkr�||d7}|}nd\}}|	}q$W|S)zEScan one logical line of Python and look up values of variables used.Nr�.)Nr)
r�tokenize�generate_tokens�NEWLINE�NAME�keyword�kwlistr�appendr)�readerrr�varsZ	lasttoken�parent�prefix�valueZttype�token�start�end�line�whererrr�scanvarsPs"
r*�c"	s�|\}}}t|t�r|j}dtjj�ddtj}tjtj��}dt	j
jdtt	j
j
t|���dd|d|�d	}d
tdd�d
}g}	tj||�}
�xJ|
D�]@\}�}}
}}�r�tjj���d�t	j
j
��f}nd�}tj|�\}}}}d}|
dk�r2dtt	j
j
|
��tj||||dd�d�}i�|gf��fdd�	}t|||�}dd||fg}|dk	�r||}x�|D]�}tddtt|��t|��d}|�k�r�d|t	j
j|�f}|jd|�n&d|t	j
j|�f}|jdt|��|d7}�q~Wig}}x�|D]�\}}} ||k�r0�qd||<| tk	�r�|d-k�r^d!|t|�}n*|d"k�rrt|�}n|t|jd#�d.�}|jd$|t	j
j| �f�n|j|d%��qW|jdttd&j|����|	jd'd(j|��q�Wd)tt	j
j
t|���t	j
j
t|��fg}!xNt|�D]B}|dd�d*k�r:�q t	j
jt ||��} |!jd+||| f��q W|dj|	�dj|!�d,t	j
j
djt!j"|||���S)/z9Return a nice HTML document describing a given traceback.zPython rz: z<body bgcolor="#f0f0f8">z<big><big>%s</big></big>z#ffffffz#6622aaz<br>z�
<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>z<tt>z&nbsp;r+z&nbsp;</tt>z<a href="file://%s">%s</a>�?rzin cSsdtjj|�S)N�=)�pydoc�html�repr)r$rrr�<lambda>�szhtml.<locals>.<lambda>)�formatvaluec
s4d�|d<ztj�|d�S|dd7<XdS)N�r)�	linecache�getline)�lnum)�file�	highlightrrr �szhtml.<locals>.readerz+<tr><td bgcolor="#d8bbff">%s%s %s</td></tr>z<big>&nbsp;</big>Nz<tt>=&gt;%s%s</tt>z&<tr><td bgcolor="#ffccee">%s</td></tr>z<tt>&nbsp;&nbsp;%s%s</tt>z<tr><td>%s</td></tr>r3rr
z<em>%s</em> r
rz%s&nbsp;= %sz <em>undefined</em>z, zF
<table width="100%%" cellspacing=0 cellpadding=0 border=0>
%s</table>�
z	<p>%s: %s�_z
<br>%s%s&nbsp;=
%sz�


<!-- 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
-->
)rr
���)#�
isinstancer�__name__�sys�version�split�
executable�time�ctimer.r/Zheadingr�escape�strr�inspect�getinnerframes�os�path�abspath�getargvalues�formatargvaluesr*�lenZ	preformatrr	rr0�join�dirr�	traceback�format_exception)"�einfo�context�etype�evalue�etb�pyver�date�head�indent�frames�recordsrr6�func�lines�index�link�args�varargs�varkwr�callr r!�rows�ir(�num�done�dumprr)r$�	exceptionr)r7r8rr/es|

0


$






	r/c 	s�|\}}}t|t�r|j}dtjj�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�}i�|gf��fdd
�	}t||
|�}d�|fg}|dk	�rL||}x0|
D](}d|}|j||j��|d7}�q Wig}}x�|D]�\}}}||k�rt�q\d||<|tk	�r�|dk�r�d|}n|dk�r�||jd�d}|jd|tjj|�f�n|j|d��q\W|jdj|��|jddj|��qrWdt	|�t	|�fg}x8t|�D],}tjjt||��}|jdd ||f��q.W|dj|�dj|�ddjtj|||��S)!z:Return a plain text document describing a given traceback.zPython rz: z	%s
%s
%s
z�
A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.
r,rzin cSsdtjj|�S)Nr-)r.rr0)r$rrrr1�sztext.<locals>.<lambda>)r2c
s4d�|d<ztj�|d�S|dd7<XdS)Nr3r)r4r5)r6)r7r8rrr �sztext.<locals>.readerz %s %sNz%5d r3rzglobal r
rz%s = %sz
 undefinedr9z
%s
z%s: %sz

%s%s = %s� �zc

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

%s
r;z    )r<rr=r>r?r@rArBrCrErFrGrHrIrJrKrLr*r�rstriprr.rr0rNrOrrPrQ) rRrSrTrUrVrWrXrYr[r\rr6r]r^r_rarbrcrrdr r!rerfr(rgrhrirr)r$rjr)r7r8rr�s^









rc@s,eZdZdZddd�Zdd	�Zd
d
d�ZdS)�Hookz?A hook to replace sys.excepthook that shows tracebacks in HTML.r3Nr+r/cCs(||_||_||_|ptj|_||_dS)N)�display�logdirrSr>�stdoutr7�format)�selfrorprSr7rrrrr�__init__s
z
Hook.__init__cCs|j|||f�dS)N)�handle)rsrTrUrVrrr�__call__sz
Hook.__call__c
Csz|p
tj�}|jdkr$|jjt��|jdkr2tp4t}d}y|||j�}Wn dj	t
j|��}d}YnX|jr�|r�t
jj|�}|jjd|d�q�|jj|d�n|jjd�|jdk	�rZd	d
g|jdk}tj||jd�\}}y.tj|d��}|j|�WdQRXd
|}	Wnd|}	YnX|jdk�rJ|jjd|	�n|jj|	d�y|jj�WnYnXdS)Nr/FrTz<pre>z</pre>
r9z*<p>A problem occurred in a Python script.
z.txtz.html)�suffixrO�wz*%s contains the description of this error.z*Tried to save traceback to %s, but failed.z
<p>%s</p>
)r>�exc_inforrr7�writerr/rrSrNrPrQror.rDrp�tempfileZmkstemprH�fdopen�flush)
rs�infoZ	formatterZplain�docrw�fdrIr7�msgrrrrus@

zHook.handle)r3Nr+Nr/)N)r=�
__module__�__qualname__�__doc__rtrvrurrrrrns

rnr3cCst||||d�t_dS)aInstall 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.)rorprSrrN)rnr>�
excepthook)rorprSrrrrr�enable8sr�)r+)r+)r3Nr+r/)r�rFrr4rHr.r>r{rBrrPrrrrr	rr*r/rrnruZhandlerr�rrrr�<module>s,

Z
A7