mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #7690 from keewis/transform_numpy_parameter_types
preprocessing numpy types
This commit is contained in:
@@ -274,11 +274,12 @@ sure that "sphinx.ext.napoleon" is enabled in `conf.py`::
|
||||
napoleon_use_ivar = False
|
||||
napoleon_use_param = True
|
||||
napoleon_use_rtype = True
|
||||
napoleon_type_aliases = None
|
||||
|
||||
.. _Google style:
|
||||
https://google.github.io/styleguide/pyguide.html
|
||||
.. _NumPy style:
|
||||
https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
|
||||
https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard
|
||||
|
||||
.. confval:: napoleon_google_docstring
|
||||
|
||||
@@ -435,7 +436,7 @@ sure that "sphinx.ext.napoleon" is enabled in `conf.py`::
|
||||
:param arg1: Description of `arg1`
|
||||
:type arg1: str
|
||||
:param arg2: Description of `arg2`, defaults to 0
|
||||
:type arg2: int, optional
|
||||
:type arg2: :class:`int`, *optional*
|
||||
|
||||
**If False**::
|
||||
|
||||
@@ -480,3 +481,31 @@ sure that "sphinx.ext.napoleon" is enabled in `conf.py`::
|
||||
**If False**::
|
||||
|
||||
:returns: *bool* -- True if successful, False otherwise
|
||||
|
||||
.. confval:: napoleon_type_aliases
|
||||
|
||||
A mapping to translate type names to other names or references. Works
|
||||
only when ``napoleon_use_param = True``. *Defaults to None.*
|
||||
|
||||
With::
|
||||
|
||||
napoleon_type_aliases = {
|
||||
"CustomType": "mypackage.CustomType",
|
||||
"dict-like": ":term:`dict-like <mapping>`",
|
||||
}
|
||||
|
||||
This `NumPy style`_ snippet::
|
||||
|
||||
Parameters
|
||||
----------
|
||||
arg1 : CustomType
|
||||
Description of `arg1`
|
||||
arg2 : dict-like
|
||||
Description of `arg2`
|
||||
|
||||
becomes::
|
||||
|
||||
:param arg1: Description of `arg1`
|
||||
:type arg1: mypackage.CustomType
|
||||
:param arg2: Description of `arg2`
|
||||
:type arg2: :term:`dict-like <mapping>`
|
||||
|
||||
Reference in New Issue
Block a user