class documentation

Convert NumPy style docstrings to reStructuredText.

Example

>>> from pydoctor.napoleon import NumpyDocstring
>>> docstring = '''One line summary.
...
... Extended description.
...
... Parameters
... ----------
... arg1 : int
...     Description of `arg1`
... arg2 : str
...     Description of `arg2`
... Returns
... -------
... str
...     Description of return value.
... '''
>>> print(NumpyDocstring(docstring))
One line summary.

Extended description.

:param arg1: Description of `arg1`
:type arg1: int
:param arg2: Description of `arg2`
:type arg2: str

:returns: Description of return value.
:returntype: str
>>> print(NumpyDocstring(docstring, process_type_fields=True))
One line summary.

Extended description.

:param arg1: Description of `arg1`
:type arg1: `int`
:param arg2: Description of `arg2`
:type arg2: `str`

:returns: Description of return value.
:returntype: `str`
Method _consume_field No summary
Method _consume_fields Undocumented
Method _consume_returns_section Undocumented
Method _consume_section_header Undocumented
Method _convert_type_and_maybe_consume_free_form_field Same as _convert_type, but can raise FreeFormException.
Method _escape_args_and_kwargs Undocumented
Method _is_section_break Undocumented
Method _is_section_header Undocumented
Method _parse_numpydoc_see_also_section Derived from the NumpyDoc implementation of _parse_see_also.
Method _parse_see_also_section Undocumented

Inherited from GoogleDocstring:

Method __init__ No summary
Method __str__ Return the parsed docstring in reStructuredText format.
Method lines Return the parsed lines of the docstring in reStructuredText format.
Instance Variable warnings Warning messages triggered during the conversion.
Method _consume_contiguous Undocumented
Method _consume_empty Undocumented
Method _consume_indented_block Undocumented
Method _consume_inline_attribute Undocumented
Method _consume_to_end Undocumented
Method _consume_to_next_section Undocumented
Method _convert_type Tokenize the string type and convert it with additional markup and auto linking, with L{TypeDocstring}.
Method _dedent Undocumented
Method _fix_field_desc Undocumented
Method _format_admonition Undocumented
Method _format_block Undocumented
Method _format_docutils_params Undocumented
Method _format_field Undocumented
Method _format_fields Undocumented
Method _get_current_indent Undocumented
Method _get_indent Undocumented
Method _get_initial_indent Undocumented
Method _get_min_indent Undocumented
Method _indent Undocumented
Method _is_indented Undocumented
Method _is_list Undocumented
Method _parse Undocumented
Method _parse_admonition Undocumented
Method _parse_attribute_docstring Undocumented
Method _parse_attributes_section Undocumented
Method _parse_examples_section Undocumented
Method _parse_generic_section Undocumented
Method _parse_keyword_arguments_section Undocumented
Method _parse_methods_section Undocumented
Method _parse_notes_section Undocumented
Method _parse_parameters_section Undocumented
Method _parse_raises_section Undocumented
Method _parse_references_section Undocumented
Method _parse_returns_section Undocumented
Method _parse_warns_section Undocumented
Method _partition_field_on_colon Undocumented
Method _partition_multiline_field_on_colon Partition multiple lines on colon. If the type or name span multiple lines, they will be automatically joined.
Method _strip_empty Undocumented
Class Variable _name_rgx Undocumented
Instance Variable _is_attribute Undocumented
Instance Variable _is_in_section Undocumented
Instance Variable _line_iter Undocumented
Instance Variable _parsed_lines Undocumented
Instance Variable _process_type_fields Undocumented
Instance Variable _section_indent Undocumented
Instance Variable _sections Undocumented
def _consume_field(self, parse_type: bool = True, prefer_type: bool = False, allow_free_form: bool = False, **kwargs: Any) -> Field: (source)
def _consume_fields(self, parse_type: bool = True, prefer_type: bool = False, multiple: bool = False, **kwargs: Any) -> list[Field]: (source)
def _consume_returns_section(self) -> list[Field]: (source)
def _consume_section_header(self) -> str: (source)
def _convert_type_and_maybe_consume_free_form_field(self, _name: str, _type: str, allow_free_form: bool = False) -> str: (source)

Same as _convert_type, but can raise FreeFormException.

Raises
FreeFormExceptionIf allow_free_form=True and _type do not match is_type check.
def _escape_args_and_kwargs(self, name: str) -> str: (source)
def _is_section_break(self) -> bool: (source)
def _is_section_header(self) -> bool: (source)
def _parse_numpydoc_see_also_section(self, content: list[str]) -> list[str]: (source)

Derived from the NumpyDoc implementation of _parse_see_also.

Parses this kind of see also sections:

See Also
--------
func_name : Descriptive text
    continued text
another_func_name : Descriptive text
func_name1, func_name2, `func_name`, func_name3
def _parse_see_also_section(self, section: str) -> list[str]: (source)