Skip to content

Commit

Permalink
BUG, DOC: Fix heading remap in scipy-optimize directive.
Browse files Browse the repository at this point in the history
Fixes a bug that replaces the Returns heading with an
incorrect heading size in the generated docstring. This will
cause warnings (treated as errors) with numpydoc 1.2.
  • Loading branch information
rossbar committed Mar 25, 2022
1 parent 45549b6 commit a2a9a67
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions doc/source/scipyoptdoc.py
Expand Up @@ -135,10 +135,12 @@ def remove_arg(arg):
# Change "Options" to "Other Parameters", run numpydoc, reset
new_lines = []
for line in lines:
# Remap Options to the "Other Parameters" numpydoc section
# along with correct heading length
if line.strip() == 'Options':
line = "Other Parameters"
elif line.strip() == "-"*len('Options'):
line = "-"*len("Other Parameters")
new_lines.extend([line, "-"*len(line)])
continue
new_lines.append(line)
# use impl_name instead of name here to avoid duplicate refs
mangle_docstrings(env.app, 'function', impl_name,
Expand Down

0 comments on commit a2a9a67

Please sign in to comment.