Classes
ParsedDocstring
Container for parsed docstring data.
ParsedDocstring
Container for parsed docstring data.
Methods 1
to_dict
Convert to dictionary.
to_dict
def to_dict(self) -> dict[str, Any]
Convert to dictionary.
Returns
dict[str, Any]
Internal Methods 1
__init__
__init__
def __init__(self) -> None
GoogleDocstringParser
Parse Google-style docstrings.
GoogleDocstringParser
Parse Google-style docstrings.
Methods 1
parse
Parse Google-style docstring.
parse
def parse(self, docstring: str) -> ParsedDocstring
Parse Google-style docstring.
Parameters 1
docstring |
str |
Returns
ParsedDocstring
Internal Methods 6
_split_sections
Split docstring into sections.
_split_sections
def _split_sections(self, docstring: str) -> dict[str, str]
Split docstring into sections.
Parameters 1
docstring |
str |
Returns
dict[str, str]
_parse_args_section
Parse Args section.
Format:
name (type): description
name: description
_parse_args_section
def _parse_args_section(self, section: str) -> dict[str, str]
Parse Args section.
Format:
name (type): description
name: description
Parameters 1
section |
str |
Returns
dict[str, str]
_parse_raises_section
Parse Raises section.
Format:
ExceptionType: description
_parse_raises_section
def _parse_raises_section(self, section: str) -> list[dict[str, str]]
Parse Raises section.
Format:
ExceptionType: description
Parameters 1
section |
str |
Returns
list[dict[str, str]]
_parse_examples_section
Extract code examples.
_parse_examples_section
def _parse_examples_section(self, section: str) -> list[str]
Extract code examples.
Parameters 1
section |
str |
Returns
list[str]
_parse_see_also_section
Extract cross-references.
_parse_see_also_section
def _parse_see_also_section(self, section: str) -> list[str]
Extract cross-references.
Parameters 1
section |
str |
Returns
list[str]
_parse_note_section
Extract notes or warnings.
_parse_note_section
def _parse_note_section(self, section: str) -> list[str]
Extract notes or warnings.
Parameters 1
section |
str |
Returns
list[str]
NumpyDocstringParser
Parse NumPy-style docstrings.
NumpyDocstringParser
Parse NumPy-style docstrings.
Methods 1
parse
Parse NumPy-style docstring.
parse
def parse(self, docstring: str) -> ParsedDocstring
Parse NumPy-style docstring.
Parameters 1
docstring |
str |
Returns
ParsedDocstring
Internal Methods 6
_split_sections
Split NumPy docstring into sections.
_split_sections
def _split_sections(self, docstring: str) -> dict[str, str]
Split NumPy docstring into sections.
Parameters 1
docstring |
str |
Returns
dict[str, str]
_parse_parameters_section
Parse Parameters section.
Format:
name : type
description
_parse_parameters_section
def _parse_parameters_section(self, section: str) -> dict[str, str]
Parse Parameters section.
Format:
name : type
description
Parameters 1
section |
str |
Returns
dict[str, str]
_parse_raises_section
Parse Raises section (similar to Parameters).
_parse_raises_section
def _parse_raises_section(self, section: str) -> list[dict[str, str]]
Parse Raises section (similar to Parameters).
Parameters 1
section |
str |
Returns
list[dict[str, str]]
_parse_examples_section
Extract examples (usually code blocks).
_parse_examples_section
def _parse_examples_section(self, section: str) -> list[str]
Extract examples (usually code blocks).
Parameters 1
section |
str |
Returns
list[str]
_parse_see_also_section
Extract cross-references.
_parse_see_also_section
def _parse_see_also_section(self, section: str) -> list[str]
Extract cross-references.
Parameters 1
section |
str |
Returns
list[str]
_parse_note_section
Extract notes.
_parse_note_section
def _parse_note_section(self, section: str) -> list[str]
Extract notes.
Parameters 1
section |
str |
Returns
list[str]
SphinxDocstringParser
Parse Sphinx-style docstrings.
SphinxDocstringParser
Parse Sphinx-style docstrings.
Methods 1
parse
Parse Sphinx-style docstring.
parse
def parse(self, docstring: str) -> ParsedDocstring
Parse Sphinx-style docstring.
Parameters 1
docstring |
str |
Returns
ParsedDocstring
Functions
parse_docstring
Parse docstring and extract structured information.
parse_docstring
def parse_docstring(docstring: str | None, style: str = 'auto') -> ParsedDocstring
Parse docstring and extract structured information.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
docstring |
str | None |
— | Raw docstring text |
style |
str |
'auto' |
Docstring style ('auto', 'google', 'numpy', 'sphinx') |
Returns
ParsedDocstring object with extracted informationParsedDocstring
—
detect_docstring_style
Auto-detect docstring style.
detect_docstring_style
def detect_docstring_style(docstring: str) -> str
Auto-detect docstring style.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
docstring |
str |
— | Raw docstring text |
Returns
Style name ('google', 'numpy', 'sphinx', or 'plain')str
—