diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-10-04 17:47:06 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-10-24 20:54:56 +0900 |
commit | cc97a076407d20a495f95c1b2dfa996d629d5452 (patch) | |
tree | 7fadeaf32074d63e8b8ea5222f9634a678be5737 /sphinx | |
parent | 3b85187ffa3401e88582073c23188c147857a8a3 (diff) | |
download | sphinx-git-cc97a076407d20a495f95c1b2dfa996d629d5452.tar.gz |
Fix #7785: autodoc_typehints=none does not effect to overloads
Diffstat (limited to 'sphinx')
-rw-r--r-- | sphinx/ext/autodoc/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 978fd5df8..7343d41b6 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1240,7 +1240,9 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ def format_signature(self, **kwargs: Any) -> str: sigs = [] - if self.analyzer and '.'.join(self.objpath) in self.analyzer.overloads: + if (self.analyzer and + '.'.join(self.objpath) in self.analyzer.overloads and + self.env.config.autodoc_typehints == 'signature'): # Use signatures for overloaded functions instead of the implementation function. overloaded = True else: @@ -1474,7 +1476,7 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type: sigs = [] overloads = self.get_overloaded_signatures() - if overloads: + if overloads and self.env.config.autodoc_typehints == 'signature': # Use signatures for overloaded methods instead of the implementation method. method = safe_getattr(self._signature_class, self._signature_method_name, None) __globals__ = safe_getattr(method, '__globals__', {}) @@ -1882,7 +1884,9 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type: def format_signature(self, **kwargs: Any) -> str: sigs = [] - if self.analyzer and '.'.join(self.objpath) in self.analyzer.overloads: + if (self.analyzer and + '.'.join(self.objpath) in self.analyzer.overloads and + self.env.config.autodoc_typehints == 'signature'): # Use signatures for overloaded methods instead of the implementation method. overloaded = True else: |