mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #3174: [Napoleon] Defers autodoc-skip-member to other extensions if Napoleon doesn't care if the member is skipped
This commit is contained in:
parent
4dbafaa733
commit
f45fe6fc8c
@ -446,6 +446,11 @@ member should be included in the documentation by using the following event:
|
||||
documentation. The member is excluded if a handler returns ``True``. It is
|
||||
included if the handler returns ``False``.
|
||||
|
||||
If more than one enabled extension handles the ``autodoc-skip-member``
|
||||
event, autodoc will use the first non-``None`` value returned by a handler.
|
||||
Handlers should return ``None`` to fall back to the skipping behavior of
|
||||
autodoc and other enabled extensions.
|
||||
|
||||
:param app: the Sphinx application object
|
||||
:param what: the type of the object which the docstring belongs to (one of
|
||||
``"module"``, ``"class"``, ``"exception"``, ``"function"``, ``"method"``,
|
||||
|
@ -26,4 +26,4 @@ universal = 1
|
||||
[flake8]
|
||||
max-line-length=95
|
||||
ignore=E113,E116,E221,E226,E241,E251,E901
|
||||
exclude=tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py
|
||||
exclude=tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py,.tox/*
|
||||
|
@ -464,4 +464,4 @@ def _skip_member(app, what, name, obj, skip, options):
|
||||
(is_private and inc_private) or
|
||||
(is_init and inc_init)):
|
||||
return False
|
||||
return skip
|
||||
return None
|
||||
|
@ -123,19 +123,19 @@ class SetupTest(TestCase):
|
||||
|
||||
|
||||
class SkipMemberTest(TestCase):
|
||||
def assertSkip(self, what, member, obj, expect_skip, config_name):
|
||||
skip = 'default skip'
|
||||
def assertSkip(self, what, member, obj, expect_default_skip, config_name):
|
||||
skip = True
|
||||
app = mock.Mock()
|
||||
app.config = Config()
|
||||
setattr(app.config, config_name, True)
|
||||
if expect_skip:
|
||||
self.assertEqual(skip, _skip_member(app, what, member, obj, skip,
|
||||
if expect_default_skip:
|
||||
self.assertEqual(None, _skip_member(app, what, member, obj, skip,
|
||||
mock.Mock()))
|
||||
else:
|
||||
self.assertFalse(_skip_member(app, what, member, obj, skip,
|
||||
mock.Mock()))
|
||||
setattr(app.config, config_name, False)
|
||||
self.assertEqual(skip, _skip_member(app, what, member, obj, skip,
|
||||
self.assertEqual(None, _skip_member(app, what, member, obj, skip,
|
||||
mock.Mock()))
|
||||
|
||||
def test_namedtuple(self):
|
||||
|
Loading…
Reference in New Issue
Block a user