diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-04-09 01:15:21 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-04-09 01:15:21 +0900 |
commit | 0525c39b9e3b6a4a54cc55ba76fd42d56687d91e (patch) | |
tree | 8fa1a448f4034f53b4277af9ad9b26bf32bf4d51 | |
parent | 4caa7d7c379025052da8774a648dccf29426d5f0 (diff) | |
download | sphinx-git-0525c39b9e3b6a4a54cc55ba76fd42d56687d91e.tar.gz |
Fix #7435: autodoc_typehints doesn't suppress typehints for classes/methods
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | sphinx/ext/autodoc/__init__.py | 4 |
2 files changed, 4 insertions, 2 deletions
@@ -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 -------- diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index ad3e5f00a..f69e2b5f1 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1174,7 +1174,7 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type: 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 @@ -1430,7 +1430,7 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type: 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) |