o
    i                     @   s   d Z ddlZddlZh dZh dZddhZddhZd	d
hZddhZ	G dd de
ZG dd dejZG dd dej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 ZdS )!zCommon methods for parsing.    N>   argkeyparamkeywordargument	attribute	parameter>   raiseexceptraises	exceptiondeprecation
deprecatedreturnreturnsyieldyieldsexampleexamplesc                   @   s   e Zd ZdZdS )
ParseErrorz*Base class for all parsing related errors.N)__name__
__module____qualname____doc__ r   r   ]/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/docstring_parser/common.pyr      s    r   c                   @   s$   e Zd ZdZdZdZdZdZdZdS )DocstringStylezDocstring style.               N)	r   r   r   r   RESTGOOGLENUMPYDOCEPYDOCAUTOr   r   r   r   r      s    r   c                   @   s   e Zd ZdZdZdZdZdS )RenderingStylez1Rendering style when unparsing parsed docstrings.r   r   r   N)r   r   r   r   COMPACTCLEANEXPANDEDr   r   r   r   r'   $   s
    r'   c                   @   s2   e Zd ZdZdeje deje ddfddZdS )DocstringMetazDocstring meta information.

    Symbolizes lines in form of

        :param arg: description
        :raises ValueError: if something happens
    argsdescriptionr   Nc                 C   s   || _ || _dS )a,  Initialize self.

        :param args: list of arguments. The exact content of this variable is
            dependent on the kind of docstring; it's used to distinguish
            between custom docstring meta information items.
        :param description: associated docstring description.
        N)r,   r-   )selfr,   r-   r   r   r   __init__5   s   

zDocstringMeta.__init__)	r   r   r   r   TListstrOptionalr/   r   r   r   r   r+   ,   s    r+   c                       s\   e Zd ZdZdeje deje dedeje deje deje dd	f fd
dZ	  Z
S )DocstringParamz*DocstringMeta symbolizing :param metadata.r,   r-   arg_name	type_nameis_optionaldefaultr   Nc                    s*   t  || || _|| _|| _|| _dS Initialize self.N)superr/   r5   r6   r7   r8   )r.   r,   r-   r5   r6   r7   r8   	__class__r   r   r/   F   s
   

zDocstringParam.__init__r   r   r   r   r0   r1   r2   r3   boolr/   __classcell__r   r   r<   r   r4   C   s"    r4   c                       sV   e Zd ZdZ	ddeje deje deje dedeje ddf fd	d
Z	  Z
S )DocstringReturnsz7DocstringMeta symbolizing :returns or :yields metadata.Nr,   r-   r6   is_generatorreturn_namer   c                    s$   t  || || _|| _|| _dS r9   )r;   r/   r6   rB   rC   )r.   r,   r-   r6   rB   rC   r<   r   r   r/   Z   s   	
zDocstringReturns.__init__Nr>   r   r   r<   r   rA   W   s     rA   c                       D   e Zd ZdZdeje deje deje ddf fddZ  Z	S )	DocstringRaisesz+DocstringMeta symbolizing :raises metadata.r,   r-   r6   r   Nc                       t  || || _|| _dS r9   )r;   r/   r6   r-   )r.   r,   r-   r6   r<   r   r   r/   l      
zDocstringRaises.__init__
r   r   r   r   r0   r1   r2   r3   r/   r@   r   r   r<   r   rF   i       rF   c                       rE   )	DocstringDeprecatedz/DocstringMeta symbolizing deprecation metadata.r,   r-   versionr   Nc                    rG   r9   )r;   r/   rL   r-   )r.   r,   r-   rL   r<   r   r   r/   {   rH   zDocstringDeprecated.__init__rI   r   r   r<   r   rK   x   rJ   rK   c                       rE   )	DocstringExamplez+DocstringMeta symbolizing example metadata.r,   snippetr-   r   Nc                    s   t  || || _|| _dS r9   )r;   r/   rN   r-   )r.   r,   rN   r-   r<   r   r   r/      rH   zDocstringExample.__init__rI   r   r   r<   r   rM      rJ   rM   c                   @   s   e Zd ZdZ	d	dddZedeje fddZ	edej
e fdd	Zedej
e fd
dZedeje fddZedej
e fddZedeje fddZedej
e fddZdS )	Docstringz Docstring object representation.Nr   c                 C   s(   d| _ d| _d| _d| _g | _|| _dS )r:   NF)short_descriptionlong_descriptionblank_after_short_descriptionblank_after_long_descriptionmetastyle)r.   rU   r   r   r   r/      s   
zDocstring.__init__c                 C   sJ   g }| j r|| j  | jr|d | jr|| j |s dS d|S )z{Return the full description of the function

        Returns None if the docstring did not include any description
         N
)rP   appendrR   rQ   join)r.   retr   r   r   r-      s   

zDocstring.descriptionc                 C      dd | j D S )z0Return a list of information on function params.c                 S      g | ]	}t |tr|qS r   )
isinstancer4   .0itemr   r   r   
<listcomp>   s    z$Docstring.params.<locals>.<listcomp>rT   r.   r   r   r   params   s   zDocstring.paramsc                 C   r[   )z\Return a list of information on the exceptions that the function
        may raise.
        c                 S   r\   r   )r]   rF   r^   r   r   r   ra      
    
z$Docstring.raises.<locals>.<listcomp>rb   rc   r   r   r   r      s   zDocstring.raisesc                 C   "   | j D ]}t|tr|  S qdS )zeReturn a single information on function return.

        Takes the first return information.
        N)rT   r]   rA   r.   r`   r   r   r   r      s
   

zDocstring.returnsc                 C   r[   )z0Return a list of information on function return.c                 S   r\   r   )r]   rA   r^   r   r   r   ra      re   z*Docstring.many_returns.<locals>.<listcomp>rb   rc   r   r   r   many_returns      zDocstring.many_returnsc                 C   rf   )z:Return a single information on function deprecation notes.N)rT   r]   rK   rg   r   r   r   r      s
   

zDocstring.deprecationc                 C   r[   )z2Return a list of information on function examples.c                 S   r\   r   )r]   rM   r^   r   r   r   ra      re   z&Docstring.examples.<locals>.<listcomp>rb   rc   r   r   r   r      ri   zDocstring.examplesrD   )r   N)r   r   r   r   r/   propertyr0   r3   r2   r-   r1   r4   rd   rF   r   rA   r   rh   rK   r   rM   r   r   r   r   r   rO      s(    

rO   )r   enumtypingr0   PARAM_KEYWORDSRAISES_KEYWORDSDEPRECATION_KEYWORDSRETURNS_KEYWORDSYIELDS_KEYWORDSEXAMPLES_KEYWORDSRuntimeErrorr   Enumr   r'   r+   r4   rA   rF   rK   rM   rO   r   r   r   r   <module>   s&    	
