o
    Xi	                  
   @   sv   d Z ddlZddlZddlZddlmZmZ edZejddde	fdd	Z
d
e	de	de	deegef fddZdS )zUtility for deprecating APIs.    N)CallableTypeVarTi   )maxsizemessagec                 C   s   t j| tdd dS )z,Issue a FutureWarning only once per message.   )category
stacklevelN)warningswarnFutureWarning)r    r   T/home/ubuntu/.local/lib/python3.10/site-packages/onnxscript/_internal/deprecation.py
_warn_once   s   r   since
removed_ininstructionsreturnc                    s    fdd}|S )a  Marks functions as deprecated.

    It will result in a warning when the function is called and a note in the
    docstring.

    Args:
        since: The version when the function was first deprecated.
        removed_in: The version when the function will be removed.
        instructions: The action users should take.

    Returns:
        A decorator that can be used to mark functions as deprecated.
    c              	      s   t   fdd} jpd}td d d d}|dd	}t|d	kr>|\}}t|}|d||g}n	|d
 }|d|g}d||_|S )Nc                     s:   t d j d j d d d d  | i |S )N'.z' is deprecated in version z and will be removed in z	. Please )r   
__module____qualname__)argskwargs)functionr   r   r   r   r   wrapper%   s   z.deprecated.<locals>.decorator.<locals>.wrapper z            .. deprecated:: z;
                Deprecated and will be removed in version z.
                Please z.
            z

   r   )	functoolswraps__doc__textwrapdedentsplitlenjoin)r   r   	docstringdeprecation_notesummary_and_bodysummarybodynew_docstring_partsr   r   r   )r   r   	decorator$   s*   
		

zdeprecated.<locals>.decoratorr   )r   r   r   r-   r   r,   r   
deprecated   s   *r.   )r    r   r!   r
   typingr   r   r   	lru_cachestrr   r.   r   r   r   r   <module>   s   
(