Skip to content

Commit edfabb6

Browse files
authored
Merge pull request #6449 from jepler/monkeypatch-sphinx-autoapi
fix autoapi bug ourselves for now
2 parents 3ff7ed7 + f0b387e commit edfabb6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

conf.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,25 @@
3333

3434
tools_describe = str(pathlib.Path(__file__).parent / "tools/describe")
3535

36+
# Monkeypatch autoapi
37+
def _format_args(args_info, include_annotations=True, ignore_self=None):
38+
result = []
39+
40+
for i, (prefix, name, annotation, default) in enumerate(args_info):
41+
if i == 0 and ignore_self is not None and name == ignore_self:
42+
continue
43+
formatted = "{}{}{}{}".format(
44+
prefix or "",
45+
name or "",
46+
": {}".format(annotation) if annotation and include_annotations else "",
47+
(" = {}" if annotation else "={}").format(default) if default else "",
48+
)
49+
result.append(formatted)
50+
return ", ".join(result)
51+
52+
import autoapi.mappers.python.objects as objects
53+
objects._format_args = _format_args
54+
3655
# If extensions (or modules to document with autodoc) are in another directory,
3756
# add these directories to sys.path here. If the directory is relative to the
3857
# documentation root, use os.path.abspath to make it absolute, like shown here.

0 commit comments

Comments
 (0)