
    &`i                     R    d dl mZ d dlmZ d Zd Zd Zd Zd Zd Z	d	 Z
d
 ZeZdS )    )
Deprecated_mark_annotatedc                 4      G  fdd           fd}|S )a  Decorator for documenting method overrides.

    Args:
        parent_cls: The superclass that provides the overridden method. If
            `parent_class` does not actually have the method or the class, in which
            method is defined is not a subclass of `parent_class`, an error is raised.

    .. testcode::
        :skipif: True

        from ray.rllib.policy import Policy
        class TorchPolicy(Policy):
            ...
            # Indicates that `TorchPolicy.loss()` overrides the parent
            # Policy class' own `loss method. Leads to an error if Policy
            # does not have a `loss` method.

            @override(Policy)
            def loss(self, model, action_dist, train_batch):
                ...

    c                        e Zd Zd Z fdZdS )override.<locals>.OverrideCheckc                 "    || _         || _        d S )N)funcexpected_parent_cls)selfr
   r   s      o/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/rllib/utils/annotations.py__init__z(override.<locals>.OverrideCheck.__init__   s    DI':D$$$    c                     t          || j                  s t          d|j         dj         d          t	          ||| j                   d S )N$When using the @override decorator, z must be a subclass of !)
issubclassr   	TypeError__name__setattrr
   )r   ownername
parent_clss      r   __set_name__z,override.<locals>.OverrideCheck.__set_name__"   sn    eT%=>> :5> : :#-#6: : :  
 E4+++++r   N)r   
__module____qualname__r   r   )r   s   r   OverrideCheckr      s=        	; 	; 	;	, 	, 	, 	, 	, 	, 	,r   r   c                     | j         t                    vr t          d| j          dj          d           |            | S )Nr   z= must override the respective method (with the same name) of r   )r   dir	NameError)methodr   r   s    r   	decoratorzoverride.<locals>.decorator,   so    ?#j//11Xv X XAKATX X X   	fj)))r    )r   r"   r   s   ` @r   overrider$      s\    0, , , , , , , , , ,
 
 
 
 
 
 r   c                 $    t          |            | S )a  Decorator for documenting public APIs.

    Public APIs are classes and methods exposed to end users of RLlib. You
    can expect these APIs to remain stable across RLlib releases.

    Subclasses that inherit from a ``@PublicAPI`` base class can be
    assumed part of the RLlib public API as well (e.g., all Algorithm classes
    are in public API because Algorithm is ``@PublicAPI``).

    In addition, you can assume all algo configurations are part of their
    public API as well.

    .. testcode::
        :skipif: True

        # Indicates that the `Algorithm` class is exposed to end users
        # of RLlib and will remain stable across RLlib releases.
        from ray import tune
        @PublicAPI
        class Algorithm(tune.Trainable):
            ...
    r   objs    r   	PublicAPIr(   ;   s    0 CJr   c                 $    t          |            | S )a  Decorator for documenting developer APIs.

    Developer APIs are classes and methods explicitly exposed to developers
    for the purposes of building custom algorithms or advanced training
    strategies on top of RLlib internals. You can generally expect these APIs
    to be stable sans minor changes (but less stable than public APIs).

    Subclasses that inherit from a ``@DeveloperAPI`` base class can be
    assumed part of the RLlib developer API as well.

    .. testcode::
        :skipif: True

        # Indicates that the `TorchPolicy` class is exposed to end users
        # of RLlib and will remain (relatively) stable across RLlib
        # releases.
        from ray.rllib.policy import Policy
        @DeveloperAPI
        class TorchPolicy(Policy):
            ...
    r   r&   s    r   DeveloperAPIr*   W   s    . CJr   c                 $    t          |            | S )a/  Decorator for documenting experimental APIs.

    Experimental APIs are classes and methods that are in development and may
    change at any time in their development process. You should not expect
    these APIs to be stable until their tag is changed to `DeveloperAPI` or
    `PublicAPI`.

    Subclasses that inherit from a ``@ExperimentalAPI`` base class can be
    assumed experimental as well.

    .. testcode::
        :skipif: True

        from ray.rllib.policy import Policy
        class TorchPolicy(Policy):
            ...
            # Indicates that the `TorchPolicy.loss` method is a new and
            # experimental API and may change frequently in future
            # releases.
            @ExperimentalAPI
            def loss(self, model, action_dist, train_batch):
                ...
    r   r&   s    r   ExperimentalAPIr,   r   s    2 CJr   c                 $    t          |            | S )zDecorator for classes/methods/functions belonging to the old API stack.

    These should be deprecated at some point after Ray 3.0 (RLlib GA).
    It is recommended for users to start exploring (and coding against) the new API
    stack instead.
    r   r&   s    r   OldAPIStackr.      s     CJr   c                     d| _         | S )a  Users should override this in their sub-classes to implement custom logic.

    Used in Algorithm and Policy to tag methods that need overriding, e.g.
    `Policy.loss()`.

    .. testcode::
        :skipif: True

        from ray.rllib.policy.torch_policy import TorchPolicy
        @overrides(TorchPolicy)
        @OverrideToImplementCustomLogic
        def loss(self, ...):
            # implement custom loss function here ...
            # ... w/o calling the corresponding `super().loss()` method.
            ...

    F__is_overridden__r&   s    r   OverrideToImplementCustomLogicr2      s    $ "CJr   c                     d| _         | S )a  Users should override this in their sub-classes to implement custom logic.

    Thereby, it is recommended (but not required) to call the super-class'
    corresponding method.

    Used in Algorithm and Policy to tag methods that need overriding, but the
    super class' method should still be called, e.g.
    `Algorithm.setup()`.

    .. testcode::
        :skipif: True

        from ray import tune
        @overrides(tune.Trainable)
        @OverrideToImplementCustomLogic_CallToSuperRecommended
        def setup(self, config):
            # implement custom setup logic here ...
            super().setup(config)
            # ... or here (after having called super()'s setup method.
    Fr0   r&   s    r   5OverrideToImplementCustomLogic_CallToSuperRecommendedr4      s    * "CJr   c                 $    t          | dd          S )zCheck whether a function has been overridden.

    Note, this only works for API calls decorated with OverrideToImplementCustomLogic
    or OverrideToImplementCustomLogic_CallToSuperRecommended.
    r1   T)getattrr&   s    r   is_overriddenr7      s     3+T222r   N)ray._common.deprecationr   ray.util.annotationsr   r$   r(   r*   r,   r.   r2   r4   r7   r#   r   r   <module>r:      s    . . . . . . 0 0 0 0 0 03 3 3l  8  6  :
 
 
  ,  23 3 3 


r   