mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
[autosummary] small flake8/mypy bugs
This commit is contained in:
parent
33e7b76c32
commit
3ef575cbca
@ -704,7 +704,7 @@ def process_generate_options(app):
|
||||
return
|
||||
|
||||
recursion_limit = app.config.autosummary_recursion_limit
|
||||
|
||||
|
||||
with mock(app.config.autosummary_mock_imports):
|
||||
generate_autosummary_docs(genfiles, builder=app.builder,
|
||||
warn=logger.warning, info=logger.info,
|
||||
@ -734,7 +734,7 @@ def setup(app):
|
||||
app.connect('doctree-read', process_autosummary_toc)
|
||||
app.connect('builder-inited', process_generate_options)
|
||||
app.add_config_value('autosummary_generate', [], True, [bool])
|
||||
app.add_config_value('autosummary_recursion_limit', 0, 0)
|
||||
app.add_config_value('autosummary_recursion_limit', 0, True, [int])
|
||||
app.add_config_value('autosummary_mock_imports',
|
||||
lambda config: config.autodoc_mock_imports, 'env')
|
||||
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
|
||||
|
@ -91,12 +91,19 @@ def _underline(title, line='='):
|
||||
|
||||
# -- Generating output ---------------------------------------------------------
|
||||
|
||||
def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
|
||||
warn=_simple_warn, info=_simple_info,
|
||||
base_path=None, builder=None, template_dir=None,
|
||||
imported_members=False, recursion_limit=0,
|
||||
app=None):
|
||||
# type: (List[str], str, str, Callable, Callable, str, Builder, str, bool, Any) -> None
|
||||
def generate_autosummary_docs(sources, # type: List[str]
|
||||
output_dir=None, # type: str
|
||||
suffix='.rst', # type: str
|
||||
warn=_simple_warn, # type: Callable
|
||||
info=_simple_info, # type: Callable
|
||||
base_path=None, # type: str
|
||||
builder=None, # type: Builder
|
||||
template_dir=None, # type: str
|
||||
imported_members=False, # type: bool
|
||||
recursion_limit=0, # type: int
|
||||
app=None # type: Any
|
||||
):
|
||||
# type: (...) -> None
|
||||
showed_sources = list(sorted(sources))
|
||||
if len(showed_sources) > 20:
|
||||
showed_sources = showed_sources[:10] + ['...'] + showed_sources[-10:]
|
||||
@ -211,7 +218,7 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
|
||||
return public, items
|
||||
|
||||
def get_package_members(obj, typ, include_public=[]):
|
||||
# type: (Any, bool, List[str]) -> Tuple[List[str], List[str]]
|
||||
# type: (Any, str, List[str]) -> Tuple[List[str], List[str]]
|
||||
items = [] # type: List[str]
|
||||
pkg_required = typ == 'package'
|
||||
for _, modname, ispkg in pkgutil.iter_modules(obj.__path__):
|
||||
|
Loading…
Reference in New Issue
Block a user