mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Respect __all__ when autodocumenting module members.
This commit is contained in:
parent
a8c1a75e81
commit
37da4a20ed
2
CHANGES
2
CHANGES
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user