mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #9665 from tk0miya/9664_autodoc_process_bases_injection
Close #9664: autodoc: autodoc-process-bases supports reST snippet
This commit is contained in:
commit
de59a72fe6
2
CHANGES
2
CHANGES
@ -14,6 +14,8 @@ Features added
|
|||||||
--------------
|
--------------
|
||||||
|
|
||||||
* #9639: autodoc: Support asynchronous generator functions
|
* #9639: autodoc: Support asynchronous generator functions
|
||||||
|
* #9664: autodoc: ``autodoc-process-bases`` supports to inject reST snippet as a
|
||||||
|
base class
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -768,8 +768,6 @@ needed docstring processing in event :event:`autodoc-process-docstring`:
|
|||||||
|
|
||||||
.. event:: autodoc-process-bases (app, name, obj, options, bases)
|
.. event:: autodoc-process-bases (app, name, obj, options, bases)
|
||||||
|
|
||||||
.. versionadded:: 4.1
|
|
||||||
|
|
||||||
Emitted when autodoc has read and processed a class to determine the
|
Emitted when autodoc has read and processed a class to determine the
|
||||||
base-classes. *bases* is a list of classes that the event handler can
|
base-classes. *bases* is a list of classes that the event handler can
|
||||||
modify **in place** to change what Sphinx puts into the output. It's
|
modify **in place** to change what Sphinx puts into the output. It's
|
||||||
@ -781,6 +779,12 @@ needed docstring processing in event :event:`autodoc-process-docstring`:
|
|||||||
:param options: the options given to the class directive
|
:param options: the options given to the class directive
|
||||||
:param bases: the list of base classes signature. see above.
|
:param bases: the list of base classes signature. see above.
|
||||||
|
|
||||||
|
.. versionadded:: 4.1
|
||||||
|
.. versionchanged:: 4.3
|
||||||
|
|
||||||
|
``bases`` can contain a string as a base class name. It will be processed
|
||||||
|
as reST mark-up'ed text.
|
||||||
|
|
||||||
|
|
||||||
Skipping members
|
Skipping members
|
||||||
----------------
|
----------------
|
||||||
|
@ -113,6 +113,8 @@ def restify(cls: Optional[Type]) -> str:
|
|||||||
return ':py:obj:`None`'
|
return ':py:obj:`None`'
|
||||||
elif cls is Ellipsis:
|
elif cls is Ellipsis:
|
||||||
return '...'
|
return '...'
|
||||||
|
elif isinstance(cls, str):
|
||||||
|
return cls
|
||||||
elif cls in INVALID_BUILTIN_CLASSES:
|
elif cls in INVALID_BUILTIN_CLASSES:
|
||||||
return ':py:class:`%s`' % INVALID_BUILTIN_CLASSES[cls]
|
return ':py:class:`%s`' % INVALID_BUILTIN_CLASSES[cls]
|
||||||
elif inspect.isNewType(cls):
|
elif inspect.isNewType(cls):
|
||||||
|
@ -48,6 +48,7 @@ def test_restify():
|
|||||||
assert restify(Struct) == ":py:class:`struct.Struct`"
|
assert restify(Struct) == ":py:class:`struct.Struct`"
|
||||||
assert restify(TracebackType) == ":py:class:`types.TracebackType`"
|
assert restify(TracebackType) == ":py:class:`types.TracebackType`"
|
||||||
assert restify(Any) == ":py:obj:`~typing.Any`"
|
assert restify(Any) == ":py:obj:`~typing.Any`"
|
||||||
|
assert restify('str') == "str"
|
||||||
|
|
||||||
|
|
||||||
def test_restify_type_hints_containers():
|
def test_restify_type_hints_containers():
|
||||||
|
Loading…
Reference in New Issue
Block a user