Skip to content

Commit 40f2f26

Browse files
feat: Add option to disallow inspection
Issue #68: #68 PR #69: #69
1 parent f593bb0 commit 40f2f26

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/mkdocstrings_handlers/python/handler.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class PythonHandler(BaseHandler):
109109
"annotations_path": "brief",
110110
"preload_modules": None,
111111
"load_external_modules": False,
112+
"allow_inspection": True,
112113
}
113114
"""
114115
Attributes: Headings options:
@@ -169,6 +170,7 @@ class PythonHandler(BaseHandler):
169170
of the importing module.
170171
171172
The modules must be listed as an array of strings. Default: `None`.
173+
allow_inspection (bool): Whether to allow inspecting modules when visiting them is not possible. Default: `True`.
172174
173175
"""
174176

@@ -257,6 +259,7 @@ def collect(self, identifier: str, config: Mapping[str, Any]) -> CollectorItem:
257259
docstring_options=parser_options,
258260
modules_collection=self._modules_collection,
259261
lines_collection=self._lines_collection,
262+
allow_inspection=final_config["allow_inspection"],
260263
)
261264
try:
262265
for pre_loaded_module in final_config.get("preload_modules") or []:

0 commit comments

Comments
 (0)