mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-26 07:00:14 -05:00
Fix #7435: autodoc_typehints doesn't suppress typehints for classes/methods
This commit is contained in:
1 parent
4caa7d7c37
commit
0525c39b9e
2 files changed
+4
-2
No files matched your search
@@ -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
|
||||
--------
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user