|
21 | 21 | from autoapi.extension import LOGGER |
22 | 22 | from autoapi.extension import setup as autoapi_setup |
23 | 23 | from autoapi.mappers.python.mapper import PythonSphinxMapper |
| 24 | +from autoapi.mappers.python.parser import Parser |
24 | 25 | from autoapi.mappers.python.objects import PythonPythonMapper |
25 | 26 | from docutils import nodes |
26 | 27 | from sphinx.util.console import bold, darkgreen |
@@ -109,6 +110,15 @@ def PythonSphinxMapper_output_rst( |
109 | 110 | self._output_top_rst(root) |
110 | 111 |
|
111 | 112 |
|
| 113 | +def PythonSphinxMapper_read_file(self : PythonSphinxMapper, path, **kwargs): |
| 114 | + dir_root = kwargs.get("dir_root") |
| 115 | + if self._use_implicit_namespace: |
| 116 | + parsed_data = Parser().parse_file_in_namespace(path, dir_root) |
| 117 | + else: |
| 118 | + parsed_data = Parser().parse_file(path) |
| 119 | + return parsed_data |
| 120 | + |
| 121 | + |
112 | 122 | def extension_build_finished(app, exception): |
113 | 123 | if ( |
114 | 124 | not app.config.autoapi_keep_files |
@@ -150,5 +160,6 @@ def setup(app): |
150 | 160 | PythonPythonMapper.pathname = property(PythonPythonMapper_pathname) |
151 | 161 | PythonPythonMapper.include_dir = PythonPythonMapper_include_dir |
152 | 162 | PythonSphinxMapper.output_rst = PythonSphinxMapper_output_rst |
| 163 | + PythonSphinxMapper.read_file = PythonSphinxMapper_read_file |
153 | 164 | autoapi.extension.build_finished = extension_build_finished |
154 | 165 | autoapi_setup(app) |
0 commit comments