Skip to content

Commit

Permalink
Fix sphinx-doc#7435: autodoc_typehints doesn't suppress typehints for…
Browse files Browse the repository at this point in the history
… classes/methods
  • Loading branch information
tk0miya committed Apr 8, 2020
1 parent 4caa7d7 commit 0525c39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -17,6 +17,8 @@ Bugs fixed
----------

* #7428: py domain: a reference to class ``None`` emits a nitpicky warning
* #7435: autodoc: ``autodoc_typehints='description'`` doesn't suppress typehints
in signature for classes/methods

Testing
--------
Expand Down
4 changes: 2 additions & 2 deletions sphinx/ext/autodoc/__init__.py
Expand Up @@ -1174,7 +1174,7 @@ def import_object(self) -> Any:
return ret

def format_args(self, **kwargs: Any) -> str:
if self.env.config.autodoc_typehints == 'none':
if self.env.config.autodoc_typehints in ('none', 'description'):
kwargs.setdefault('show_annotation', False)

# for classes, the relevant signature is the __init__ method's
Expand Down Expand Up @@ -1430,7 +1430,7 @@ def import_object(self) -> Any:
return ret

def format_args(self, **kwargs: Any) -> str:
if self.env.config.autodoc_typehints == 'none':
if self.env.config.autodoc_typehints in ('none', 'description'):
kwargs.setdefault('show_annotation', False)

unwrapped = inspect.unwrap(self.object)
Expand Down

0 comments on commit 0525c39

Please sign in to comment.