
    %`i                         d dl Z d dlZd dlmZmZ d dlmZ d dlmZ  ej	        e
          ZdZ	 dddddded	ee         d
ee         deeeef                  deddfdZdddddZdS )    N)OptionalUnion)log_once)_mark_annotated   )helperror
stackleveloldnewr	   r
   r   returnc                >   d                     | |rd                     |          n|rd| nd          }|rDt          |t                    s t          |t                    r ||          t          |          t                              d|z   dz   |           dS )	a'  Warns (via the `logger` object) or throws a deprecation warning/error.

    Args:
        old: A description of the "thing" that is to be deprecated.
        new: A description of the new "thing" that replaces it.
        help: An optional help text to tell the user, what to
            do instead of using `old`.
        error: Whether or which exception to raise. If True, raise ValueError.
            If False, just warn. If `error` is-a subclass of Exception,
            raise that Exception.
        stacklevel: The stacklevel to use for the warning message.
            Use 2 to point to where this function is called, 3+ to point
            further up the stack.

    Raises:
        ValueError: If `error=True`.
        Exception: Of type `error`, iff `error` is a sub-class of `Exception`.
    z`{}` has been deprecated.{}z Use `{}` instead.  zDeprecationWarning: z( This will raise an error in the future!)r   N)format
isinstancebool
issubclass	Exception
ValueErrorloggerwarning)r   r   r	   r
   r   msgs         k/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/_common/deprecation.pydeprecation_warningr      s    4 (
.
.#U"))#...;U:t:::SU C  
%&& 	":eY+G+G 	"%** S//!"S(+UU! 	 	
 	
 	
 	
 	
    )r   r	   c                      fd}|S )a  Decorator for documenting a deprecated class, method, or function.

    Automatically adds a `deprecation.deprecation_warning(old=...,
    error=False)` to not break existing code at this point to the decorated
    class' constructor, method, or function.

    In a next major release, this warning should then be made an error
    (by setting error=True), which means at this point that the
    class/method/function is no longer supported, but will still inform
    the user about the deprecation event.

    In a further major release, the class, method, function should be erased
    entirely from the codebase.


    .. testcode::
        :skipif: True

        from ray._common.deprecation import Deprecated
        # Deprecated class: Patches the constructor to warn if the class is
        # used.
        @Deprecated(new="NewAndMuchCoolerClass", error=False)
        class OldAndUncoolClass:
            ...

        # Deprecated class method: Patches the method to warn if called.
        class StillCoolClass:
            ...
            @Deprecated(new="StillCoolClass.new_and_much_cooler_method()",
                        error=False)
            def old_and_uncool_method(self, uncool_arg):
                ...

        # Deprecated function: Patches the function to warn if called.
        @Deprecated(new="new_and_much_cooler_function", error=False)
        def old_and_uncool_function(*uncool_args):
            ...
    c                      t          j                   r) j         fd}| _        t                       S  fd}|S )Nc                  v    t          pj                  rt          pj        d            | i |S N   )r   r   r	   r
   r   r   __name__r   )argskwargsr
   r	   r   objobj_initr   s     r   patched_initz0Deprecated.<locals>._inner.<locals>.patched_initj   s^    C/3<00 '/3<!##$     x0000r   c                  v    t          pj                  rt          pj        d            | i |S r!   r#   )r%   r&   r
   r	   r   r'   r   s     r   _ctorz)Deprecated.<locals>._inner.<locals>._ctor}   s^    +s|,, #+s|     3''''r   )inspectisclass__init__r   )r'   r)   r+   r(   r
   r	   r   r   s   `  @r   _innerzDeprecated.<locals>._innerd   s    ?3 	|H	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 (CLC    J
	( 
	( 
	( 
	( 
	( 
	( 
	( 
	( 
	( r    )r   r   r	   r
   r/   s   ```` r   
Deprecatedr1   <   s7    P& & & & & & & &R Mr   )N)r,   loggingtypingr   r   ray.utilr   ray.util.annotationsr   	getLoggerr$   r   DEPRECATED_VALUEstrr   r   intr   r1   r0   r   r   <module>r:      s#     " " " " " " " "       0 0 0 0 0 0		8	$	$
  
 )
 .2)
 )
 )
	)
	#)
 3-	)

 E$	/*+)
 )
 
)
 )
 )
 )
XQ4 Q Q Q Q Q Q Qr   