Issues

Issue #1436 resolved

Napoleon causes docutils warnings on NumPy docstrings' Returns section with consecutive sections

Torbjörn Klatt
created an issue

In case a Return(s) section of a NumPy docstring is followed by another section (e.g. Examples), and the last return parameter documented has a return type specified, Napoleon fails adding an empty line between the :rtype: ... line and the next section heading (e.g. Examples).

This causes docutils to trigger a warning:

my_module.py:docstring of my_module.func_name:12: WARNING: Field list ends without a blank line; unexpected unindent.

Example

def func_name():
    """Short Desc.

    Returns
    -------
    return_name : return_type
        Description of return value.

    Examples
    --------
    >>> func_name()
    """
    return return_value

gets converted into:

.. py:function:: func_name()
   :module: my_module

   Short Desc.

   :returns: **return_name** --
             Description of return value.

   :rtype: return_type
   .. admonition:: Examples

      >>> func_name()

Comments (2)

  1. Log in to comment