mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Remove unnecessary conditional import in `sphinx.ext.napoleon
` (#11043)
The conditional import could have been useful for the external sphinxcontrib.napoleon (to keep backcompat with older versions of sphinx), but seems just confusing for a builtin extension.
This commit is contained in:
parent
45a0ea9fc9
commit
da25145d08
@ -324,22 +324,17 @@ def setup(app: Sphinx) -> Dict[str, Any]:
|
|||||||
|
|
||||||
|
|
||||||
def _patch_python_domain() -> None:
|
def _patch_python_domain() -> None:
|
||||||
try:
|
from sphinx.domains.python import PyObject, PyTypedField
|
||||||
from sphinx.domains.python import PyTypedField
|
from sphinx.locale import _
|
||||||
except ImportError:
|
for doc_field in PyObject.doc_field_types:
|
||||||
pass
|
if doc_field.name == 'parameter':
|
||||||
else:
|
doc_field.names = ('param', 'parameter', 'arg', 'argument')
|
||||||
import sphinx.domains.python
|
break
|
||||||
from sphinx.locale import _
|
PyObject.doc_field_types.append(
|
||||||
for doc_field in sphinx.domains.python.PyObject.doc_field_types:
|
PyTypedField('keyword', label=_('Keyword Arguments'),
|
||||||
if doc_field.name == 'parameter':
|
names=('keyword', 'kwarg', 'kwparam'),
|
||||||
doc_field.names = ('param', 'parameter', 'arg', 'argument')
|
typerolename='obj', typenames=('paramtype', 'kwtype'),
|
||||||
break
|
can_collapse=True))
|
||||||
sphinx.domains.python.PyObject.doc_field_types.append(
|
|
||||||
PyTypedField('keyword', label=_('Keyword Arguments'),
|
|
||||||
names=('keyword', 'kwarg', 'kwparam'),
|
|
||||||
typerolename='obj', typenames=('paramtype', 'kwtype'),
|
|
||||||
can_collapse=True))
|
|
||||||
|
|
||||||
|
|
||||||
def _process_docstring(app: Sphinx, what: str, name: str, obj: Any,
|
def _process_docstring(app: Sphinx, what: str, name: str, obj: Any,
|
||||||
|
Loading…
Reference in New Issue
Block a user