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
|
"""Sphinx extension to not skip abstract methods."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Literal
from sphinx.application import Sphinx
from sphinx.ext.autodoc import Options
def autodoc_skip_member(
app: Sphinx,
what: Literal["module", "class", "exception", "function", "method", "attribute"],
name: str,
obj: object,
skip: bool, # noqa: FBT001
options: Options,
):
if what == "method" and getattr(obj, "__isabstractmethod__", False):
return False
return None
def setup(app: Sphinx):
app.connect("autodoc-skip-member", autodoc_skip_member)
|