File: //proc/3/root/lib64/python2.7/cgitb.pyo
�
zfc           @   s  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d �  Z g  Z
 d �  Z d �  Z d �  Z d �  Z d �  Z d	 d
 � Z d	 d � Z d d d
 �  �  YZ e �  j Z d d d	 d d � Z d S(   s�  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.
i����Nc           C   s   d S(   sA   Return a string that resets the CGI and browser to a known state.s'  <!--: 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>(    (    (    (    s   /usr/lib64/python2.7/cgitb.pyt   reset$   s    c         C   s   |  r d |  d Sd Sd  S(   Ns   <small>s   </small>t    (    (   t   text(    (    s   /usr/lib64/python2.7/cgitb.pyt   small/   s    c         C   s   |  r d |  d Sd Sd  S(   Ns   <strong>s	   </strong>R   (    (   R   (    (    s   /usr/lib64/python2.7/cgitb.pyt   strong5   s    c         C   s   |  r d |  d Sd Sd  S(   Ns   <font color="#909090">s   </font>R   (    (   R   (    (    s   /usr/lib64/python2.7/cgitb.pyt   grey;   s    c         C   s�   |  | k r d | |  f S|  | j  k r: d | j  |  f Sd | j  k r� | j  d } t | � t i  � k r� |  | k r� d | |  f Sq� t | |  � r� d t | |  � f Sn  d t f S(   s9   Find the value for a given name in the given environment.t   localt   globalt   __builtins__t   builtinN(   t	   f_globalst   typet   hasattrt   getattrt   Nonet	   __UNDEF__(   t   namet   framet   localst   builtins(    (    s   /usr/lib64/python2.7/cgitb.pyt   lookupA   s    
c         C   s2  g  d d d t f \ } } } } } xt j |  � D]� \ } }	 }
 } } | t j k r\ Pn  | t j k r� |	 t j k r� | d k r� | t k	 r� t | |	 t � } | j	 | |	 | | f � q� q$t
 |	 | | � \ }
 } | j	 |	 |
 | f � n/ |	 d k r| | d 7} | } n d \ } } |	 } q4 W| S(   sE   Scan one logical line of Python and look up values of variables used.R   t   .N(   NR   (   R   R   t   tokenizet   generate_tokenst   NEWLINEt   NAMEt   keywordt   kwlistR
   t   appendR   (   t   readerR   R   t   varst	   lasttokent   parentt   prefixt   valuet   ttypet   tokent   startt   endt   linet   where(    (    s   /usr/lib64/python2.7/cgitb.pyt   scanvarsQ   s"