Skip to content

google ¤

This module defines functions to parse Google-style docstrings into structured data.

Functions:

  • parse

    Parse a Google-style docstring.

parse ¤

parse(
    docstring: Docstring,
    *,
    ignore_init_summary: bool = False,
    trim_doctest_flags: bool = True,
    returns_multiple_items: bool = True,
    warn_unknown_params: bool = True,
    returns_named_value: bool = True,
    returns_type_in_property_summary: bool = False,
    **options: Any
) -> list[DocstringSection]

Parse a Google-style docstring.

This function iterates on lines of a docstring to build sections. It then returns this list of sections.

Parameters:

  • docstring (Docstring) –

    The docstring to parse.

  • ignore_init_summary (bool, default: False ) –

    Whether to ignore the summary in __init__ methods' docstrings.

  • trim_doctest_flags (bool, default: True ) –

    Whether to remove doctest flags from Python example blocks.

  • returns_multiple_items (bool, default: True ) –

    Whether the Returns section has multiple items.

  • warn_unknown_params (bool, default: True ) –

    Warn about documented parameters not appearing in the signature.

  • returns_named_value (bool, default: True ) –

    Whether to parse thing: Description in returns sections as a name and description, rather than a type and description. When true, type must be wrapped in parentheses: (int): Description.. When false, parentheses are optional but the items cannot be named: int: Description.

  • returns_type_in_property_summary (bool, default: False ) –

    Whether to parse the return type of properties at the beginning of their summary: str: Summary of the property.

  • **options (Any, default: {} ) –

    Additional parsing options.

Returns: