-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathskip_members.py
More file actions
28 lines (22 loc) · 988 Bytes
/
skip_members.py
File metadata and controls
28 lines (22 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from __future__ import annotations
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from sphinx.application import Sphinx
from sphinx.ext.autodoc import Options
def skip_member(app: Sphinx, what: str, name: str, obj: Any, skip: bool, options: Options) -> bool | None: # noqa: ANN401, ARG001
"""
Custom function to skip members based on docstring tags.
Args:
app (Sphinx): The Sphinx application instance.
what (str): The type of the object (e.g., 'module', 'class', 'method').
name (str): The name of the object.
obj (Any): The object itself.
skip (bool): Whether to skip the object by default.
options (Options): Options for the autodoc directive.
Returns:
bool | None: True to skip the member, None to use the default behavior.
"""
# Check if the member has a docstring
if hasattr(obj, "__doc__") and obj.__doc__ and "#private" in obj.__doc__:
return True
return skip