← All challenges
mediumsphinx-doc/sphinx · v4.0

napoleon_use_param should also affect "other parameters" section

Try this bug with AI

Fix it in the original repo with an AI agent and get feedback on how you worked.

2 free rounds each week

Round mode
  • Time limit60 min
  • Token budgetup to 1M
  • Worth up to210 XP
Sign up or sign in to start

Read the sample report

From a simulated Django round

You changed code before reproducing the bug.

Run the failing test before the first edit, so you know the failure you are fixing and can tell when it is gone.

Problem statement

Subject: napoleon_use_param should also affect "other parameters" section

Problem

Currently, napoleon always renders the Other parameters section as if napoleon_use_param was False, see source

    def _parse_other_parameters_section(self, section):
        # type: (unicode) -> List[unicode]
        return self._format_fields(_('Other Parameters'), self._consume_fields())

    def _parse_parameters_section(self, section):
        # type: (unicode) -> List[unicode]
        fields = self._consume_fields()
        if self._config.napoleon_use_param:
            return self._format_docutils_params(fields)
        else:
            return self._format_fields(_('Parameters'), fields)

whereas it would make sense that this section should follow the same formatting rules as the Parameters section.

Procedure to reproduce the problem

In [5]: print(str(sphinx.ext.napoleon.NumpyDocstring("""\ 
   ...: Parameters 
   ...: ---------- 
   ...: x : int 
   ...:  
   ...: Other parameters 
   ...: ---------------- 
   ...: y: float 
   ...: """)))                                                                                                                                                                                      
:param x:
:type x: int

:Other Parameters: **y** (*float*)

Note the difference in rendering.

Error logs / results

See above.

Expected results

:param x:
:type x: int

:Other Parameters:  // Or some other kind of heading.
:param: y
:type y: float

Alternatively another separate config value could be introduced, but that seems a bit overkill.

Reproducible project / your project

N/A

Environment info

  • OS: Linux
  • Python version: 3.7
  • Sphinx version: 1.8.1
The environment starts at commit 3ed7590ed411 (sphinx-doc/sphinx 4.0), dependencies installed and tests runnable from the first minute. You are graded by hidden tests taken from the fix that was actually merged upstream.