class documentation
class NumpyDocstring(GoogleDocstring): (source)
Constructor: NumpyDocstring(docstring, what, process_type_fields)
Convert NumPy style docstrings to reStructuredText.
Example
>>> 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. <BLANKLINE> Extended description. <BLANKLINE> :param arg1: Description of `arg1` :type arg1: int :param arg2: Description of `arg2` :type arg2: str <BLANKLINE> :returns: Description of return value. :returntype: str >>> print(NumpyDocstring(docstring, process_type_fields=True)) One line summary. <BLANKLINE> Extended description. <BLANKLINE> :param arg1: Description of `arg1` :type arg1: `int` :param arg2: Description of `arg2` :type arg2: `str` <BLANKLINE> :returns: Description of return value. :returntype: `str`
| Method | _consume |
No summary |
| Method | _consume |
Undocumented |
| Method | _consume |
Undocumented |
| Method | _consume |
Undocumented |
| Method | _convert |
Same as _convert_type, but can raise FreeFormException. |
| Method | _escape |
Undocumented |
| Method | _is |
Undocumented |
| Method | _is |
Undocumented |
| Method | _parse |
Derived from the NumpyDoc implementation of _parse_see_also. |
| Method | _parse |
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 |
Undocumented |
| Method | _consume |
Undocumented |
| Method | _consume |
Undocumented |
| Method | _consume |
Undocumented |
| Method | _consume |
Undocumented |
| Method | _consume |
Undocumented |
| Method | _convert |
Tokenize the string type and convert it with additional markup and auto linking, with L{TypeDocstring}. |
| Method | _dedent |
Undocumented |
| Method | _fix |
Undocumented |
| Method | _format |
Undocumented |
| Method | _format |
Undocumented |
| Method | _format |
Undocumented |
| Method | _format |
Undocumented |
| Method | _format |
Undocumented |
| Method | _get |
Undocumented |
| Method | _get |
Undocumented |
| Method | _get |
Undocumented |
| Method | _get |
Undocumented |
| Method | _indent |
Undocumented |
| Method | _is |
Undocumented |
| Method | _is |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _parse |
Undocumented |
| Method | _partition |
Undocumented |
| Method | _partition |
Partition multiple lines on colon. If the type or name span multiple lines, they will be automatically joined. |
| Method | _strip |
Undocumented |
| Class Variable | _name |
Undocumented |
| Instance Variable | _is |
Undocumented |
| Instance Variable | _line |
Undocumented |
| Instance Variable | _parsed |
Undocumented |
| Instance Variable | _process |
Undocumented |
| Instance Variable | _section |
Undocumented |
| Instance Variable | _sections |
Undocumented |
| Instance Variable | _what |
Undocumented |
def _consume_field(self, parse_type:
bool = True, prefer_type: bool = False, allow_free_form: bool = False, **kwargs: Any) -> Field:
(source)
¶
| Raises | |
FreeFormException | If 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:
bool = True, prefer_type: bool = False, multiple: bool = False, **kwargs: Any) -> list[ Field]:
(source)
¶
Undocumented
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 | |
FreeFormException | If allow_free_form=True and _type do not match is_type check. |