mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Use __init__ type hints in "description" mode
Previously, `__init__` type hints were not used when documenting a class using `autodoc_typehints="description"`. This was done to prevent documentation for parameters from showing up twice, both for the class and the `__init__` special method. As the new ``autodoc_typehint_undoc`` option provides a better way to prevent this bad behavior by placing the user in control of where the type hints are added, it is now safe to add type hints for documented `__init__` parameters. Closes #8178
This commit is contained in:
committed by
Matt Wozniski
parent
4785f32ddf
commit
be2cee53a1
@@ -42,8 +42,6 @@ def merge_typehints(app: Sphinx, domain: str, objtype: str, contentnode: Element
|
||||
return
|
||||
if app.config.autodoc_typehints != 'description':
|
||||
return
|
||||
if objtype == 'class' and app.config.autoclass_content not in ('init', 'both'):
|
||||
return
|
||||
|
||||
try:
|
||||
signature = cast(addnodes.desc_signature, contentnode.parent[0])
|
||||
|
||||
Reference in New Issue
Block a user