diff options
author | Laurent Peuch <cortex@worlddomination.be> | 2020-04-01 00:11:10 +0200 |
---|---|---|
committer | Laurent Peuch <cortex@worlddomination.be> | 2020-04-01 00:11:10 +0200 |
commit | b8899451fa861b04568e2a0bb4e3fe4acc0daee3 (patch) | |
tree | 1446c809e19b5571b31b1999246aa0e50b19f5c8 /logilab/common/sphinx_ext.py | |
parent | 32cd73810056594f55eff0ffafebbdeb50c7a860 (diff) | |
download | logilab-common-b8899451fa861b04568e2a0bb4e3fe4acc0daee3.tar.gz |
Black the whole code base
Diffstat (limited to 'logilab/common/sphinx_ext.py')
-rw-r--r-- | logilab/common/sphinx_ext.py | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/logilab/common/sphinx_ext.py b/logilab/common/sphinx_ext.py index a24608c..4ca30f7 100644 --- a/logilab/common/sphinx_ext.py +++ b/logilab/common/sphinx_ext.py @@ -19,30 +19,41 @@ from logilab.common.decorators import monkeypatch from sphinx.ext import autodoc + class DocstringOnlyModuleDocumenter(autodoc.ModuleDocumenter): - objtype = 'docstring' + objtype = "docstring" + def format_signature(self): pass + def add_directive_header(self, sig): pass + def document_members(self, all_members=False): pass def resolve_name(self, modname, parents, path, base): if modname is not None: return modname, parents + [base] - return (path or '') + base, [] + return (path or "") + base, [] + +# autodoc.add_documenter(DocstringOnlyModuleDocumenter) -#autodoc.add_documenter(DocstringOnlyModuleDocumenter) def setup(app): app.add_autodocumenter(DocstringOnlyModuleDocumenter) +from sphinx.ext.autodoc import ( + ViewList, + Options, + AutodocReporter, + nodes, + assemble_option_dict, + nested_parse_with_titles, +) -from sphinx.ext.autodoc import (ViewList, Options, AutodocReporter, nodes, - assemble_option_dict, nested_parse_with_titles) @monkeypatch(autodoc.AutoDirective) def run(self): @@ -56,8 +67,7 @@ def run(self): objtype = self.name[4:] doc_class = self._registry[objtype] # process the options with the selected documenter's option_spec - self.genopt = Options(assemble_option_dict( - self.options.items(), doc_class.option_spec)) + self.genopt = Options(assemble_option_dict(self.options.items(), doc_class.option_spec)) # generate the output documenter = doc_class(self, self.arguments[0]) documenter.generate(more_content=self.content) @@ -72,9 +82,8 @@ def run(self): # use a custom reporter that correctly assigns lines to source # filename/description and lineno old_reporter = self.state.memo.reporter - self.state.memo.reporter = AutodocReporter(self.result, - self.state.memo.reporter) - if self.name in ('automodule', 'autodocstring'): + self.state.memo.reporter = AutodocReporter(self.result, self.state.memo.reporter) + if self.name in ("automodule", "autodocstring"): node = nodes.section() # necessary so that the child nodes get the right source/line set node.document = self.state.document |