Merge pull request #5029 from kmaehashi/autosummary-inherited-docs

autosummary: expose inherited_members to template
This commit is contained in:
Takeshi KOMIYA 2018-06-09 22:11:03 +09:00 committed by GitHub
commit 40ee7cd0c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -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"

View File

@ -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'] = \