B
    /d                 @   s*  U d dl Z d dlZd dlmZ d dlmZmZ dadd Zy8e j	dkrLe
n$d dlmZmZ d d	lmZ d
d ZW n" e
k
r   G dd dZY nX e Ze Ze ZdZdZdZdZeeeegdf  ed< d ae add Zdd Zed!ddZddddZddddZdd Z dd  Z!dS )"    N)contextmanager)CallableOptionalFc               C   s   dS )z
    Lazily init colorama if necessary, not to screw up stdout if debugging is
    not enabled.

    This version of the function does nothing.
    N r   r   r   W/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/site-packages/jedi/debug.py_lazy_colorama_init	   s    r   nt)Foreinit)
initialisec               C   s6   t s.dt_ytdd W n tk
r,   Y nX da dS )z
            Lazily init colorama if necessary, not to screw up stdout is
            debug not enabled.

            This version of the function does init colorama.
            TF)stripN)_initedr   Zatexit_doner
   	Exceptionr   r   r   r   r      s    c               @   s$   e Zd ZdZdZdZdZdZdZdS )r	    N)	__name__
__module____qualname__REDGREENYELLOWMAGENTARESETZBLUEr   r   r   r   r	   1   s   r	   debug_functionc               C   s   t   adad S )Nr   )time_start_time_debug_indentr   r   r   r   
reset_timeG   s    r   c                s    fdd}|S )zDecorator for makin c           	      s   t    | |S Q R X d S )N)increase_indent_cm)argskwargs)funcr   r   wrapperO   s    z increase_indent.<locals>.wrapperr   )r    r!   r   )r    r   increase_indentM   s    r"   r   c          
   c   sJ   | rt d|  |d td7 az
d V  W d td8 a| rDt d|  |d X d S )NzStart: )color   zEnd: )dbgr   )titler#   r   r   r   r   U   s    
r   r   )r#   c            G   sF   |st trBtrBdt }t  t||d | tdd |D    dS )zB Looks at the stack, to see if a debug message should be printed.  zdbg: c             s   s   | ]}t |V  qd S )N)repr).0ar   r   r   	<genexpr>j   s    zdbg.<locals>.<genexpr>N)AssertionErrorr   enable_noticer   r   tuple)messager#   r   ir   r   r   r%   c   s
    r%   T)formatc            G   s@   t r<tr<dt }|r*| tdd |D  } t d|d |   d S )Nr'   c             s   s   | ]}t |V  qd S )N)r(   )r)   r*   r   r   r   r+   q   s    zwarning.<locals>.<genexpr>r   z	warning: )r   enable_warningr   r.   )r/   r1   r   r0   r   r   r   warningm   s
    r3   c             C   s:   t r6tr6t }dt }t d|d d| |t f   d S )Nr'   r   zspeed: z%s %s)r   enable_speedr   r   r   )namenowr0   r   r   r   speedu   s    r7   c             C   s&   t t| }t  t|| tj  dS )z
    The default debug function that prints to standard out.

    :param str color: A string that is an attribute of ``colorama.Fore``.
    N)getattrr	   r   printr   )r#   Zstr_outcolr   r   r   print_to_stdout|   s    
r;   )Nr   )"osr   
contextlibr   typingr   r   r   r   r5   ImportErrorZcoloramar	   r
   r   objectZNOTICEWARNINGZSPEEDr4   r2   r-   r   str__annotations__r   r   r   r"   r   r%   r3   r7   r;   r   r   r   r   <module>   s>    	

