o
    ]iz                     @   s   d Z ddlZddlZddlmZmZmZmZ ddl	m
Z
 ddlmZmZmZmZ ejeejeejeejeiZejfdededefd	d
ZejfdejdedefddZejejdfdededededef
ddZdS )zThe main parsing routine.    N)epydocgooglenumpydocrest)add_attribute_docstrings)	DocstringDocstringStyle
ParseErrorRenderingStyletextstylereturnc                 C   s   |t jkrt| | S d}g }t D ]#}z|| }W n ty1 } z|}W Y d}~qd}~ww || q|s<|t|dd ddd S )zParse the docstring into its components.

    :param text: docstring text to parse
    :param style: docstring style
    :returns: parsed docstring representation
    Nc                 S   s
   t | jS )N)lenmeta)d r   \/var/www/html/stock_analysis/be/venv/lib/python3.10/site-packages/docstring_parser/parser.py<lambda>.   s   
 zparse.<locals>.<lambda>T)keyreverser   )r   AUTO
_STYLE_MAPparsevaluesr	   appendsorted)r   r   excretsmoduleretexr   r   r   r      s   
r   objc                 C   s0   t | j|d}t| st| rt| | |S )aQ  Parse the object's docstring(s) into its components.

    The object can be anything that has a ``__doc__`` attribute. In contrast to
    the ``parse`` function, ``parse_from_object`` is able to parse attribute
    docstrings which are defined in the source code instead of ``__doc__``.

    Currently only attribute docstrings defined at class and module levels are
    supported. Attribute docstrings defined in ``__init__`` methods are not
    supported.

    When given a class, only the attribute docstrings of that class are parsed,
    not its inherited classes. This is a design decision. Separate calls to
    this function should be performed to get attribute docstrings of parent
    classes.

    :param obj: object from which to parse the docstring(s)
    :param style: docstring style
    :returns: parsed docstring representation
    )r   )r   __doc__inspectisclassismoduler   )r!   r   	docstringr   r   r   parse_from_object1   s   
r'   z    r&   rendering_styleindentc                 C   s(   t |tjkr	| jn| }|j| ||dS )a  Render a parsed docstring into docstring text.

    :param docstring: parsed docstring representation
    :param style: docstring style to render
    :param indent: the characters used as indentation in the docstring string
    :returns: docstring text
    )r(   r)   )r   r   r   r   compose)r&   r   r(   r)   r   r   r   r   r*   P   s   r*   )r"   r#   typingTdocstring_parserr   r   r   r   docstring_parser.attrdocr   docstring_parser.commonr   r   r	   r
   RESTGOOGLENUMPYDOCEPYDOCr   r   strr   Anyr'   COMPACTr*   r   r   r   r   <module>   sD    
!