o
    Qe  ã                   @   sB   d Z ddlZddlZddlZddlZg Ze de¡ ddd„ZdS )z,
decorator to deprecate a function or class
é    NÚdefaultÚ c                    s   ‡ ‡‡‡fdd„}|S )aø  Decorate a function to signify its deprecation.

       This function wraps a method that will soon be removed and does two things:
           - The docstring of the API will be modified to include a notice
             about deprecation."
           - Raises a :class:`~exceptions.DeprecatedWarning` when old API is called.

       Args:
            since(str, optional): The version at which the decorated method is considered deprecated.
            update_to(str, optional): The new API users should use.
            reason(str, optional): The reason why the API is deprecated.
            level(int, optional): The deprecated warning log level. It must be 
                an Integer and must be one of 0, 1, 2. 
                If `level == 0`, the warning message will not be showed. 
                If `level == 1`, the warning message will be showed normally.
                If `level == 2`, it will raise `RuntimeError`.
           
       Returns:
           decorator: decorated function or class.
    c                    s   ˆS )N)Ú
isinstanceÚstrÚintÚformatÚstripÚ
__module__Ú__name__ÚlenÚ
startswithÚ__doc__Ú	functoolsÚwraps)ÚfuncZ
_update_toÚ_reasonÚwrapper©ÚlevelÚreasonÚsinceÚ	update_to)Z_sincer   ÚmsgúGD:\Projects\ConvertPro\env\Lib\site-packages\paddle/utils/deprecated.pyÚ	decorator8   s   zdeprecated.<locals>.decorator© )r   r   r   r   r   r   r   r   Ú
deprecated"   s   @r   )r   r   r   r   )	r   Úwarningsr   ZpaddleÚsysÚ__all__ÚsimplefilterÚDeprecationWarningr   r   r   r   r   Ú<module>   s   