
    &`i4                     8   d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ  G d de          Z	d Z
d Z G d	 d
e          Zej        s ej        de           d Zdddedee         defdZdedefdZe	j        dfde	ddfdZdefdZdee         fdZdS )    N)Enum)wraps)Optionalc                       e Zd ZdZdZdZdZdS )AnnotationType	PublicAPIDeveloperAPI
DeprecatedUnknownN)__name__
__module____qualname__
PUBLIC_APIDEVELOPER_API
DEPRECATEDUNKNOWN     h/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/util/annotations.pyr   r   	   s"        J"MJGGGr   r   c                  2   t          |           dk    rHt          |          dk    r5t          | d                   r  t          dd          | d                   S d|v r|d         dv s
J             nd|                    dd          fd	}|S )
a+  Annotation for documenting public APIs.

    Public APIs are classes and methods exposed to end users of Ray.

    If ``stability="alpha"``, the API can be used by advanced users who are
    tolerant to and expect breaking changes.

    If ``stability="beta"``, the API is still public and can be used by early
    users, but are subject to change.

    If ``stability="stable"``, the APIs will remain backwards compatible across
    minor Ray releases (e.g., Ray 1.4 -> 1.8).

    For a full definition of the stability levels, please refer to the
    :ref:`Ray API Stability definitions <api-stability>`.

    Args:
        stability: One of {"stable", "beta", "alpha"}.
        api_group: Optional. Used only for doc rendering purpose. APIs in the same group
                   will be grouped together in the API doc pages.

    Examples:
        >>> from ray.util.annotations import PublicAPI
        >>> @PublicAPI
        ... def func(x):
        ...     return x

        >>> @PublicAPI(stability="beta")
        ... def func(y):
        ...     return y
       r   stableOthers)	stability	api_groupr   )r   betaalphar   c                 |    dv rd d d}t          | |           t          | t          j                   | S )N)r   r   z**PublicAPI (z):** This API is in z' and may change before becoming stable.message)typer   )_append_doc_mark_annotatedr   r   )objr    r   r   s     r   wrapzPublicAPI.<locals>.wrap:   sh    )))9	 9 9y 9 9 9  W----.";yQQQQ
r   )lencallabler   get)argskwargsr%   r   r   s      @@r   r   r      s    @ 4yyA~~#f++**xQ/@/@*@y8x@@@aIIIf;'	77777777	

;11I	 	 	 	 	 	 Kr   c                      t          |           dk    rEt          |          dk    r2t          | d                   r t                      | d                   S d }|S )ap  Annotation for documenting developer APIs.

    Developer APIs are lower-level methods explicitly exposed to advanced Ray
    users and library developers. Their interfaces may change across minor
    Ray releases.

    Examples:
        >>> from ray.util.annotations import DeveloperAPI
        >>> @DeveloperAPI
        ... def func(x):
        ...     return x
    r   r   c                 ^    t          | d           t          | t          j                   | S )Nz@**DeveloperAPI:** This API may change across minor Ray releases.r   r!   )r"   r#   r   r   r$   s    r   r%   zDeveloperAPI.<locals>.wrapX   s<    V	
 	
 	
 	
 	.">????
r   )r&   r'   r	   )r)   r*   r%   s      r   r	   r	   H   sb     4yyA~~#f++**xQ/@/@*|~~d1g&&&   Kr   c                       e Zd ZdZdS )RayDeprecationWarningzBSpecialized Deprecation Warning for fine grained filtering controlN)r   r   r   __doc__r   r   r   r0   r0   c   s        LLDr   r0   module)categoryc                     t          |           dk    rEt          |          dk    r2t          | d                   r t                      | d                   S dd|                    dd          d|v rdz   |d         z   dz   |d         z   |d= |r4t	          d	                    |                                                    fd
}|S )a9  Annotation for documenting a deprecated API.

    Deprecated APIs may be removed in future releases of Ray.

    Args:
        message: a message to help users understand the reason for the
            deprecation, and provide a migration path.

    Examples:
        >>> from ray.util.annotations import Deprecated
        >>> @Deprecated
        ... def func(x):
        ...     return x

        >>> @Deprecated(message="g() is deprecated because the API is error "
        ...   "prone. Please call h() instead.")
        ... def g(y):
        ...     return y
    r   r   zQ**DEPRECATED**: This API is deprecated and may be removed in future Ray releases.zThis API is deprecated and may be removed in future Ray releases. You could suppress this warning by setting env variable PYTHONWARNINGS="ignore::DeprecationWarning"warningFr    
zUnknown kwargs: {}c                      t           d           t           t          j                   s S t	          j                   r j        fd}| _         S t                      fd            }|S )Nr5   )r    	directiver-   c                  L    t          j        t          d            | i |S N   )
stacklevelwarningswarnr0   )r)   r*   obj_initwarning_messages     r   patched_initz/Deprecated.<locals>.inner.<locals>.patched_init   s1    o/DQRSSSSx0000r   c                  L    t          j        t          d            | i |S r:   r=   )r)   r*   r$   rA   s     r   wrapperz*Deprecated.<locals>.inner.<locals>.wrapper   s1    o/DQRSSSSsD+F+++r   )r"   r#   r   r   inspectisclass__init__r   )r$   rB   rD   r@   doc_messager5   rA   s   `  @r   innerzDeprecated.<locals>.inner   s    C	BBBB.";<<<< 	J?3 	|H1 1 1 1 1 1 (CLJ 3ZZ, , , , , Z, Nr   )r&   r'   r
   pop
ValueErrorformatkeys)r)   r*   rI   rH   r5   rA   s      @@@r   r
   r
   o   s   ( 4yyA~~#f++**xQ/@/@*z||DG$$$	" 
	6  jjE**GF!D(6)+<<)D06)3DD9 E-44V[[]]CCDDD      2 Lr   )r8   r    r8   returnc                   | j         sd| _         | j                                         | _         t          | j                   }| xj         dz  c_         |S| xj         d|z   d| dz  c_         |                    ddd|dz   z  z             }| xj         d|dz   z   | z  c_         n6|                    ddd|dz   z  z             }| xj         d|z   | z  c_         | xj         dd|z   z  c_         d S )N z

 z.. z::

r6      )r1   rstrip_get_indentreplace)r$   r    r8   indents       r   r"   r"      s   ; +$$&&CK%%FKK6KK#,<<9<<<<//$sfqj/A(ABB#!,7g777//$sfqj/A(ABB#,1111KK&f&&&KKKKr   	docstringc                    | sdS t          t          t          |                                                     }t	          |          dk    rdS t	          |d                   t	          |d                                                   z
  S )a!  

    Example:
        >>> def f():
        ...     '''Docstring summary.'''
        >>> f.__doc__
        'Docstring summary.'
        >>> _get_indent(f.__doc__)
        0

        >>> def g(foo):
        ...     '''Docstring summary.
        ...
        ...     Args:
        ...         foo: Does bar.
        ...     '''
        >>> g.__doc__
        'Docstring summary.\n\n    Args:\n        foo: Does bar.\n    '
        >>> _get_indent(g.__doc__)
        4

        >>> class A:
        ...     def h():
        ...         '''Docstring summary.
        ...
        ...         Returns:
        ...             None.
        ...         '''
        >>> A.h.__doc__
        'Docstring summary.\n\n        Returns:\n            None.\n        '
        >>> _get_indent(A.h.__doc__)
        8
    r   r   )listfilterbool
splitlinesr&   lstrip)rW   non_empty_liness     r   rT   rT      s    D  q6$	(<(<(>(>??@@O
?q  q q!""S);)B)B)D)D%E%EEEr   r   r!   c                 ^    t          | d          r| j        | _        || _        || _        d S d S )Nr   )hasattrr   
_annotated_annotated_type_annotated_api_group)r$   r!   r   s      r   r#   r#      s?     sJ -"#,   - -r   c                 B    t          | d          o| j        | j        k    S )Nra   )r`   ra   r   r.   s    r   _is_annotatedre     s     3%%H#.CL*HHr   c                 <    t          |           sd S | j        j        S )N)re   rb   valuer.   s    r   _get_annotation_typerh     s#     t$$r   )rE   sysr>   enumr   	functoolsr   typingr   r   r   r	   DeprecationWarningr0   warnoptionsfilterwarningsr
   strr"   intrT   r   r#   r[   re   rh   r   r   r   <module>rr      s    



                       T   5 5 5p  6	 	 	 	 	. 	 	 	  FHH/DEEEED D DN BF ' ' ' '# '# ' ' ' '(,F3 ,F3 ,F ,F ,F ,F` !/ 6(- --	- - - -I$ I I I I
%# % % % % % %r   