B YI~d�.�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z dd�Z gZ dd�Z dd�Z dd �Zd d �Zd d �Zddd�Zddd�ZGdd�d�Ze�jZddd�ZdS)�NcCsdS)Na'<!--: 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�*/opt/alt/python37/lib64/python3.7/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)N�local�global� __builtins__�builtin)� f_globals�type�hasattr�getattr� __UNDEF__)�name�frame�locals�builtinsrrr�lookup@s     rcCs�gdddtf\}}}}}x�t�|�D]�\}} } } } |tjkr>P|tjkr�| tjkr�|dkr�|tk r�t|| t�}|�|| ||f�q�t | ||�\} }|�| | |f�n"| dkr�||d7}|}nd\}}| }q$W|S)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}dtj��ddtj}t�t���}dt j � dt t j � t|���dd|d|�d }d td �d }g} t�||�} �xJ| D�]@\} �} } }}�r�tj����d �t j � ��f}nd�}t�| �\}}}}d}| dk�r.dt t j � | ��tj||||dd�d�}i�| gf��fdd� }t|| |�}dd||fg}|dk �r| |}x�|D]�}tddtt|��t|��d}|�k�r�d|t j �|�f}|�d|�n&d|t j �|�f}|�dt|��|d7}�qzWig}}x�|D]�\}}} ||k�r,�qd||<| tk �r�|dk�rZd |t |�}n*|d!k�rnt |�}n|t |�d"�d#�}|�d$|t j �| �f�n|�|d%��qW|�dttd&�|����| �d'd(�|��q�Wd)t t j � t|���t j � t|��fg}!xNt|�D]B}|dd�d*k�r6�qt j �t ||��} |!�d+||| f��qW|d�| �d�|!�d,t j � d�t!�"|||���S)-NzPython 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;&nbsp;&nbsp;&nbsp;&nbsp;z &nbsp;</tt>z<a href="file://%s">%s</a>�?rzin cSsdtj�|�S)N�=)�pydoc�html�repr)r$rrr�<lambda>��zhtml.<locals>.<lambda>)� formatvaluec s4d�|d<zt��|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>z&nbsp;r+z<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>r4)r r z <em>%s</em> r r���z %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 --> )#� isinstancer�__name__�sys�version�split� executable�time�ctimer.r/�headingr�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�recordsrr7�func�lines�index�link�args�varargs�varkwr�callr r!�rows�ir(�num�done�dumprr)r$� exceptionr)r8r9rr/es|  0       $        r/c s�|\}}}t|t�r|j}dtj��ddtj}t�t���}dt |�||fd}g}t � ||�} �x�| D�]�\} �} } } }�r�t j ���p�d�t �| �\}}}}d}| dkr�d| t j||||d d �d �}i�| gf��fd d � }t|| |�}d�|fg}|dk �rL| |}x0| D](}d|}|�||���|d7}�q Wig}}x�|D]�\}}}||k�rt�q\d||<|tk �r�|dk�r�d|}n|dk�r�||�d�d}|�d|tj�|�f�n|�|d��q\W|�d�|��|�dd�|��qrWdt |�t |�fg}x8t|�D],}tj�t||��}|�dd||f��q.W|d�|�d�|�dd�t�|||��S)NzPython 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 cSsdtj�|�S)Nr-)r.rr0)r$rrrr1�r2ztext.<locals>.<lambda>)r3c s4d�|d<zt��|d�S|dd7<XdS)Nr4r)r5r6)r7)r8r9rrr �s ztext.<locals>.readerz %s %sz%5d r4r zglobal r rr:z%s = %sz undefinedr;z %s z%s: %sz %s%s = %sz zc The above is a description of an error in a Python program. Here is the original traceback: %s )r=rr>r?r@rArBrCrDrGrHrIrJrKrLrMrNr*r�rstriprr.rr0rPrQrrRrS) rTrUrVrWrXrYrZr[r]r^rr7r_r`rarcrdrerrfr r!rgrhr(rirjrkrr)r$rlr)r8r9rr�s^            rc@s(eZdZd dd�Zdd�Zd d d �ZdS) �Hookr4Nr+r/cCs(||_||_||_|ptj|_||_dS)N)�display�logdirrUr?�stdoutr8�format)�selfrorprUr8rrrrr�__init__s  z Hook.__init__cCs|�|||f�dS)N)�handle)rsrVrWrXrrr�__call__ sz Hook.__call__c Csz|p t��}|jdkr$|j�t��|jdkr2tp4t}d}y|||j�}Wn d� t j |��}d}YnX|j r�|r�t j�|�}|j�d|d�q�|j�|d�n |j�d�|jdk �rZd d g|jdk}tj||jd �\}}y.t�|d ��}|�|�WdQRXd |} Wnd|} YnX|jdk�rJ|j�d| �n|j�| d�y|j��Wn YnXdS)Nr/FrTz<pre>z</pre> r;z*<p>A problem occurred in a Python script. z.txtz.html)�suffixrQ�wz*%s contains the description of this error.z*Tried to save traceback to %s, but failed.z <p>%s</p> )r?�exc_inforrr8�writerr/rrUrPrRrSror.rFrp�tempfileZmkstemprJ�fdopen�flush) rs�info� formatterZplain�docrw�fdrKr8�msgrrrrus@        z Hook.handle)r4Nr+Nr/)N)r>� __module__� __qualname__rtrvrurrrrrns rnr4cCst||||d�t_dS)N)rorprUrr)rnr?� excepthook)rorprUrrrrr�enable8sr�)r+)r+)r4Nr+r/)rHrr5rJr.r?r{rCrrRrrrrr rr*r/rrnruZhandlerr�rrrr�<module>s*  Z A7