
    %j=                       d dl mZ d dlmZ d dlmZ d dlmZ erd dlm	Z	 d dlm
Z
mZ d dlmZ  G d d	          Z G d
 de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d  d!e          Z G d" d#e          Z G d$ d%e          Z G d& d'e          Z G d( d)          Z G d* d+e          Z G d, d-e          Z G d. d/e          Z  G d0 d1e          Z! G d2 d3e          Z" G d4 d5e          Z# G d6 d7e          Z$ G d8 d9e          Z% G d: d;e          Z& G d< d=e          Z' G d> d?e          Z( G d@ dAe          Z) G dB dCe          Z* G dD dEe          Z+ G dF dGe          Z, G dH dIe          Z- G dJ dKe          Z.dLS )M    )annotations)TYPE_CHECKING)DocstringSectionKind)	ExprTuple)Sequence)AnyLiteral)Exprc                  (    e Zd ZdZdddd
ZddZdS )DocstringElementz8This base class represents annotated, nameless elements.N
annotationdescriptionstrr   str | Expr | NonereturnNonec               $    || _         	 || _        dS )zInitialize the element.

        Parameters:
            annotation: The element annotation, if any.
            description: The element description.
        Nr   r   )selfr   r   s      j/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/griffe/_internal/docstrings/models.py__init__zDocstringElement.__init__   s     !,&-7%%    kwargsr   dict[str, Any]c                     | j         | j        dS )Return this element's data as a dictionary.

        Parameters:
            **kwargs: Additional serialization options.

        Returns:
            A dictionary.
        r   r   r   )r   r   s     r   as_dictzDocstringElement.as_dict!   s     /+
 
 	
r   )r   r   r   r   r   r   r   r   r   r   )__name__
__module____qualname____doc__r   r    r   r   r   r      sO        BBLP 
& 
& 
& 
& 
& 
&
 
 
 
 
 
r   r   c                  8     e Zd ZdZdddd fdZd fdZ xZS )DocstringNamedElementz5This base class represents annotated, named elements.N)r   valuenamer   r   r   r   r(   r   r   c               l    t                                          ||           || _        	 || _        dS )zInitialize the element.

        Parameters:
            name: The element name.
            description: The element description.
            annotation: The element annotation, if any.
            value: The element value, as a string.
        r   N)superr   r)   r(   )r   r)   r   r   r(   	__class__s        r   r   zDocstringNamedElement.__init__3   s9      	[ZHHH	(-
''r   r   r   r   c                n    d| j         i t                      j        di |}| j        
| j        |d<   |S )r   r)   Nr(   r%   )r)   r+   r   r(   )r   r   baser,   s      r   r   zDocstringNamedElement.as_dictI   sD     	?_UWW_%>%>v%>%>?:! JDMr   )
r)   r   r   r   r   r   r(   r   r   r   r    )r!   r"   r#   r$   r   r   __classcell__r,   s   @r   r'   r'   0   ss        ?? )-#'( ( ( ( ( ( ( (,         r   r'   c                      e Zd ZdZedd            Zej        dd            Zedd
            Zej        dd            ZdS )DocstringAdmonitionz$This class represents an admonition.r   r   c                    | j         S )zThe kind of this admonition.r   r   s    r   kindzDocstringAdmonition.kind[        r   r(   
str | Exprr   c                    || _         d S Nr   r   r(   s     r   r5   zDocstringAdmonition.kind`       r   r   c                    | j         S )z The contents of this admonition.r   r4   s    r   contentszDocstringAdmonition.contentsd   s     r   c                    || _         d S r9   r=   r:   s     r   r>   zDocstringAdmonition.contentsi   s     r   Nr   r   )r(   r7   r   r   r   r   r(   r   r   r   )r!   r"   r#   r$   propertyr5   setterr>   r%   r   r   r2   r2   X   s        ..   X 
[      [        X  _! ! ! _! ! !r   r2   c                  L    e Zd ZdZed	d            Zej        d
d            ZdS )DocstringDeprecatedz3This class represents a documented deprecated item.r   r   c                    | j         S )z The version of this deprecation.r   r4   s    r   versionzDocstringDeprecated.versionq   r6   r   r(   r   c                    || _         d S r9   r   r:   s     r   rH   zDocstringDeprecated.versionv   r;   r   NrA   rB   )r!   r"   r#   r$   rC   rH   rD   r%   r   r   rF   rF   n   sZ        ==   X ^      ^     r   rF   c                      e Zd ZdZdS )DocstringRaisez/This class represents a documented raise value.Nr!   r"   r#   r$   r%   r   r   rK   rK   {           9999r   rK   c                      e Zd ZdZdS )DocstringWarnz.This class represents a documented warn value.NrL   r%   r   r   rO   rO              8888r   rO   c                      e Zd ZdZdS )DocstringReturnz0This class represents a documented return value.NrL   r%   r   r   rR   rR      s        ::::r   rR   c                      e Zd ZdZdS )DocstringYieldz/This class represents a documented yield value.NrL   r%   r   r   rT   rT      rM   r   rT   c                      e Zd ZdZdS )DocstringReceivez1This class represents a documented receive value.NrL   r%   r   r   rV   rV      s        ;;;;r   rV   c                  L    e Zd ZdZed
d            Zej        dd            Zd	S )DocstringParameterz5This class represent a documented function parameter.r   r   c                    | j         S )z$The default value of this parameter.r(   r4   s    r   defaultzDocstringParameter.default        zr   r(   r   r   c                    || _         d S r9   rZ   r:   s     r   r[   zDocstringParameter.default       


r   Nr@   rB   )r!   r"   r#   r$   rC   r[   rD   r%   r   r   rX   rX      sZ        ??   X ^   ^  r   rX   c                      e Zd ZdZedd            Zej        dd            Zedd	            Zej        dd            Zedd            Zej        dd            ZdS )DocstringTypeParameterz1This class represent a documented type parameter.r   r   c                    | j         S )z)The default value of this type parameter.rZ   r4   s    r   r[   zDocstringTypeParameter.default   r\   r   r(   r   r   c                    || _         d S r9   rZ   r:   s     r   r[   zDocstringTypeParameter.default   r^   r   c                H    t          | j        t                    s| j        S dS )z!The bound of this type parameter.N)
isinstancer   r   r4   s    r   boundzDocstringTypeParameter.bound   s%     $/955 	#?"tr   re   c                    || _         d S r9   r   )r   re   s     r   re   zDocstringTypeParameter.bound   r;   r   tuple[str | Expr, ...] | Nonec                l    t          | j        t                    rt          | j        j                  S dS )z'The constraints of this type parameter.N)rd   r   r   tupleelementsr4   s    r   constraintsz"DocstringTypeParameter.constraints   s0     doy11 	31222tr   rk   Sequence[str | Expr] | Nonec                D    |t          |          | _        d S d | _        d S r9   )r   r   )r   rk   s     r   rk   z"DocstringTypeParameter.constraints   s&    "'44DOOO"DOOOr   Nr@   rB   )re   r   r   r   )r   rg   )rk   rl   r   r   )	r!   r"   r#   r$   rC   r[   rD   re   rk   r%   r   r   r`   r`      s        ;;   X ^   ^    X \      \     X # # # # # #r   r`   c                      e Zd ZdZdS )DocstringAttributez:This class represents a documented module/class attribute.NrL   r%   r   r   ro   ro      s        DDDDr   ro   c                  *    e Zd ZdZedd            ZdS )DocstringFunctionz,This class represents a documented function.r   r   c                    | j         S )zThe function signature.r   r4   s    r   	signaturezDocstringFunction.signature   r6   r   Nr@   r!   r"   r#   r$   rC   rs   r%   r   r   rq   rq      s8        66   X  r   rq   c                  *    e Zd ZdZedd            ZdS )DocstringClassz)This class represents a documented class.r   r   c                    | j         S )zThe class signature.r   r4   s    r   rs   zDocstringClass.signature   r6   r   Nr@   rt   r%   r   r   rv   rv      s8        33   X  r   rv   c                      e Zd ZdZdS )DocstringTypeAliasz.This class represents a documented type alias.NrL   r%   r   r   ry   ry      rP   r   ry   c                      e Zd ZdZdS )DocstringModulez*This class represents a documented module.NrL   r%   r   r   r{   r{      s        4444r   r{   c                  :    e Zd ZU dZded<   	 ddd	ZddZddZdS )DocstringSectionz*This class represents a docstring section.r   r5   Ntitle
str | Noner   r   c                $    || _         	 d| _        dS )z[Initialize the section.

        Parameters:
            title: An optional title.
        N)r~   r(   )r   r~   s     r   r   zDocstringSection.__init__   s     "'
 
  r   boolc                *    t          | j                  S )z*Whether this section has a true-ish value.)r   r(   r4   s    r   __bool__zDocstringSection.__bool__   s    DJr   r   r   r   c                    t          | j        d          r | j        j        di |}n| j        }| j        j        |d}| j        r
| j        |d<   |S )zReturn this section's data as a dictionary.

        Parameters:
            **kwargs: Additional serialization options.

        Returns:
            A dictionary.
        r   )r5   r(   r~   r%   )hasattrr(   r   r5   r~   )r   r   serialized_valuer.   s       r   r   zDocstringSection.as_dict   sj     4:y)) 	*1tz1;;F;;#z	2BCC: 	' JDMr   r9   )r~   r   r   r   )r   r   r    )r!   r"   r#   r$   __annotations__r   r   r   r%   r   r   r}   r}      sl         44	! 	! 	! 	! 	!            r   r}   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionTextz%This class represents a text section.r   r5   Nr(   r   r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section text.
            title: An optional title.
        Nr+   r   r(   r   r(   r~   r,   s      r   r   zDocstringSectionText.__init__  s(     	


r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   textr5   r   r   r/   r0   s   @r   r   r   	  s^         //!5!:D::::                     r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionParametersz+This class represents a parameters section.r   r5   Nr(   list[DocstringParameter]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section parameters.
            title: An optional title.
        Nr   r   s      r   r   z#DocstringSectionParameters.__init__  (     	/4


r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   
parametersr5   r   r   r/   r0   s   @r   r   r     s^         55!5!@D@@@@5 5 5 5 5 5 5 5 5 5 5r   r   c                  ,    e Zd ZU dZej        Zded<   dS )DocstringSectionOtherParametersz2This class represents an other parameters section.r   r5   N)r!   r"   r#   r$   r   other_parametersr5   r   r%   r   r   r   r   )  s,         <<!5!FDFFFFFFr   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionTypeParametersz0This class represents a type parameters section.r   r5   Nr(   list[DocstringTypeParameter]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section type parameters.
            title: An optional title.
        Nr   r   s      r   r   z'DocstringSectionTypeParameters.__init__4  s(     	38


r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   type_parametersr5   r   r   r/   r0   s   @r   r   r   /  s^         ::!5!EDEEEE9 9 9 9 9 9 9 9 9 9 9r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionRaisesz'This class represents a raises section.r   r5   Nr(   list[DocstringRaise]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section exceptions.
            title: An optional title.
        Nr   r   s      r   r   zDocstringSectionRaises.__init__D  (     	+0


r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   raisesr5   r   r   r/   r0   s   @r   r   r   ?  ^         11!5!<D<<<<1 1 1 1 1 1 1 1 1 1 1r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionWarnsz&This class represents a warns section.r   r5   Nr(   list[DocstringWarn]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section warnings.
            title: An optional title.
        Nr   r   s      r   r   zDocstringSectionWarns.__init__T  s(     	*/


r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   warnsr5   r   r   r/   r0   s   @r   r   r   O  s^         00!5!;D;;;;0 0 0 0 0 0 0 0 0 0 0r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionReturnsz(This class represents a returns section.r   r5   Nr(   list[DocstringReturn]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section returned items.
            title: An optional title.
        Nr   r   s      r   r   z DocstringSectionReturns.__init__d  (     	,1


r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   returnsr5   r   r   r/   r0   s   @r   r   r   _  ^         22!5!=D====2 2 2 2 2 2 2 2 2 2 2r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionYieldsz'This class represents a yields section.r   r5   Nr(   list[DocstringYield]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section yielded items.
            title: An optional title.
        Nr   r   s      r   r   zDocstringSectionYields.__init__t  r   r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   yieldsr5   r   r   r/   r0   s   @r   r   r   o  r   r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionReceivesz)This class represents a receives section.r   r5   Nr(   list[DocstringReceive]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section received items.
            title: An optional title.
        Nr   r   s      r   r   z!DocstringSectionReceives.__init__  s(     	-2


r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   receivesr5   r   r   r/   r0   s   @r   r   r     s^         33!5!>D>>>>3 3 3 3 3 3 3 3 3 3 3r   r   c                  B     e Zd ZU dZej        Zded<   	 dd fdZ xZ	S )DocstringSectionExamplesz*This class represents an examples section.r   r5   Nr(   Slist[tuple[Literal[DocstringSectionKind.text, DocstringSectionKind.examples], str]]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section examples.
            title: An optional title.
        Nr   r   s      r   r   z!DocstringSectionExamples.__init__  s(     	jo


r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   examplesr5   r   r   r/   r0   s   @r   r   r     sn         44!5!>D>>>>
 !p p p p p p p p p p pr   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionAttributesz,This class represents an attributes section.r   r5   Nr(   list[DocstringAttribute]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section attributes.
            title: An optional title.
        Nr   r   s      r   r   z#DocstringSectionAttributes.__init__  r   r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   
attributesr5   r   r   r/   r0   s   @r   r   r     s^         66!5!@D@@@@5 5 5 5 5 5 5 5 5 5 5r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionFunctionsz2This class represents a functions/methods section.r   r5   Nr(   list[DocstringFunction]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section functions.
            title: An optional title.
        Nr   r   s      r   r   z"DocstringSectionFunctions.__init__  s(     	.3


r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   	functionsr5   r   r   r/   r0   s   @r   r   r     s^         <<!5!?D????4 4 4 4 4 4 4 4 4 4 4r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionClassesz(This class represents a classes section.r   r5   Nr(   list[DocstringClass]r~   r   r   r   c                X    t                                          |           || _        dS zInitialize the section.

        Parameters:
            value: The section classes.
            title: An optional title.
        Nr   r   s      r   r   z DocstringSectionClasses.__init__  r   r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   classesr5   r   r   r/   r0   s   @r   r   r     s^         22!5!=D====1 1 1 1 1 1 1 1 1 1 1r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionTypeAliasesz-This class represents a type aliases section.r   r5   Nr(   list[DocstringTypeAlias]r~   r   r   r   c                X    t                                          |           || _        dS r   r   r   s      r   r   z$DocstringSectionTypeAliases.__init__  r   r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   type_aliasesr5   r   r   r/   r0   s   @r   r   r     s^         77!5!BDBBBB5 5 5 5 5 5 5 5 5 5 5r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionModulesz(This class represents a modules section.r   r5   Nr(   list[DocstringModule]r~   r   r   r   c                X    t                                          |           || _        dS )zInitialize the section.

        Parameters:
            value: The section modules.
            title: An optional title.
        Nr   r   s      r   r   z DocstringSectionModules.__init__  r   r   r9   )r(   r   r~   r   r   r   )
r!   r"   r#   r$   r   modulesr5   r   r   r/   r0   s   @r   r   r     r   r   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionDeprecatedz+This class represents a deprecated section.r   r5   NrH   r   r   r~   r   r   r   c                v    t                                          |           t          ||          | _        dS )zInitialize the section.

        Parameters:
            version: The deprecation version.
            text: The deprecation text.
            title: An optional title.
        r   N)r+   r   rF   r(   )r   rH   r   r~   r,   s       r   r   z#DocstringSectionDeprecated.__init__  s6     	*=^b*c*c*c


r   r9   )rH   r   r   r   r~   r   r   r   )
r!   r"   r#   r$   r   
deprecatedr5   r   r   r/   r0   s   @r   r   r     si         55!5!@D@@@@	d 	d 	d 	d 	d 	d 	d 	d 	d 	d 	dr   r   c                  @     e Zd ZU dZej        Zded<   dd fdZ xZ	S )DocstringSectionAdmonitionz,This class represents an admonition section.r   r5   Nr   r   r~   r   r   r   c                v    t                                          |           t          ||          | _        dS )zInitialize the section.

        Parameters:
            kind: The admonition kind.
            text: The admonition text.
            title: An optional title.
        r   N)r+   r   r2   r(   )r   r5   r   r~   r,   s       r   r   z#DocstringSectionAdmonition.__init__	  s6     	*=[_*`*`*`


r   r9   )r5   r   r   r   r~   r   r   r   )
r!   r"   r#   r$   r   
admonitionr5   r   r   r/   r0   s   @r   r   r     si         66!5!@D@@@@	a 	a 	a 	a 	a 	a 	a 	a 	a 	a 	ar   r   N)/
__future__r   typingr   griffe._internal.enumerationsr   griffe._internal.expressionsr   collections.abcr   r   r	   r
   r   r'   r2   rF   rK   rO   rR   rT   rV   rX   r`   ro   rq   rv   ry   r{   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r%   r   r   <module>r      sz   # " " " " "             > > > > > > 2 2 2 2 2 2 2((((((########111111
 
 
 
 
 
 
 
<% % % % %, % % %P! ! ! ! !* ! ! !,
  
  
  
  
 * 
  
  
 : : : : :% : : :9 9 9 9 9$ 9 9 9; ; ; ; ;+ ; ; ;: : : : :* : : :< < < < <, < < <
 
 
 
 
. 
 
 
## ## ## ## ##2 ## ## ##LE E E E E. E E E    -       *   9 9 9 9 9. 9 9 95 5 5 5 5+ 5 5 5
% % % % % % % %P         +       5 5 5 5 5!1 5 5 5 G G G G G&@ G G G9 9 9 9 9%5 9 9 9 1 1 1 1 1- 1 1 1 0 0 0 0 0, 0 0 0 2 2 2 2 2. 2 2 2 1 1 1 1 1- 1 1 1 3 3 3 3 3/ 3 3 3 p p p p p/ p p p(5 5 5 5 5!1 5 5 5 4 4 4 4 4 0 4 4 4 1 1 1 1 1. 1 1 1 5 5 5 5 5"2 5 5 5 2 2 2 2 2. 2 2 2 d d d d d!1 d d d"a a a a a!1 a a a a ar   