a
    2b                     @   s4   d dl Z d dlZG dd deZG dd de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   /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kwargsZ	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   objectr	   r   r   r   r   <module>   s   