Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@
('js:func', 'number'),
('js:func', 'string'),
('py:attr', 'srcline'),
# sphinx.application.Sphinx.connect
('py:class', '_AutodocProcessDocstringListener'),
# sphinx.application.Sphinx.connect
('py:class', '_AutodocProcessSignatureListener'),
('py:class', '_AutodocSkipMemberListener'), # sphinx.application.Sphinx.connect
('py:class', '_ConfigRebuild'), # sphinx.application.Sphinx.add_config_value
# sphinx.application.Sphinx.add_html_math_renderer
('py:class', '_MathsBlockRenderers'),
Expand Down
35 changes: 7 additions & 28 deletions sphinx/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@
from sphinx.domains import Domain, Index
from sphinx.environment.collectors import EnvironmentCollector
from sphinx.ext.autodoc._documenters import Documenter
from sphinx.ext.autodoc._event_listeners import _AutodocProcessDocstringListener
from sphinx.ext.autodoc._event_listeners import (
_AutodocProcessDocstringListener,
_AutodocProcessSignatureListener,
_AutodocSkipMemberListener,
)
from sphinx.ext.todo import todo_node
from sphinx.extension import Extension
from sphinx.registry import (
Expand Down Expand Up @@ -725,20 +729,7 @@ def connect(
def connect(
self,
event: Literal['autodoc-process-signature'],
callback: Callable[
[
Sphinx,
Literal[
'module', 'class', 'exception', 'function', 'method', 'attribute'
],
str,
Any,
dict[str, bool],
str | None,
str | None,
],
tuple[str | None, str | None] | None,
],
callback: _AutodocProcessSignatureListener,
priority: int = 500,
) -> int: ...

Expand All @@ -754,19 +745,7 @@ def connect(
def connect(
self,
event: Literal['autodoc-skip-member'],
callback: Callable[
[
Sphinx,
Literal[
'module', 'class', 'exception', 'function', 'method', 'attribute'
],
str,
Any,
bool,
dict[str, bool],
],
bool,
],
callback: _AutodocSkipMemberListener,
priority: int = 500,
) -> int: ...

Expand Down
35 changes: 7 additions & 28 deletions sphinx/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
from sphinx.config import Config
from sphinx.domains import Domain
from sphinx.environment import BuildEnvironment
from sphinx.ext.autodoc._event_listeners import _AutodocProcessDocstringListener
from sphinx.ext.autodoc._event_listeners import (
_AutodocProcessDocstringListener,
_AutodocProcessSignatureListener,
_AutodocSkipMemberListener,
)
from sphinx.ext.todo import todo_node


Expand Down Expand Up @@ -291,20 +295,7 @@ def connect(
def connect(
self,
name: Literal['autodoc-process-signature'],
callback: Callable[
[
Sphinx,
Literal[
'module', 'class', 'exception', 'function', 'method', 'attribute'
],
str,
Any,
dict[str, bool],
str | None,
str | None,
],
tuple[str | None, str | None] | None,
],
callback: _AutodocProcessSignatureListener,
priority: int,
) -> int: ...

Expand All @@ -320,19 +311,7 @@ def connect(
def connect(
self,
name: Literal['autodoc-skip-member'],
callback: Callable[
[
Sphinx,
Literal[
'module', 'class', 'exception', 'function', 'method', 'attribute'
],
str,
Any,
bool,
dict[str, bool],
],
bool,
],
callback: _AutodocSkipMemberListener,
priority: int,
) -> int: ...

Expand Down
13 changes: 9 additions & 4 deletions sphinx/ext/autodoc/_event_listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@

if TYPE_CHECKING:
from collections.abc import Callable, Sequence
from typing import Any, Literal, TypeAlias
from typing import Any, TypeAlias

from sphinx.application import Sphinx
from sphinx.ext.autodoc._property_types import _AutodocObjType

_AutodocObjType = Literal[
'module', 'class', 'exception', 'function', 'method', 'attribute'
]
_AutodocProcessDocstringListener: TypeAlias = Callable[
[Sphinx, _AutodocObjType, str, Any, dict[str, bool], list[str]], None
]
_AutodocProcessSignatureListener: TypeAlias = Callable[ # NoQA: PYI047
[Sphinx, _AutodocObjType, str, Any, dict[str, bool], str | None, str | None],
tuple[str | None, str | None] | None,
]
_AutodocSkipMemberListener: TypeAlias = Callable[ # NoQA: PYI047
[Sphinx, _AutodocObjType, str, Any, bool, dict[str, bool]], bool
]


def cut_lines(
Expand Down
Loading