import psycopg # type: ignore
- recover_defined_module(psycopg)
+ recover_defined_module(
+ psycopg, skip_modules=["psycopg._dns", "psycopg.types.shapely"]
+ )
monkeypatch_autodoc()
# Disable warnings in sphinx_autodoc_typehints because it doesn't seem that
recovered_classes: Dict[type, str] = {}
-def recover_defined_module(m):
+def recover_defined_module(m, skip_modules=()):
"""
Find the module where classes with __module__ attribute hacked were defined.
assert fn.startswith(mdir)
modname = os.path.splitext(fn[len(mdir) + 1 :])[0].replace("/", ".")
modname = f"{m.__name__}.{modname}"
+ if modname in skip_modules:
+ continue
with open(fn) as f:
classnames = re.findall(r"^class\s+([^(:]+)", f.read(), re.M)
for cls in classnames:
"furo == 2021.11.23",
"sphinx-autobuild >= 2021.3.14",
"sphinx-autodoc-typehints >= 1.12",
- # to document optional modules
- "dnspython >= 2.1",
- "shapely >= 1.7",
],
}