
    -h                    :   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Z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!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   return3tuple[Parser | None, list[DocstringSection] | None]c                   |r(t          |t                    r|nt          |          dfS |r0|d         }t          |t                    r|n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   styles         W/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/_griffe/docstrings/parsers.pyinfer_docstring_styler$       sm    J  Q$Wf55Jww6'??DPP KA"5&11Duuve}}dJJ:    list[DocstringSection]c               N    t          | f|||d|\  }}|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   )r$   parse)r   r   r   r   r   r"   sectionss          r#   
parse_autor*   M   s\    4 ,	 
  OE8 Y11111Or%   z;dict[Parser, Callable[[Docstring], list[DocstringSection]]]parsersparserDocstringStyle | Parser | Nonec                    |r7t          |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   s      r#   r(   r(   {   sV      5&&)) 	$F^^Fvy44G444 1122r%   )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#   <module>r<      s   # " " " " " " 8 8 8 8 8 8 8 8 8 8 8 8 2 2 2 2 2 2 L L L L L L L L 0 0 0 0 0 0 2 2 2 2 2 2 ' ' ' ' ' ' )(((((( v}flC  <= P"#?@  6 (4>B.2* * * * * *` (4>B.2# # # # # #N K
M<
M<
L+	H    3 3 3 3 3 3r%   