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``
|
* sphinx.doc.autodoc has a new event ``autodoc-process-signature``
|
||||||
that allows tuning function signature introspection.
|
that allows tuning function signature introspection.
|
||||||
|
|
||||||
|
* Respect __all__ when autodocumenting module members.
|
||||||
|
|
||||||
* Glossary entries are now automatically added to the index.
|
* Glossary entries are now automatically added to the index.
|
||||||
|
|
||||||
* Added ``exclude_dirnames`` config value that can be used to exclude
|
* Added ``exclude_dirnames`` config value that can be used to exclude
|
||||||
|
@ -498,10 +498,14 @@ class RstGenerator(object):
|
|||||||
if _all:
|
if _all:
|
||||||
# unqualified :members: given
|
# unqualified :members: given
|
||||||
if what == 'module':
|
if what == 'module':
|
||||||
# for implicit module members, check __module__ to avoid documenting
|
if hasattr(todoc, '__all__'):
|
||||||
# imported objects if __all__ is not defined
|
members_check_module = False
|
||||||
members_check_module = not hasattr(todoc, '__all__')
|
all_members = inspect.getmembers(todoc, lambda x: x in todoc.__all__)
|
||||||
all_members = inspect.getmembers(todoc)
|
else:
|
||||||
|
# for implicit module members, check __module__ to avoid
|
||||||
|
# documenting imported objects
|
||||||
|
members_check_module = True
|
||||||
|
all_members = inspect.getmembers(todoc)
|
||||||
else:
|
else:
|
||||||
if self.options.inherited_members:
|
if self.options.inherited_members:
|
||||||
# getmembers() uses dir() which pulls in members from all
|
# getmembers() uses dir() which pulls in members from all
|
||||||
|
Loading…
Reference in New Issue
Block a user