diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py index 0e0af470..c41b98fe 100644 --- a/numpydoc/docscrape.py +++ b/numpydoc/docscrape.py @@ -206,7 +206,7 @@ def _read_to_next_section(self): section += self._doc.read_to_next_empty_line() - return section + return dedent_lines(section) def _read_sections(self): while not self._doc.eof(): @@ -570,6 +570,8 @@ def __str__(self, func_role=""): def dedent_lines(lines): """Deindent a list of lines maximally""" + if not lines: + return lines return textwrap.dedent("\n".join(lines)).split("\n")