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
|
return
|
||||||
|
|
||||||
recursion_limit = app.config.autosummary_recursion_limit
|
recursion_limit = app.config.autosummary_recursion_limit
|
||||||
|
|
||||||
with mock(app.config.autosummary_mock_imports):
|
with mock(app.config.autosummary_mock_imports):
|
||||||
generate_autosummary_docs(genfiles, builder=app.builder,
|
generate_autosummary_docs(genfiles, builder=app.builder,
|
||||||
warn=logger.warning, info=logger.info,
|
warn=logger.warning, info=logger.info,
|
||||||
@ -734,7 +734,7 @@ def setup(app):
|
|||||||
app.connect('doctree-read', process_autosummary_toc)
|
app.connect('doctree-read', process_autosummary_toc)
|
||||||
app.connect('builder-inited', process_generate_options)
|
app.connect('builder-inited', process_generate_options)
|
||||||
app.add_config_value('autosummary_generate', [], True, [bool])
|
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',
|
app.add_config_value('autosummary_mock_imports',
|
||||||
lambda config: config.autodoc_mock_imports, 'env')
|
lambda config: config.autodoc_mock_imports, 'env')
|
||||||
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
|
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
|
||||||
|
@ -91,12 +91,19 @@ def _underline(title, line='='):
|
|||||||
|
|
||||||
# -- Generating output ---------------------------------------------------------
|
# -- Generating output ---------------------------------------------------------
|
||||||
|
|
||||||
def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
|
def generate_autosummary_docs(sources, # type: List[str]
|
||||||
warn=_simple_warn, info=_simple_info,
|
output_dir=None, # type: str
|
||||||
base_path=None, builder=None, template_dir=None,
|
suffix='.rst', # type: str
|
||||||
imported_members=False, recursion_limit=0,
|
warn=_simple_warn, # type: Callable
|
||||||
app=None):
|
info=_simple_info, # type: Callable
|
||||||
# type: (List[str], str, str, Callable, Callable, str, Builder, str, bool, Any) -> None
|
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))
|
showed_sources = list(sorted(sources))
|
||||||
if len(showed_sources) > 20:
|
if len(showed_sources) > 20:
|
||||||
showed_sources = showed_sources[:10] + ['...'] + showed_sources[-10:]
|
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
|
return public, items
|
||||||
|
|
||||||
def get_package_members(obj, typ, include_public=[]):
|
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]
|
items = [] # type: List[str]
|
||||||
pkg_required = typ == 'package'
|
pkg_required = typ == 'package'
|
||||||
for _, modname, ispkg in pkgutil.iter_modules(obj.__path__):
|
for _, modname, ispkg in pkgutil.iter_modules(obj.__path__):
|
||||||
|
Loading…
Reference in New Issue
Block a user