a
    ø£Beû  ã                   @   s2   d dl Z d dlZG dd„ deƒZG dd„ dƒZdS )é    Nc                   @   s   e Zd ZdZdS )Újupyterlab_deprecationz`Create our own deprecation class, since Python >= 2.7
    silences deprecations by default.
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   úS/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/jupyterlab/utils.pyr      s   r   c                   @   s"   e Zd ZdZddd„Zdd„ ZdS )	Ú
deprecatedaì  Decorator to mark deprecated functions with warning.
    Adapted from `scikit-image/skimage/_shared/utils.py`.

    Parameters
    ----------
    alt_func : str
        If given, tell user what function to use instead.
    behavior : {'warn', 'raise'}
        Behavior during call to deprecated function: 'warn' = warn user that
        function is deprecated; 'raise' = raise error.
    removed_version : str
        The package version in which the deprecated function will be removed.
    NÚwarnc                 C   s   || _ || _|| _d S )N)Úalt_funcÚbehaviorÚremoved_version)Úselfr   r   r   r   r   r   Ú__init__   s    zdeprecated.__init__c                    sŽ   d}ˆj d urdˆj  }d}ˆjd ur0dˆj }dˆ j | d | ‰t ˆ ¡‡ ‡‡fdd„ƒ}d| }|jd u rz||_n|d	 |j |_|S )
NÚ z Use ``%s`` instead.z" and will be removed in version %szFunction ``%s`` is deprecatedÚ.c                     sX   ˆj dkr8ˆ j}t dt¡ tjˆt|j|jd d� nˆj dkrJtˆƒ‚ˆ | i |¤ŽS )Nr
   Úalwaysé   )ÚcategoryÚfilenameÚlinenoÚraise)r   Ú__code__ÚwarningsÚsimplefilterr   Úwarn_explicitÚco_filenameÚco_firstlineno)ÚargsÚkwargsÚ	func_code©ÚfuncÚmsgr   r   r   Úwrapped.   s    
ü
z$deprecated.__call__.<locals>.wrappedz**Deprecated function**.z

    )r   r   r   Ú	functoolsÚwrapsr   )r   r"   Zalt_msgZrmv_msgr$   Údocr   r!   r   Ú__call__$   s    




zdeprecated.__call__)Nr
   N)r   r   r   r   r   r(   r   r   r   r   r	      s   
r	   )r%   r   ÚWarningr   r	   r   r   r   r   Ú<module>   s   