o
    w!åg¸  ã                   @  sô   U d dl mZ d dlmZmZmZmZ d dlmZ d dl	m
Z
mZ d dlmZ d dlmZ d dlmZ er;d dlmZ ejejejgZed	 Z	 ed
 Z	 ddddœd%dd„Zddddœd&dd„ZejeejeejeejeiZded < d'd#d$„ZdS )(é    )Úannotations)ÚTYPE_CHECKINGÚAnyÚCallableÚLiteral)Úparse_google)ÚDocstringSectionÚDocstringSectionText)Úparse_numpy)Úparse_sphinx)ÚParser)Ú	Docstring)ÚgoogleÚnumpyÚsphinxÚauto)Ú
heuristicsÚmax_sectionsr   N©ÚmethodÚstyle_orderÚdefaultÚ	docstringr   r   ÚDocstringDetectionMethodr   ú*list[Parser] | list[DocstringStyle] | Noner   úParser | DocstringStyle | NoneÚoptionsr   Úreturnú3tuple[Parser | None, list[DocstringSection] | None]c                K  sP   |rt |tƒr|dfS t|ƒdfS |r&|d }t |tƒr |dfS t|ƒdfS dS )a>  Infer the parser to use for the docstring.

    [:octicons-heart-fill-24:{ .pulse } Sponsors only](../../../insiders/index.md){ .insiders } &mdash;
    [:octicons-tag-24: Insiders 1.3.0](../../../insiders/changelog.md#1.3.0).

    The 'heuristics' method uses regular expressions. The 'max_sections' method
    parses the docstring with all parsers specified in `style_order` and returns
    the one who parsed the most sections.

    If heuristics fail, the `default` parser is returned. If multiple parsers
    parsed the same number of sections, `style_order` is used to decide which
    one to return. The `default` parser is never used with the 'max_sections' method.

    For non-Insiders versions, `default` is returned if specified, else the first
    parser in `style_order` is returned. If `style_order` is not specified,
    `None` is returned.

    Additional options are parsed to the detected parser, if any.

    Parameters:
        docstring: The docstring to parse.
        method: The method to use to infer the parser.
        style_order: The order of the styles to try when inferring the parser.
        default: The default parser to use if the inference fails.
        **options: Additional parsing options.

    Returns:
        The inferred parser, and optionally parsed sections (when method is 'max_sections').
    Nr   )NN)Ú
isinstancer   )r   r   r   r   r   Ústyle© r!   ú\/mnt/skqttb/ctump_chatbot/chatbot/lib/python3.10/site-packages/_griffe/docstrings/parsers.pyÚinfer_docstring_style    s   %r#   úlist[DocstringSection]c                K  s:   t | f|||dœ|¤Ž\}}|du rt| |fi |¤ŽS |S )aÚ  Parse a docstring by automatically detecting the style it uses.

    [:octicons-heart-fill-24:{ .pulse } Sponsors only](../../../insiders/index.md){ .insiders } &mdash;
    [:octicons-tag-24: Insiders 1.3.0](../../../insiders/changelog.md#1.3.0).

    See [`infer_docstring_style`][griffe.infer_docstring_style] for more information
    on the available parameters.

    Parameters:
        docstring: The docstring to parse.
        method: The method to use to infer the parser.
        style_order: The order of the styles to try when inferring the parser.
        default: The default parser to use if the inference fails.
        **options: Additional parsing options.

    Returns:
        A list of docstring sections.
    r   N)r#   Úparse)r   r   r   r   r   r    Úsectionsr!   r!   r"   Ú
parse_autoM   s   ÿü
ûr'   z;dict[Parser, Callable[[Docstring], list[DocstringSection]]]ÚparsersÚparserúDocstringStyle | Parser | Nonec                 K  s6   |rt |tƒst|ƒ}t| | fi |¤ŽS t| jƒgS )a  Parse the docstring.

    Parameters:
        docstring: The docstring to parse.
        parser: The docstring parser to use. If None, return a single text section.
        **options: The options accepted by the parser.

    Returns:
        A list of docstring sections.
    )r   r   r(   r	   Úvalue)r   r)   r   r!   r!   r"   r%   {   s
   
r%   )r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r$   )r   r   r)   r*   r   r   r   r$   ) Ú
__future__r   Útypingr   r   r   r   Ú_griffe.docstrings.googler   Ú_griffe.docstrings.modelsr   r	   Ú_griffe.docstrings.numpyr
   Ú_griffe.docstrings.sphinxr   Ú_griffe.enumerationsr   Ú_griffe.modelsr   r   r   r   Ú_default_style_orderÚDocstringStyler   r#   r'   r   r(   Ú__annotations__r%   r!   r!   r!   r"   Ú<module>   s8   û0û'ü