forked from sphinx-doc/sphinx
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix sphinx-doc#9648: autodoc: *args and **kwargs entries are duplicated
In basic usage of autodoc (docstring), `args` and `kwargs` arguments are marked up without stars. But numpydoc style recommends to mark them up with stars. This adds support for starred arguments in docstrings to `autodoc_typehints` feature.
- Loading branch information
Showing
8 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath('.')) | ||
extensions = ['sphinx.ext.napoleon'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
test-ext-napoleon | ||
================= | ||
|
||
.. toctree:: | ||
|
||
typehints |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
def hello(x: int, *args: int, **kwargs: int) -> None: | ||
""" | ||
Parameters | ||
---------- | ||
x | ||
X | ||
*args | ||
Additional arguments. | ||
**kwargs | ||
Extra arguments. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
typehints | ||
========= | ||
|
||
.. automodule:: mypackage.typehints | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters