class documentation

class NumpyDocstring(GoogleDocstring):

View In Hierarchy

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 No summary
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=True, prefer_type=False, allow_free_form=False, **kwargs):
Parameters
parse​_type:boolUndocumented
prefer​_type:boolUndocumented
allow​_free​_form:boolUndocumented
**kwargs:AnyUndocumented
Returns
FieldUndocumented
Raises
FreeFormExceptionIf allow_free_form=True and the type do not match is_type check. See _convert_type_and_maybe_consume_free_form_field.
def _consume_fields(self, parse_type=True, prefer_type=False, multiple=False, **kwargs):

Undocumented

Parameters
parse​_type:boolUndocumented
prefer​_type:boolUndocumented
multiple:boolUndocumented
**kwargs:AnyUndocumented
Returns
List[Field]Undocumented
def _consume_returns_section(self):

Undocumented

Returns
List[Field]Undocumented
def _consume_section_header(self):

Undocumented

Returns
strUndocumented
def _convert_type_and_maybe_consume_free_form_field(self, _name, _type, allow_free_form=False):
Same as _convert_type, but can raise FreeFormException.
Parameters
​_name:strUndocumented
​_type:strUndocumented
allow​_free​_form:boolUndocumented
Returns
strUndocumented
Raises
FreeFormExceptionIf allow_free_form=True and _type do not match is_type check.
def _escape_args_and_kwargs(self, name):

Undocumented

Parameters
name:strUndocumented
Returns
strUndocumented
def _is_section_break(self):

Undocumented

Returns
boolUndocumented
def _is_section_header(self):

Undocumented

Returns
boolUndocumented
def _parse_numpydoc_see_also_section(self, content):

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
Parameters
content:List[str]Undocumented
Returns
List[str]Undocumented
def _parse_see_also_section(self, section):

Undocumented

Parameters
section:strUndocumented
Returns
List[str]Undocumented