Skip to content

Commit 4c89a82

Browse files
authored
Improve signature handling in autodoc (#13955)
1 parent f224e04 commit 4c89a82

File tree

10 files changed

+744
-755
lines changed

10 files changed

+744
-755
lines changed

doc/development/tutorials/examples/autodoc_intenum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def can_document_member(
3030
except TypeError:
3131
return False
3232

33-
def add_directive_header(self, sig: str) -> None:
34-
super().add_directive_header(sig)
33+
def add_directive_header(self) -> None:
34+
super().add_directive_header()
3535
self.add_line(' :final:', self.get_sourcename())
3636

3737
def add_content(

doc/usage/extensions/autodoc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ autodoc provides the following additional events:
14111411
``'(parameter_1, parameter_2)'``, or ``None`` if introspection didn't
14121412
succeed and signature wasn't specified in the directive.
14131413
:param return_annotation: function return annotation as a string of the form
1414-
``' -> annotation'``, or ``None`` if there is no return annotation
1414+
``'annotation'``, or ``''`` if there is no return annotation.
14151415

14161416
The :mod:`sphinx.ext.autodoc` module provides factory functions for commonly
14171417
needed docstring processing in event :event:`autodoc-process-docstring`:

sphinx/ext/autodoc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
PropertyDocumenter,
4040
TypeAliasDocumenter,
4141
autodoc_attrgetter,
42-
py_ext_sig_re,
4342
)
4443
from sphinx.ext.autodoc._event_listeners import between, cut_lines
4544
from sphinx.ext.autodoc._member_finder import ObjectMember, special_member_re
@@ -50,6 +49,7 @@
5049
from sphinx.ext.autodoc._sentinels import (
5150
SLOTS_ATTR as SLOTSATTR,
5251
)
52+
from sphinx.ext.autodoc.importer import py_ext_sig_re
5353

5454
if TYPE_CHECKING:
5555
from sphinx.application import Sphinx

0 commit comments

Comments
 (0)