From 270c1883e80aa5482a964df8882f65c6c58a5097 Mon Sep 17 00:00:00 2001 From: Kenichi Maehashi Date: Fri, 1 Jun 2018 13:29:00 +0900 Subject: [PATCH] expose inherited_members to autosummary template --- doc/ext/autosummary.rst | 5 +++++ sphinx/ext/autosummary/generate.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/doc/ext/autosummary.rst b/doc/ext/autosummary.rst index c35ba50a5..46d8e4b56 100644 --- a/doc/ext/autosummary.rst +++ b/doc/ext/autosummary.rst @@ -205,6 +205,11 @@ The following variables available in the templates: List containing names of all members of the module or class. Only available for modules and classes. +.. data:: inherited_members + + List containing names of all inherited members of class. Only available for + classes. + .. data:: functions List containing names of "public" functions in the module. Here, "public" diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index 4c9175a5d..4156e0b2b 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -203,6 +203,8 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst', get_members(obj, 'exception', imported=imported_members) elif doc.objtype == 'class': ns['members'] = dir(obj) + ns['inherited_members'] = \ + set(dir(obj)) - set(obj.__dict__.keys()) ns['methods'], ns['all_methods'] = \ get_members(obj, 'method', ['__init__']) ns['attributes'], ns['all_attributes'] = \