Skip to content

Commit

Permalink
Use __init__ type hints in "description" mode
Browse files Browse the repository at this point in the history
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, but that will no
longer occur now that parameter and return types are only inserted if
the parameter or return has a description.

Closes sphinx-doc#8178
  • Loading branch information
godlygeek committed Dec 15, 2020
1 parent 0d83593 commit e43ac86
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions sphinx/ext/autodoc/typehints.py
Expand Up @@ -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])
Expand Down

0 comments on commit e43ac86

Please sign in to comment.