a
    ÷£Be°  ã                   @   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z8e j	dkrLe
‚n$d dlmZmZ d d	lmZ d
d„ ZW n  e
y’   G dd„ dƒZY n0 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   úM/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/jedi/debug.pyÚ_lazy_colorama_init	   s    r   Únt)ÚForeÚinit)Ú
initialisec                   C   s4   t s,dt_ztdd� W n ty*   Y n0 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                     s8   t ƒ � ˆ | i |¤ŽW  d   ƒ S 1 s*0    Y  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   sf   | rt d|  |d� td7 az&d V  W td8 a| rbt d|  |d� ntd8 a| r`t d|  |d� 0 d S )NzStart: ©Úcoloré   zEnd: )Údbgr   )Útitler&   r   r   r   r   U   s    þr   r   r%   c                G   sF   |sJ ‚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 r   ©Úrepr©Ú.0Úar   r   r   Ú	<genexpr>j   ó    zdbg.<locals>.<genexpr>N)r   Ú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 r   r+   r-   r   r   r   r0   q   r1   zwarning.<locals>.<genexpr>r   z	warning: )r   Úenable_warningr   r3   )r4   r6   r   r5   r   r   r   Úwarningm   s
    r8   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Únowr5   r   r   r   Úspeedu   s    r<   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   r:   ÚImportErrorZcoloramar	   r
   r   ÚobjectZNOTICEÚWARNINGZSPEEDr9   r7   r2   r   ÚstrÚ__annotations__r   r   r   r$   r   r(   r8   r<   r@   r   r   r   r   Ú<module>   s<   
	

