U
    ‡»|eh  ã                   @   s<   d dl Z d dlZdgZd	dd„ZG dd„ dƒZd
dd„ZdS )é    NÚ_deprecatedé   c                    s   ‡ ‡fdd„}|S )z2Deprecate a function by emitting a warning on use.c                    sJ   t ˆ tƒr$tjd ˆ ¡tdd� ˆ S t ˆ ¡‡ ‡‡fdd„ƒ}ˆ j|_|S )NzTrying to deprecate class {!r}r   ©ÚcategoryÚ
stacklevelc                     s   t jˆtˆd� ˆ | |ŽS )Nr   )ÚwarningsÚwarnÚDeprecationWarning)ÚargsÚkwargs)ÚfunÚmsgr   © úS/var/www/website-v5/atlas_env/lib/python3.8/site-packages/scipy/_lib/deprecation.pyÚcall   s    ÿz'_deprecated.<locals>.wrap.<locals>.call)	Ú
isinstanceÚtyper   r   ÚformatÚRuntimeWarningÚ	functoolsÚwrapsÚ__doc__)r   r   ©r   r   )r   r   Úwrap	   s    
 þz_deprecated.<locals>.wrapr   )r   r   r   r   r   r   r      s    c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	Ú_DeprecationHelperStrz3
    Helper class used by deprecate_cython_api
    c                 C   s   || _ || _d S ©N)Ú_contentÚ_message)ÚselfÚcontentÚmessager   r   r   Ú__init__   s    z_DeprecationHelperStr.__init__c                 C   s
   t | jƒS r   )Úhashr   )r   r   r   r   Ú__hash__#   s    z_DeprecationHelperStr.__hash__c                 C   s$   | j |k}|r tj| jtdd� |S )Nr   r   )r   r   r   r   r	   )r   ÚotherÚresr   r   r   Ú__eq__&   s    

ÿz_DeprecationHelperStr.__eq__N)Ú__name__Ú
__module__Ú__qualname__r   r!   r#   r&   r   r   r   r   r      s   r   c           
      C   s¤   d  | j|¡}|dkr d| }nd||f }|dk	r@|d| 7 }| j}d}d}d  ||¡}	|	|krˆd	}| |	¡|t|	|ƒ< |d
7 }qNqˆqN|s | |¡|t||ƒ< dS )a>  
    Deprecate an exported cdef function in a public Cython API module.

    Only functions can be deprecated; typedefs etc. cannot.

    Parameters
    ----------
    module : module
        Public Cython API module (e.g. scipy.linalg.cython_blas).
    routine_name : str
        Name of the routine to deprecate. May also be a fused-type
        routine (in which case its all specializations are deprecated).
    new_name : str
        New name to include in the deprecation warning message
    message : str
        Additional text in the deprecation warning message

    Examples
    --------
    Usually, this function would be used in the top-level of the
    module ``.pyx`` file:

    >>> from scipy._lib.deprecation import deprecate_cython_api
    >>> import scipy.linalg.cython_blas as mod
    >>> deprecate_cython_api(mod, "dgemm", "dgemm_new",
    ...                      message="Deprecated in Scipy 1.5.0")
    >>> del deprecate_cython_api, mod

    After this, Cython modules that use the deprecated function emit a
    deprecation warning when they are imported.

    z{}.{}Nz`%s` is deprecated!z%`%s` is deprecated, use `%s` instead!Ú
r   Fz__pyx_fuse_{}{}Té   )r   r'   Ú__pyx_capi__Úpopr   )
ÚmoduleZroutine_nameÚnew_namer    Úold_nameÚdepdocÚdÚjZ	has_fusedZ
fused_namer   r   r   Údeprecate_cython_api.   s&    !
ÿ
r4   )r   )NN)r   r   Ú__all__r   r   r4   r   r   r   r   Ú<module>   s
   
