o
    w!gI4                     @  s$  d dl mZ d dlmZ d dlmZ er"d dlmZmZ d dlm	Z	 G dd dZ
G dd	 d	e
ZG d
d de
ZG dd de
ZG dd de
ZG dd de
ZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG d d! d!eZG d"d# d#ZG d$d% d%eZG d&d' d'eZG d(d) d)eZG d*d+ d+eZG d,d- d-eZG d.d/ d/eZG d0d1 d1eZG d2d3 d3eZ G d4d5 d5eZ!G d6d7 d7eZ"G d8d9 d9eZ#G d:d; d;eZ$G d<d= d=eZ%G d>d? d?eZ&G d@dA dAeZ'dBS )C    )annotations)TYPE_CHECKING)DocstringSectionKind)AnyLiteral)Exprc                   @  s*   e Zd ZdZdddd
dZdddZdS )DocstringElementz8This base class represents annotated, nameless elements.N
annotationdescriptionstrr
   str | Expr | NonereturnNonec                C  s   || _ 	 || _dS )zInitialize the element.

        Parameters:
            annotation: The element annotation, if any.
            description: The element description.
        Nr   r
   )selfr   r
    r   [/mnt/skqttb/ctump_chatbot/chatbot/lib/python3.10/site-packages/_griffe/docstrings/models.py__init__   s   zDocstringElement.__init__kwargsr   dict[str, Any]c                 K  s   | 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   r   r   r   as_dict   s   
zDocstringElement.as_dict)r   r   r
   r   r   r   r   r   r   r   )__name__
__module____qualname____doc__r   r   r   r   r   r   r      s    r   c                      s8   e Zd ZdZdddd fddZd fddZ  ZS )DocstringNamedElementz5This base class represents annotated, named elements.N)r
   valuenamer   r   r
   r   r    
str | Noner   r   c                  s"   t  j||d || _	 || _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__r   r   r   1   s
   zDocstringNamedElement.__init__r   r   r   c                   s4   d| j it jdi |}| jdur| j|d< |S )r   r!   Nr    r   )r!   r#   r   r    )r   r   baser$   r   r   r   G   s   	

zDocstringNamedElement.as_dict)
r!   r   r   r   r
   r   r    r"   r   r   r   )r   r   r   r   r   r   __classcell__r   r   r$   r   r   .   s    r   c                   @  sL   e Zd ZdZedddZejdd	dZedddZejdddZdS )DocstringAdmonitionz$This class represents an admonition.r   r   c                 C     | j S )zThe kind of this admonition.r	   r   r   r   r   kindY      zDocstringAdmonition.kindr    
str | Exprr   c                 C  
   || _ d S Nr	   r   r    r   r   r   r+   ^      
r   c                 C  r)   )z The contents of this admonition.r   r*   r   r   r   contentsb   r,   zDocstringAdmonition.contentsc                 C  r.   r/   r2   r0   r   r   r   r3   g   r1   Nr   r   )r    r-   r   r   r   r   r    r   r   r   )r   r   r   r   propertyr+   setterr3   r   r   r   r   r(   V   s    r(   c                   @  s.   e Zd ZdZed
ddZejdddZd	S )DocstringDeprecatedz3This class represents a documented deprecated item.r   r   c                 C  r)   )z The version of this deprecation.r	   r*   r   r   r   versiono   r,   zDocstringDeprecated.versionr    r   c                 C  r.   r/   r	   r0   r   r   r   r:   t   r1   Nr5   r6   )r   r   r   r   r7   r:   r8   r   r   r   r   r9   l       r9   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   r   r=   y       r=   c                   @  r<   )DocstringWarnz.This class represents a documented warn value.Nr>   r   r   r   r   r@   }   r?   r@   c                   @  r<   )DocstringReturnz0This class represents a documented return value.Nr>   r   r   r   r   rA      r?   rA   c                   @  r<   )DocstringYieldz/This class represents a documented yield value.Nr>   r   r   r   r   rB      r?   rB   c                   @  r<   )DocstringReceivez1This class represents a documented receive value.Nr>   r   r   r   r   rC      r?   rC   c                   @  s.   e Zd ZdZedddZejdd	dZd
S )DocstringParameterz5This class represent a documented function parameter.r   r"   c                 C  r)   )z$The default value of this parameter.r    r*   r   r   r   default   r,   zDocstringParameter.defaultr    r   r   c                 C  r.   r/   rE   r0   r   r   r   rF      r1   N)r   r"   r6   )r   r   r   r   r7   rF   r8   r   r   r   r   rD      r;   rD   c                   @  r<   )DocstringAttributez:This class represents a documented module/class attribute.Nr>   r   r   r   r   rG      r?   rG   c                   @     e Zd ZdZedddZdS )DocstringFunctionz,This class represents a documented function.r   r   c                 C  r)   )zThe function signature.r	   r*   r   r   r   	signature   r,   zDocstringFunction.signatureNr4   r   r   r   r   r7   rJ   r   r   r   r   rI          rI   c                   @  rH   )DocstringClassz)This class represents a documented class.r   r   c                 C  r)   )zThe class signature.r	   r*   r   r   r   rJ      r,   zDocstringClass.signatureNr4   rK   r   r   r   r   rM      rL   rM   c                   @  r<   )DocstringModulez*This class represents a documented module.Nr>   r   r   r   r   rN      r?   rN   c                   @  s<   e Zd ZU dZded< 	 ddd	d
ZdddZdddZdS )DocstringSectionz*This class represents a docstring section.r   r+   Ntitler"   r   r   c                 C  s   || _ 	 d| _dS )z[Initialize the section.

        Parameters:
            title: An optional title.
        N)rP   r    )r   rP   r   r   r   r      s   zDocstringSection.__init__boolc                 C  s
   t | jS )z*Whether this section has a true-ish value.)rQ   r    r*   r   r   r   __bool__   r1   zDocstringSection.__bool__r   r   r   c                 K  sH   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   )r+   r    rP   Nr   )hasattrr    r   r+   rP   )r   r   serialized_valuer&   r   r   r   r      s   	
zDocstringSection.as_dictr/   )rP   r"   r   r   )r   rQ   r   )r   r   r   r   __annotations__r   rR   r   r   r   r   r   rO      s   
 
rO   c                      4   e Zd ZU dZejZded< dd fddZ  Z	S )DocstringSectionTextz%This class represents a text section.r   r+   Nr    r   rP   r"   r   r   c                      t  | || _dS )zInitialize the section.

        Parameters:
            value: The section text.
            title: An optional title.
        Nr#   r   r    r   r    rP   r$   r   r   r         
zDocstringSectionText.__init__r/   )r    r   rP   r"   r   r   )
r   r   r   r   r   textr+   rU   r   r'   r   r   r$   r   rW         
 rW   c                      rV   )DocstringSectionParametersz+This class represents a parameters section.r   r+   Nr    list[DocstringParameter]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section parameters.
            title: An optional title.
        NrY   rZ   r$   r   r   r      r[   z#DocstringSectionParameters.__init__r/   )r    r_   rP   r"   r   r   )
r   r   r   r   r   
parametersr+   rU   r   r'   r   r   r$   r   r^      r]   r^   c                   @  s    e Zd ZU dZejZded< dS )DocstringSectionOtherParametersz2This class represents an other parameters section.r   r+   N)r   r   r   r   r   other_parametersr+   rU   r   r   r   r   ra      s   
 ra   c                      rV   )DocstringSectionRaisesz'This class represents a raises section.r   r+   Nr    list[DocstringRaise]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section exceptions.
            title: An optional title.
        NrY   rZ   r$   r   r   r     r[   zDocstringSectionRaises.__init__r/   )r    rd   rP   r"   r   r   )
r   r   r   r   r   raisesr+   rU   r   r'   r   r   r$   r   rc     r]   rc   c                      rV   )DocstringSectionWarnsz&This class represents a warns section.r   r+   Nr    list[DocstringWarn]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section warnings.
            title: An optional title.
        NrY   rZ   r$   r   r   r     r[   zDocstringSectionWarns.__init__r/   )r    rg   rP   r"   r   r   )
r   r   r   r   r   warnsr+   rU   r   r'   r   r   r$   r   rf     r]   rf   c                      rV   )DocstringSectionReturnsz(This class represents a returns section.r   r+   Nr    list[DocstringReturn]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section returned items.
            title: An optional title.
        NrY   rZ   r$   r   r   r   (  r[   z DocstringSectionReturns.__init__r/   )r    rj   rP   r"   r   r   )
r   r   r   r   r   returnsr+   rU   r   r'   r   r   r$   r   ri   #  r]   ri   c                      rV   )DocstringSectionYieldsz'This class represents a yields section.r   r+   Nr    list[DocstringYield]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section yielded items.
            title: An optional title.
        NrY   rZ   r$   r   r   r   8  r[   zDocstringSectionYields.__init__r/   )r    rm   rP   r"   r   r   )
r   r   r   r   r   yieldsr+   rU   r   r'   r   r   r$   r   rl   3  r]   rl   c                      rV   )DocstringSectionReceivesz)This class represents a receives section.r   r+   Nr    list[DocstringReceive]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section received items.
            title: An optional title.
        NrY   rZ   r$   r   r   r   H  r[   z!DocstringSectionReceives.__init__r/   )r    rp   rP   r"   r   r   )
r   r   r   r   r   receivesr+   rU   r   r'   r   r   r$   r   ro   C  r]   ro   c                      s6   e Zd ZU dZejZded< 	dd fddZ  Z	S )DocstringSectionExamplesz*This class represents an examples section.r   r+   Nr    Slist[tuple[Literal[DocstringSectionKind.text, DocstringSectionKind.examples], str]]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section examples.
            title: An optional title.
        NrY   rZ   r$   r   r   r   X  s   
z!DocstringSectionExamples.__init__r/   )r    rs   rP   r"   r   r   )
r   r   r   r   r   examplesr+   rU   r   r'   r   r   r$   r   rr   S  s
   
 rr   c                      rV   )DocstringSectionAttributesz,This class represents an attributes section.r   r+   Nr    list[DocstringAttribute]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section attributes.
            title: An optional title.
        NrY   rZ   r$   r   r   r   l  r[   z#DocstringSectionAttributes.__init__r/   )r    rv   rP   r"   r   r   )
r   r   r   r   r   
attributesr+   rU   r   r'   r   r   r$   r   ru   g  r]   ru   c                      rV   )DocstringSectionFunctionsz2This class represents a functions/methods section.r   r+   Nr    list[DocstringFunction]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section functions.
            title: An optional title.
        NrY   rZ   r$   r   r   r   |  r[   z"DocstringSectionFunctions.__init__r/   )r    ry   rP   r"   r   r   )
r   r   r   r   r   	functionsr+   rU   r   r'   r   r   r$   r   rx   w  r]   rx   c                      rV   )DocstringSectionClassesz(This class represents a classes section.r   r+   Nr    list[DocstringClass]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section classes.
            title: An optional title.
        NrY   rZ   r$   r   r   r     r[   z DocstringSectionClasses.__init__r/   )r    r|   rP   r"   r   r   )
r   r   r   r   r   classesr+   rU   r   r'   r   r   r$   r   r{     r]   r{   c                      rV   )DocstringSectionModulesz(This class represents a modules section.r   r+   Nr    list[DocstringModule]rP   r"   r   r   c                   rX   )zInitialize the section.

        Parameters:
            value: The section modules.
            title: An optional title.
        NrY   rZ   r$   r   r   r     r[   z DocstringSectionModules.__init__r/   )r    r   rP   r"   r   r   )
r   r   r   r   r   modulesr+   rU   r   r'   r   r   r$   r   r~     r]   r~   c                      s4   e Zd ZU dZejZded< dd fddZ  Z	S )DocstringSectionDeprecatedz+This class represents a deprecated section.r   r+   Nr:   r   r\   rP   r"   r   r   c                      t  | t||d| _dS )zInitialize the section.

        Parameters:
            version: The deprecation version.
            text: The deprecation text.
            title: An optional title.
        r   N)r#   r   r9   r    )r   r:   r\   rP   r$   r   r   r        z#DocstringSectionDeprecated.__init__r/   )r:   r   r\   r   rP   r"   r   r   )
r   r   r   r   r   
deprecatedr+   rU   r   r'   r   r   r$   r   r     r]   r   c                      rV   )DocstringSectionAdmonitionz,This class represents an admonition section.r   r+   Nr   r\   rP   r"   r   r   c                   r   )zInitialize the section.

        Parameters:
            kind: The admonition kind.
            text: The admonition text.
            title: An optional title.
        r   N)r#   r   r(   r    )r   r+   r\   rP   r$   r   r   r     r   z#DocstringSectionAdmonition.__init__r/   )r+   r   r\   r   rP   r"   r   r   )
r   r   r   r   r   
admonitionr+   rU   r   r'   r   r   r$   r   r     r]   r   N)(
__future__r   typingr   _griffe.enumerationsr   r   r   _griffe.expressionsr   r   r   r(   r9   r=   r@   rA   rB   rC   rD   rG   rI   rM   rN   rO   rW   r^   ra   rc   rf   ri   rl   ro   rr   ru   rx   r{   r~   r   r   r   r   r   r   <module>   sH   (		(