diff options
author | Eric Larson <larson.eric.d@gmail.com> | 2022-07-13 08:55:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-13 08:55:05 -0400 |
commit | d9c8d6766a20500015f53ffc12fb6b552014912b (patch) | |
tree | 1e535781814ec9f40b7f3bb4d14ab8a1f1755dbe /numpydoc/numpydoc.py | |
parent | c796da669a9d3714126a3fde7221f9c47aef93c7 (diff) | |
download | numpydoc-d9c8d6766a20500015f53ffc12fb6b552014912b.tar.gz |
ENH: Add support for dict show_inherited_class_members (#415)
* ENH: Add support for dict show_inherited_class_members
* STY: Black
* TST: Add test
Diffstat (limited to 'numpydoc/numpydoc.py')
-rw-r--r-- | numpydoc/numpydoc.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/numpydoc/numpydoc.py b/numpydoc/numpydoc.py index e656fb5..57016f9 100644 --- a/numpydoc/numpydoc.py +++ b/numpydoc/numpydoc.py @@ -162,12 +162,18 @@ DEDUPLICATION_TAG = " !! processed by numpydoc !!" def mangle_docstrings(app, what, name, obj, options, lines): if DEDUPLICATION_TAG in lines: return + show_inherited_class_members = app.config.numpydoc_show_inherited_class_members + if isinstance(show_inherited_class_members, dict): + try: + show_inherited_class_members = show_inherited_class_members[name] + except KeyError: + show_inherited_class_members = True cfg = { "use_plots": app.config.numpydoc_use_plots, "use_blockquotes": app.config.numpydoc_use_blockquotes, "show_class_members": app.config.numpydoc_show_class_members, - "show_inherited_class_members": app.config.numpydoc_show_inherited_class_members, + "show_inherited_class_members": show_inherited_class_members, "class_members_toctree": app.config.numpydoc_class_members_toctree, "attributes_as_param_list": app.config.numpydoc_attributes_as_param_list, "xref_param_type": app.config.numpydoc_xref_param_type, @@ -270,7 +276,9 @@ def setup(app, get_doc_object_=get_doc_object): app.add_config_value("numpydoc_use_plots", None, False) app.add_config_value("numpydoc_use_blockquotes", None, False) app.add_config_value("numpydoc_show_class_members", True, True) - app.add_config_value("numpydoc_show_inherited_class_members", True, True) + app.add_config_value( + "numpydoc_show_inherited_class_members", True, True, types=(bool, dict) + ) app.add_config_value("numpydoc_class_members_toctree", True, True) app.add_config_value("numpydoc_citation_re", "[a-z0-9_.-]+", True) app.add_config_value("numpydoc_attributes_as_param_list", True, True) |