mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #7621 from tk0miya/refactor_autodoc
refactor: autodoc: if-block for callable object is no longer needed
This commit is contained in:
commit
6ce265dc81
@ -1045,16 +1045,6 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ
|
|||||||
# cannot introspect arguments of a C function or method
|
# cannot introspect arguments of a C function or method
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
if (not inspect.isfunction(unwrapped) and
|
|
||||||
not inspect.ismethod(unwrapped) and
|
|
||||||
not inspect.isbuiltin(unwrapped) and
|
|
||||||
not inspect.is_cython_function_or_method(unwrapped) and
|
|
||||||
not inspect.isclass(unwrapped) and
|
|
||||||
hasattr(unwrapped, '__call__')):
|
|
||||||
self.env.app.emit('autodoc-before-process-signature',
|
|
||||||
unwrapped.__call__, False)
|
|
||||||
sig = inspect.signature(unwrapped.__call__)
|
|
||||||
else:
|
|
||||||
self.env.app.emit('autodoc-before-process-signature', unwrapped, False)
|
self.env.app.emit('autodoc-before-process-signature', unwrapped, False)
|
||||||
sig = inspect.signature(unwrapped)
|
sig = inspect.signature(unwrapped)
|
||||||
args = stringify_signature(sig, **kwargs)
|
args = stringify_signature(sig, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user