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: of my_module.func_name:12: WARNING: Field list ends without a blank line; unexpected unindent.


def func_name():
    """Short Desc.

    return_name : return_type
        Description of return value.

    >>> 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