ó
’›V]c           @   sY  d  d l  Z  d  d l Z d  d l m Z d  d l m Z m Z m Z e a	 d „  Z
 yK e  j d k rn e ‚ n/ d  d l m Z m Z d  d l m Z d „  Z
 Wn' e k
 rÇ d	 e f d
 „  ƒ  YZ n Xe ƒ  Z e ƒ  Z e ƒ  Z e Z e Z e Z d Z d a e j ƒ  a d „  Z d „  Z e d d „ ƒ Z d „  Z d „  Z  d „  Z! d „  Z" d S(   iÿÿÿÿN(   t   contextmanager(   t   encodingt   is_py3t   uc           C   s   d S(   s”   
    Lazily init colorama if necessary, not to screw up stdout if debugging is
    not enabled.

    This version of the function does nothing.
    N(    (    (    (    s)   lib/python2.7/site-packages/jedi/debug.pyt   _lazy_colorama_init
   t    t   nt(   t   Foret   init(   t
   initialisec           C   sA   t  s7 t t _ y t d t ƒ Wq7 t k
 r3 q7 Xn  t a  d S(   s³   
            Lazily init colorama if necessary, not to screw up stdout is
            debug not enabled.

            This version of the function does init colorama.
            t   stripN(   t   _initedt   TrueR	   t   atexit_doneR   t   Falset	   Exception(    (    (    s)   lib/python2.7/site-packages/jedi/debug.pyR      s    	R   c           B   s,   e  Z d  Z d  Z d  Z d  Z d  Z d  Z RS(   R   (   t   __name__t
   __module__t   REDt   GREENt   YELLOWt   MAGENTAt   RESETt   BLUE(    (    (    s)   lib/python2.7/site-packages/jedi/debug.pyR   2   s   i    c           C   s   t  j  ƒ  a d a d  S(   Ni    (   t   timet   _start_timet   _debug_indent(    (    (    s)   lib/python2.7/site-packages/jedi/debug.pyt
   reset_timeH   s    c            s   ‡  f d †  } | S(   s   Decorator for makin c             s!   t  ƒ   ˆ  |  | Ž  SWd  QXd  S(   N(   t   increase_indent_cm(   t   argst   kwargs(   t   func(    s)   lib/python2.7/site-packages/jedi/debug.pyt   wrapperP   s    
(    (   R   R    (    (   R   s)   lib/python2.7/site-packages/jedi/debug.pyt   increase_indentN   s    c         c   s_   |  r t  d |  d d ƒn  t d 7a z	 d  VWd  t d 8a |  rZ t  d |  d d ƒn  Xd  S(   Ns   Start: t   colorR   i   s   End: (   t   dbgR   (   t   title(    (    s)   lib/python2.7/site-packages/jedi/debug.pyR   V   s    
	
c         O   sk   | j  d d ƒ } | s t ‚ t rg t rg d t } t ƒ  t | | d |  t d „  | Dƒ ƒ ƒ n  d S(   sB    Looks at the stack, to see if a debug message should be printed. R"   R   t    s   dbg: c         s   s!   |  ] } t  t | ƒ ƒ Vq d  S(   N(   R   t   repr(   t   .0t   a(    (    s)   lib/python2.7/site-packages/jedi/debug.pys	   <genexpr>m   s    N(   t   popt   AssertionErrort   debug_functiont   enable_noticeR   R   t   tuple(   t   messageR   R   R"   t   i(    (    s)   lib/python2.7/site-packages/jedi/debug.pyR#   d   s    
c         O   st   | j  d t ƒ } | s t ‚ t rp t rp d t } | rX |  t d „  | Dƒ ƒ }  n  t d | d |  ƒ n  d  S(   Nt   formatR%   c         s   s!   |  ] } t  t | ƒ ƒ Vq d  S(   N(   R   R&   (   R'   R(   (    (    s)   lib/python2.7/site-packages/jedi/debug.pys	   <genexpr>w   s    R   s	   warning: (   R)   R   R*   R+   t   enable_warningR   R-   (   R.   R   R   R0   R/   (    (    s)   lib/python2.7/site-packages/jedi/debug.pyt   warningp   s    
c         C   sL   t  rH t rH t j ƒ  } d t } t  d | d d |  | t f ƒ n  d  S(   NR%   R   s   speed: s   %s %s(   R+   t   enable_speedR   R   R   (   t   namet   nowR/   (    (    s)   lib/python2.7/site-packages/jedi/debug.pyt   speed{   s    
c         C   sE   t  t |  ƒ } t ƒ  t s1 | j t d ƒ } n  | | t j GHd S(   sŒ   
    The default debug function that prints to standard out.

    :param str color: A string that is an attribute of ``colorama.Fore``.
    t   replaceN(   t   getattrR   R   R   t   encodeR   R   (   R"   t   str_outt   col(    (    s)   lib/python2.7/site-packages/jedi/debug.pyt   print_to_stdout‚   s
    (#   t   osR   t
   contextlibR    t   jedi._compatibilityR   R   R   R   R   R   R4   t   ImportErrort   coloramaR   R   R	   t   objectt   NOTICEt   WARNINGt   SPEEDR3   R1   R,   t   NoneR+   R   R   R   R!   R   R#   R2   R6   R<   (    (    (    s)   lib/python2.7/site-packages/jedi/debug.pyt   <module>   s<   											