File: zeroconfautodocfix.py

package info (click to toggle)
python-zeroconf 0.147.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,380 kB
  • sloc: python: 15,356; makefile: 23
file content (19 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""
Must be included after 'sphinx.ext.autodoc'. Fixes unwanted 'alias of' behavior.
"""

# pylint: disable=import-error
from sphinx.application import Sphinx


def skip_member(app, what, name, obj, skip: bool, options) -> bool:  # type: ignore[no-untyped-def]
    return (
        skip
        or getattr(obj, "__doc__", None) is None
        or getattr(obj, "__private__", False) is True
        or getattr(getattr(obj, "__func__", None), "__private__", False) is True
    )


def setup(app: Sphinx) -> None:
    app.connect("autodoc-skip-member", skip_member)