Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 408b128

Browse files
committed
DOC: Hide pybind11 base object from inheritance
1 parent 1a83e05 commit 408b128

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

doc/conf.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,20 @@ def tutorials_download_error(record):
230230
autodoc_docstring_signature = True
231231
autodoc_default_options = {'members': None, 'undoc-members': None}
232232

233+
234+
def autodoc_process_bases(app, name, obj, options, bases):
235+
"""
236+
Hide pybind11 base object from inheritance tree.
237+
238+
Note, *bases* must be modified in place.
239+
"""
240+
for cls in bases[:]:
241+
if not isinstance(cls, type):
242+
continue
243+
if cls.__module__ == 'pybind11_builtins' and cls.__name__ == 'pybind11_object':
244+
bases.remove(cls)
245+
246+
233247
# make sure to ignore warnings that stem from simply inspecting deprecated
234248
# class-level attributes
235249
warnings.filterwarnings('ignore', category=DeprecationWarning,
@@ -847,5 +861,6 @@ def setup(app):
847861
bld_type = 'rel'
848862
app.add_config_value('skip_sub_dirs', 0, '')
849863
app.add_config_value('releaselevel', bld_type, 'env')
864+
app.connect('autodoc-process-bases', autodoc_process_bases)
850865
if sphinx.version_info[:2] < (7, 1):
851866
app.connect('html-page-context', add_html_cache_busting, priority=1000)

0 commit comments

Comments
 (0)