ó
³Ebc           @   s1  d  Z  d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m	 Z	 d d l m
 Z
 d d l m Z d d	 l m Z d d
 l m Z d d l m Z e ƒ  Z e j d ƒ Z e e ƒ Z d Z d Z d „  Z e d „ Z d e f d „  ƒ  YZ e ƒ  Z d „  Z d e f d „  ƒ  YZ d S(   s•  
    werkzeug.debug.repr
    ~~~~~~~~~~~~~~~~~~~

    This module implements object representations for debugging purposes.
    Unlike the default repr these reprs expose a lot more information and
    produce HTML instead of ASCII.

    Together with the CSS and JavaScript files of the debugger this gives
    a colorful and more compact output.

    :copyright: 2007 Pallets
    :license: BSD-3-Clause
iÿÿÿÿN(   t   deque(   t   format_exception_onlyi   (   t   integer_types(   t	   iteritems(   t   PY2(   t   string_types(   t	   text_type(   t   escapes   (?:\r\n|\r|\n){2,}sL   <div class=box>
  <h3>%(title)s</h3>
  <pre class=help>%(text)s</pre>
</div>sQ   <div class=box>
  <h3>%(title)s</h3>
  %(repr)s
  <table>%(items)s</table>
</div>c         C   s   t  ƒ  j |  ƒ S(   s9   Creates a debug repr of an object as HTML unicode string.(   t   DebugReprGeneratort   repr(   t   obj(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt
   debug_repr2   s    c         C   sV   t  ƒ  } |  t k r3 | j t j d ƒ j ƒ } n | j |  ƒ } t j j | ƒ d S(   sd   Print the object details to stdout._write (for the interactive
    console of the web debugger.
    i   N(	   R   t   missingt   dump_localst   syst	   _getframet   f_localst   dump_objectt   stdoutt   _write(   R
   t   gent   rv(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   dump7   s
    	t   _Helperc           B   s#   e  Z d  Z d „  Z d d „ Z RS(   s   Displays an HTML version of the normal help, for the interactive
    debugger only because it requires a patched sys.stdout.
    c         C   s   d S(   Ns(   Type help(object) for help about object.(    (   t   self(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   __repr__H   s    c         C   sí   | d  k r* t j j d t |  ƒ ƒ d  Sd d  l } | j | ƒ t j j ƒ  } t | t	 ƒ rv | j
 d d ƒ } n  t j | ƒ } t | ƒ d k r· | d } d j | d ƒ } n d } | d } t j j t i | d	 6| d
 6ƒ d  S(   Ns   <span class=help>%s</span>iÿÿÿÿs   utf-8t   ignorei   i    s   

t   Helpt   titlet   text(   t   NoneR   R   R   R	   t   pydoct   helpt   resett
   isinstancet   bytest   decodet   _paragraph_ret   splitt   lent   joint	   HELP_HTML(   R   t   topicR   R   t
   paragraphsR   R   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   __call__K   s    

N(   t   __name__t
   __module__t   __doc__R   R   R,   (    (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyR   C   s   	c         C   s‘   t  | t ƒ r9 x= | D] } t | ƒ | k r |  Sq Wn t | ƒ | k rO |  Sd } | j j d k rz d | j j } n  d | | j j |  f S(   Nt    t   __builtin__t
   exceptionss   <span class="module">%s.</span>s   %s%s(%s)(   R1   R2   (   R"   t   tuplet   typet	   __class__R.   R-   (   t   innerR
   t   baset   module(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   _add_subclass_infob   s    R   c           B   sã   e  Z d  „  Z e ƒ  d d „ Z e d d e ƒ Z e d d e ƒ Z e d d e	 ƒ Z
 e d	 d e ƒ Z e d
 d e ƒ Z [ d „  Z d d „ Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z RS(   c         C   s   g  |  _  d  S(   N(   t   _stack(   R   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   __init__p   s    i   c            s   ‡  ‡ ‡ ‡ f d †  } | S(   Nc            sÔ   | r t  ˆ d ˆ | ˆ  ƒ Sˆ g } t } xh t | ƒ D]Z \ } } | r\ | j d ƒ n  | ˆ k r~ | j d ƒ t } n  | j |  j | ƒ ƒ q: W| r® | j d ƒ n  | j ˆ ƒ t  d j | ƒ | ˆ  ƒ S(   Ns   ...s   , s   <span class="extended">s   </span>u    (   R9   t   Falset	   enumeratet   appendt   TrueR	   R(   (   R   R
   t	   recursivet   buft   have_extended_sectiont   idxt   item(   R7   t   leftt   limitt   right(    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   proxyt   s    		(    (   RE   RG   R7   RF   RH   (    (   R7   RE   RF   RG   sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   _sequence_repr_makers   s    t   [t   ]t   (t   )s   set([s   ])s   frozenset([s/   <span class="module">collections.</span>deque([c         C   sr   t  | j ƒ } t r* | j d d ƒ } n t j | d d ƒ } | d  d k r` d | d } n
 d | } d | S(	   Ns   string-escapeR   s   unicode-escapei   t   ut   urt   ru0   re.compile(<span class="string regex">%s</span>)(   R	   t   patternR   R$   t   codecs(   R   R
   RQ   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt
   regex_repr   s    
iF   c         C   sÔ   d g } t  | ƒ } t | ƒ | d k r[ | j t | |  ƒ d t | | ƒ d f ƒ n | j t | ƒ ƒ | j d ƒ d j | ƒ } | d d k sº | d d k rÐ | d	 d k rÐ t | | t t f ƒ S| S(
   Ns   <span class="string">i   s   <span class="extended">s   </span>u    i    s   '"t   ubi   (	   R	   R'   t   extendR   R>   R(   R9   R#   R   (   R   R
   RF   RA   RP   t   out(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   string_reprœ   s    	0i   c   	      C   sï   | r t  d | t ƒ Sd g } t } x‹ t t | ƒ ƒ D]w \ } \ } } | r` | j d ƒ n  | | d k r† | j d ƒ t } n  | j d |  j | ƒ |  j | ƒ f ƒ q8 W| rÉ | j d ƒ n  | j d ƒ t  d	 j | ƒ | t ƒ S(
   Nu   {...}t   {s   , i   s   <span class="extended">sT   <span class="pair"><span class="key">%s</span>: <span class="value">%s</span></span>s   </span>t   }u    (	   R9   t   dictR<   R=   R   R>   R?   R	   R(   (	   R   t   dR@   RF   RA   RB   RC   t   keyt   value(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt	   dict_repr·   s"    	%	$c         C   s5   t  | ƒ } t r' | j d d ƒ } n  d t | ƒ S(   Ns   utf-8t   replaceu   <span class="object">%s</span>(   R	   R   R$   R   (   R   R
   RP   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   object_reprÌ   s    c         C   sN  | t  k r d t  St | t t t f ƒ r4 d | St | t ƒ sR t | t ƒ r_ |  j | ƒ St | t ƒ r{ |  j	 | ƒ St | t
 ƒ rš |  j | | ƒ St | t ƒ r¹ |  j | | ƒ St | t ƒ rØ |  j | | ƒ St | t ƒ r÷ |  j | | ƒ St | t ƒ r|  j | | ƒ St d  k	 rAt | t ƒ rA|  j | | ƒ S|  j | ƒ S(   Nu   <span class="help">%r</span>u   <span class="number">%r</span>(   t   helperR"   R   t   floatt   complexR   R#   RW   t	   RegexTypeRS   t   listt	   list_reprR3   t
   tuple_reprt   sett   set_reprt	   frozensett   frozenset_reprRZ   R^   R    R   t
   deque_reprR`   (   R   R
   R@   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   dispatch_reprÒ   s*    c         C   sl   y# d j  t t j ƒ  d  Œ  ƒ } Wn t k
 r< d } n Xt rX | j d d ƒ } n  d t | j ƒ  ƒ S(   NR0   i   t   ?s   utf-8R   u8   <span class="brokenrepr">&lt;broken repr (%s)&gt;</span>(	   R(   R   R   t   exc_infot	   ExceptionR   R$   R   t   strip(   R   t   info(    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   fallback_repré   s    #
c         C   sˆ   t  } x' |  j D] } | | k r t } Pq q W|  j j | ƒ z3 y |  j | | ƒ SWn t k
 rq |  j ƒ  SXWd  |  j j ƒ  Xd  S(   N(   R<   R:   R?   R>   Rm   Rp   Rs   t   pop(   R   R
   R@   RD   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyR	   ô   s    c         C   s)  d  } } t | t ƒ rz d } g  } xR t | ƒ D]A \ } } t | t ƒ sW d  } Pn  | j | |  j | ƒ f ƒ q2 Wn  | d  k rø g  } |  j | ƒ } xQ t | ƒ D]C } y) | j | |  j t | | ƒ ƒ f ƒ Wq¨ t	 k
 rê q¨ Xq¨ Wd } n  | d t
 j | ƒ d d !7} |  j | | | ƒ S(   Ns   Contents ofs   Details fort    i   iÿÿÿÿ(   R   R"   RZ   R   R   R>   R	   t   dirt   getattrRp   t   objectR   t   render_object_dump(   R   R
   R	   t   itemsR   R\   R]   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyR     s(    
#)	c         C   sD   g  | j  ƒ  D]! \ } } | |  j | ƒ f ^ q } |  j | d ƒ S(   Ns   Local variables in frame(   Rz   R	   Ry   (   R   R[   R\   R]   Rz   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyR     s    4c         C   sŒ   g  } x1 | D]) \ } } | j  d t | ƒ | f ƒ q W| sP | j  d ƒ n  t i t | ƒ d 6| rs d | n d d 6d j | ƒ d 6S(	   Ns&   <tr><th>%s<td><pre class=repr>%s</pre>s   <tr><td><em>Nothing</em>R   s   <pre class=repr>%s</pre>R0   R	   s   
Rz   (   R>   R   t   OBJECT_DUMP_HTMLR(   (   R   Rz   R   R	   t
   html_itemsR\   R]   (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyRy     s    N(   R-   R.   R;   Rx   RI   Re   Rf   R3   Rg   Rh   Ri   Rj   Rk   R    Rl   RS   RW   R^   R`   Rm   Rs   R	   R   R   R   Ry   (    (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyR   o   s&   								(   R/   RR   t   reR   t   collectionsR    t	   tracebackR   t   _compatR   R   R   R   R   t   utilsR   Rx   R   t   compileR%   R4   Rd   R)   R{   R   R   R   Ra   R9   R   (    (    (    sk   /var/www/html/facial-emotion-detection-webapp-main/flask/lib/python2.7/site-packages/werkzeug/debug/repr.pyt   <module>   s,   				