MCPcopy
hub / github.com/sphinx-doc/sphinx / do_autodoc

Function do_autodoc

tests/test_ext_autodoc/autodoc_util.py:39–83  ·  view source on GitHub ↗
(
    obj_type: _AutodocObjType,
    name: str,
    *,
    config: _AutodocConfig = _DEFAULT_CONFIG,
    current_document: _CurrentDocument | None = None,
    events: FakeEvents | None = None,
    expect_import_error: bool = False,
    options: dict[str, Any] | None = None,
    ref_context: Mapping[str, str | None] | None = None,
)

Source from the content-addressed store, hash-verified

37
38
39def do_autodoc(
40 obj_type: _AutodocObjType,
41 name: str,
42 *,
43 config: _AutodocConfig = _DEFAULT_CONFIG,
44 current_document: _CurrentDocument | None = None,
45 events: FakeEvents | None = None,
46 expect_import_error: bool = False,
47 options: dict[str, Any] | None = None,
48 ref_context: Mapping[str, str | None] | None = None,
49) -> list[str]:
50 if current_document is None:
51 current_document = _CurrentDocument(docname='index')
52 if events is None:
53 events = FakeEvents()
54 if ref_context is None:
55 ref_context = {}
56 reread_always: set[str] = set()
57
58 options = {} if options is None else options.copy()
59 doc_options = _process_documenter_options(
60 obj_type=obj_type,
61 default_options=config.autodoc_default_options,
62 options=options,
63 )
64
65 content = _auto_document_object(
66 name=name,
67 obj_type=obj_type,
68 config=config,
69 current_document=current_document,
70 events=events,
71 get_attr=safe_getattr,
72 more_content=None,
73 options=doc_options,
74 record_dependencies=set(),
75 ref_context=ref_context,
76 reread_always=reread_always,
77 )
78 if expect_import_error:
79 assert content is None
80 return []
81
82 assert content is not None
83 return content.data

Callers 15

test_empty_allFunction · 0.90
test_automoduleFunction · 0.90
test_preserve_defaultsFunction · 0.90
test_classesFunction · 0.90
test_callableFunction · 0.90
test_methodFunction · 0.90
test_builtin_functionFunction · 0.90

Calls 5

_CurrentDocumentClass · 0.90
_auto_document_objectFunction · 0.90
FakeEventsClass · 0.85
copyMethod · 0.45

Tested by 15

test_empty_allFunction · 0.72
test_automoduleFunction · 0.72
test_preserve_defaultsFunction · 0.72
test_classesFunction · 0.72
test_callableFunction · 0.72
test_methodFunction · 0.72
test_builtin_functionFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…