Respect __all__ when autodocumenting module members.

This commit is contained in:
Georg Brandl 2008-08-15 19:43:52 +00:00
parent a8c1a75e81
commit 37da4a20ed
2 changed files with 10 additions and 4 deletions

View File

@ -45,6 +45,8 @@ New features added
* sphinx.doc.autodoc has a new event ``autodoc-process-signature``
that allows tuning function signature introspection.
* Respect __all__ when autodocumenting module members.
* Glossary entries are now automatically added to the index.
* Added ``exclude_dirnames`` config value that can be used to exclude

View File

@ -498,9 +498,13 @@ class RstGenerator(object):
if _all:
# unqualified :members: given
if what == 'module':
# for implicit module members, check __module__ to avoid documenting
# imported objects if __all__ is not defined
members_check_module = not hasattr(todoc, '__all__')
if hasattr(todoc, '__all__'):
members_check_module = False
all_members = inspect.getmembers(todoc, lambda x: x in todoc.__all__)
else:
# for implicit module members, check __module__ to avoid
# documenting imported objects
members_check_module = True
all_members = inspect.getmembers(todoc)
else:
if self.options.inherited_members: