Fixed missed ignore___all__ -> ignore_module_all

This commit is contained in:
Josh Mitchell 2021-11-15 13:27:26 +11:00
parent 79089b5fa4
commit 8e45229fee
4 changed files with 10 additions and 10 deletions

View File

@ -16,7 +16,7 @@ Features added
* #9815: html theme: Wrap sidebar components in div to allow customizing their
layout via CSS
* #9831: Autosummary now documents only the members specified in a module's
``__all__`` attribute if :confval:`autosummary_ignore___all__` is set to
``__all__`` attribute if :confval:`autosummary_ignore_module_all` is set to
``False``. The default behaviour is unchanged. Autogen also now supports
this behavior with the ``--respect-module-all`` switch.

View File

@ -826,6 +826,6 @@ def setup(app: Sphinx) -> Dict[str, Any]:
app.add_config_value('autosummary_mock_imports',
lambda config: config.autodoc_mock_imports, 'env')
app.add_config_value('autosummary_imported_members', [], False, [bool])
app.add_config_value('autosummary_ignore___all__', True, 'env', bool)
app.add_config_value('autosummary_ignore_module_all', True, 'env', bool)
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}

View File

@ -68,7 +68,7 @@ class DummyApplication:
self.config.add('autosummary_context', {}, True, None)
self.config.add('autosummary_filename_map', {}, True, None)
self.config.add('autosummary_ignore___all__', True, 'env', bool)
self.config.add('autosummary_ignore_module_all', True, 'env', bool)
self.config.init_values()
def emit_firstresult(self, *args: Any) -> None:
@ -219,7 +219,7 @@ class ModuleScanner:
elif imported is False:
# list not-imported members
members.append(name)
elif '__all__' in dir(self.object) and not self.app.config.autosummary_ignore___all__:
elif '__all__' in dir(self.object) and not self.app.config.autosummary_ignore_module_all:
# list members that have __all__ set
members.append(name)
@ -228,9 +228,9 @@ class ModuleScanner:
def members_of(conf: Config, obj: Any) -> Sequence[str]:
"""Get the members of ``obj``, possibly ignoring the ``__all__`` module attribute
Follows the ``conf.autosummary_ignore___all__`` setting."""
Follows the ``conf.autosummary_ignore_module_all`` setting."""
if conf.autosummary_ignore___all__:
if conf.autosummary_ignore_module_all:
return dir(obj)
else:
return getall(obj) or dir(obj)
@ -645,8 +645,8 @@ The format of the autosummary directive is documented in the
dest='imported_members', default=False,
help=__('document imported members (default: '
'%(default)s)'))
parser.add_argument('-a', '--respect-module-all', action='store_false',
dest='ignore___all__', default=True,
parser.add_argument('-a', '--respect-module-all', action='store_true',
dest='respect_module_all', default=False,
help=__('document exactly the members in module __all__ attribute. '
'(default: %(default)s)'))
@ -665,7 +665,7 @@ def main(argv: List[str] = sys.argv[1:]) -> None:
if args.templates:
app.config.templates_path.append(path.abspath(args.templates))
app.config.autosummary_ignore___all__ = args.ignore___all__
app.config.autosummary_ignore_module_all = not args.respect_module_all
generate_autosummary_docs(args.source_file, args.output_dir,
'.' + args.suffix,

View File

@ -238,7 +238,7 @@ def test_autosummary_generate_content_for_module(app):
def test_autosummary_generate_content_for_module___all__(app):
import autosummary_dummy_module
template = Mock()
app.config.autosummary_ignore___all__ = False
app.config.autosummary_ignore_module_all = False
generate_autosummary_content('autosummary_dummy_module', autosummary_dummy_module, None,
template, None, False, app, False, {})