diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2019-03-09 11:23:15 +0100 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-03-20 09:07:35 +0100 |
commit | 2d525d68249cf00c4dbb521e331e99b481a113c3 (patch) | |
tree | 29ab4faad229c838ab74b97349fd9922cd14613e /doc/exts | |
parent | 5ab140ac3b3dda6f32e0f73aeec09abf015ea30f (diff) | |
download | pylint-git-2d525d68249cf00c4dbb521e331e99b481a113c3.tar.gz |
Style - Re-Apply black following the isort cleanup
Change with isort triggered change with black.
Diffstat (limited to 'doc/exts')
-rwxr-xr-x | doc/exts/pylint_extensions.py | 75 | ||||
-rwxr-xr-x | doc/exts/pylint_features.py | 12 |
2 files changed, 47 insertions, 40 deletions
diff --git a/doc/exts/pylint_extensions.py b/doc/exts/pylint_extensions.py index 2e1d82163..dd660767c 100755 --- a/doc/exts/pylint_extensions.py +++ b/doc/exts/pylint_extensions.py @@ -18,28 +18,27 @@ from pylint.lint import PyLinter # 1) They are deprecated, why document them moving forward? # 2) We can't load the deprecated module and the newly renamed module at the # same time without getting naming conflicts -DEPRECATED_MODULES = [ - 'check_docs', # ==> docparams -] +DEPRECATED_MODULES = ["check_docs"] # ==> docparams + def builder_inited(app): """Output full documentation in ReST format for all extension modules""" # PACKAGE/docs/exts/pylint_extensions.py --> PACKAGE/ base_path = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + ) # PACKAGE/ --> PACKAGE/pylint/extensions - ext_path = os.path.join(base_path, 'pylint', 'extensions') + ext_path = os.path.join(base_path, "pylint", "extensions") modules = [] doc_files = {} for filename in os.listdir(ext_path): name, ext = os.path.splitext(filename) - if name[0] == '_' or name in DEPRECATED_MODULES: + if name[0] == "_" or name in DEPRECATED_MODULES: continue - if ext == '.py': - modules.append('pylint.extensions.%s' % name) - elif ext == '.rst': - doc_files['pylint.extensions.' + name] = os.path.join(ext_path, - filename) + if ext == ".py": + modules.append("pylint.extensions.%s" % name) + elif ext == ".rst": + doc_files["pylint.extensions." + name] = os.path.join(ext_path, filename) modules.sort() if not modules: sys.exit("No Pylint extensions found?") @@ -47,29 +46,35 @@ def builder_inited(app): linter = PyLinter() linter.load_plugin_modules(modules) - extensions_doc = os.path.join(base_path, 'doc', 'technical_reference', 'extensions.rst') - with open(extensions_doc, 'w') as stream: + extensions_doc = os.path.join( + base_path, "doc", "technical_reference", "extensions.rst" + ) + with open(extensions_doc, "w") as stream: stream.write("Optional Pylint checkers in the extensions module\n") stream.write("=================================================\n\n") stream.write("Pylint provides the following optional plugins:\n\n") for module in modules: stream.write("- :ref:`{}`\n".format(module)) stream.write("\n") - stream.write("You can activate any or all of these extensions " - "by adding a ``load-plugins`` line to the ``MASTER`` " - "section of your ``.pylintrc``, for example::\n") - stream.write("\n load-plugins=pylint.extensions.docparams," - "pylint.extensions.docstyle\n\n") + stream.write( + "You can activate any or all of these extensions " + "by adding a ``load-plugins`` line to the ``MASTER`` " + "section of your ``.pylintrc``, for example::\n" + ) + stream.write( + "\n load-plugins=pylint.extensions.docparams," + "pylint.extensions.docstyle\n\n" + ) by_module = get_plugins_info(linter, doc_files) for module, info in sorted(by_module.items()): - linter._print_checker_doc(info['name'], info, stream=stream) + linter._print_checker_doc(info["name"], info, stream=stream) def get_plugins_info(linter, doc_files): by_module = {} for checker in linter.get_checkers(): - if checker.name == 'master': + if checker.name == "master": continue module = checker.__module__ # Plugins only - skip over core checkers @@ -80,32 +85,32 @@ def get_plugins_info(linter, doc_files): doc = "" doc_file = doc_files.get(module) if doc_file: - with open(doc_file, 'r') as f: + with open(doc_file, "r") as f: doc = f.read() try: - by_module[module]['options'] += checker.options_and_values() - by_module[module]['msgs'].update(checker.msgs) - by_module[module]['reports'] += checker.reports - by_module[module]['doc'] += doc - by_module[module]['name'] += checker.name - by_module[module]['module'] += module + by_module[module]["options"] += checker.options_and_values() + by_module[module]["msgs"].update(checker.msgs) + by_module[module]["reports"] += checker.reports + by_module[module]["doc"] += doc + by_module[module]["name"] += checker.name + by_module[module]["module"] += module except KeyError: by_module[module] = { - 'options': list(checker.options_and_values()), - 'msgs': dict(checker.msgs), - 'reports': list(checker.reports), - 'doc': doc, - 'name': checker.name, - 'module': module, + "options": list(checker.options_and_values()), + "msgs": dict(checker.msgs), + "reports": list(checker.reports), + "doc": doc, + "name": checker.name, + "module": module, } return by_module def setup(app): - app.connect('builder-inited', builder_inited) - return {'version': sphinx.__display_version__} + app.connect("builder-inited", builder_inited) + return {"version": sphinx.__display_version__} if __name__ == "__main__": diff --git a/doc/exts/pylint_features.py b/doc/exts/pylint_features.py index 2ff0e52a7..4803efc9a 100755 --- a/doc/exts/pylint_features.py +++ b/doc/exts/pylint_features.py @@ -15,12 +15,13 @@ from pylint.lint import PyLinter def builder_inited(app): # PACKAGE/docs/exts/pylint_extensions.py --> PACKAGE/ base_path = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + ) linter = PyLinter() linter.load_default_plugins() - features = os.path.join(base_path, 'doc', 'technical_reference', 'features.rst') - with open(features, 'w') as stream: + features = os.path.join(base_path, "doc", "technical_reference", "features.rst") + with open(features, "w") as stream: stream.write("Pylint features\n") stream.write("===============\n\n") stream.write(".. generated by pylint --full-documentation\n\n") @@ -28,8 +29,9 @@ def builder_inited(app): def setup(app): - app.connect('builder-inited', builder_inited) - return {'version': sphinx.__display_version__} + app.connect("builder-inited", builder_inited) + return {"version": sphinx.__display_version__} + if __name__ == "__main__": builder_inited(None) |