Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autodoc: Allow overriding of exclude-members in skip-member function #7954

Merged
merged 2 commits into from Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -13,6 +13,7 @@ Deprecated
Features added
--------------

* #2076: autodoc: Allow overriding of exclude-members in skip-member function
* #7849: html: Add :confval:`html_codeblock_linenos_style` to change the style
of line numbers for code-blocks
* #7853: C and C++, support parameterized GNU style attributes.
Expand Down
14 changes: 4 additions & 10 deletions sphinx/ext/autodoc/__init__.py
Expand Up @@ -626,6 +626,10 @@ def is_filtered_inherited_member(name: str) -> bool:
if safe_getattr(member, '__sphinx_mock__', False):
# mocked module or object
pass
elif (self.options.exclude_members not in (None, ALL) and
membername in self.options.exclude_members):
# remove members given by exclude-members
keep = False
elif want_all and membername.startswith('__') and \
membername.endswith('__') and len(membername) > 4:
# special __methods__
Expand Down Expand Up @@ -695,16 +699,6 @@ def document_members(self, all_members: bool = False) -> None:
# find out which members are documentable
members_check_module, members = self.get_object_members(want_all)

# remove members given by exclude-members
if self.options.exclude_members:
members = [
(membername, member) for (membername, member) in members
if (
self.options.exclude_members is ALL or
membername not in self.options.exclude_members
)
]

# document non-skipped members
memberdocumenters = [] # type: List[Tuple[Documenter, bool]]
for (mname, member, isattr) in self.filter_members(members, want_all):
Expand Down