Update formatting with black 43/15143/3
authorThanh Ha <zxiiro@gmail.com>
Sun, 31 Mar 2019 00:49:11 +0000 (20:49 -0400)
committerThanh Ha <zxiiro@gmail.com>
Fri, 24 Jul 2020 13:26:46 +0000 (09:26 -0400)
This is an auto-generated patch. Do not update it manually, the
follow up patch contains configuration to utilize pre-commit to
automatically handle code style. This patch should be merged
along with the follow up patch to activate black.

Change-Id: I0267bf7127a320a02dc2dd3d6121d48be8eecbe2
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
docs/conf.py
docs_conf/__init__.py
docs_conf/conf.py
setup.py
tests/test_simple.py

index 0d3ab61..b5a9dd6 100644 (file)
 
 import os
 import sys
+
 # Sys.path for RTD to resolve docs_conf package
-sys.path.insert(0, os.path.abspath('..'))
+sys.path.insert(0, os.path.abspath(".."))
 
 from pbr.version import VersionInfo
 
 from docs_conf.conf import *
 
-version=str(VersionInfo('lfdocs-conf'))
-release=str(VersionInfo('lfdocs-conf'))
+version = str(VersionInfo("lfdocs-conf"))
+release = str(VersionInfo("lfdocs-conf"))
 
 linkcheck_ignore = [
     # The '#' in the path makes sphinx think it's an anchor
-    'https://gerrit.linuxfoundation.org/infra/#/admin/projects/releng/docs-conf',
+    "https://gerrit.linuxfoundation.org/infra/#/admin/projects/releng/docs-conf"
 ]
index 211e5ed..b429472 100644 (file)
@@ -13,5 +13,5 @@
 
 Configure sphinx-doc through an YAML file.
 """
-__author__ = 'Linux Foundation Releng'
-__summary__ = 'Linux Foundation DocsConf'
+__author__ = "Linux Foundation Releng"
+__summary__ = "Linux Foundation DocsConf"
index 395e653..d84f2ea 100644 (file)
@@ -44,23 +44,25 @@ def collect_project_and_config():
     Return the project name and merged configs from the calling project
     and per-project defaults.
     """
-    if not os.path.isfile('conf.yaml'):
+    if not os.path.isfile("conf.yaml"):
         raise IOError("No conf.yaml file found at: {}".format(os.getcwd()))
 
-    with open('conf.yaml', 'r') as f:
+    with open("conf.yaml", "r") as f:
         local_config = yaml.safe_load(f)
 
-    project_cfg = local_config.get('project_cfg', None)
+    project_cfg = local_config.get("project_cfg", None)
 
-    _, docs_path, _ = imp.find_module('docs_conf')
+    _, docs_path, _ = imp.find_module("docs_conf")
 
-    default_cfg = os.path.join(docs_path, 'defaults', 'default.yaml')
-    with open(os.path.join(docs_path, default_cfg), 'r') as f:
+    default_cfg = os.path.join(docs_path, "defaults", "default.yaml")
+    with open(os.path.join(docs_path, default_cfg), "r") as f:
         effective_config = yaml.safe_load(f)
 
-    project_cfg_file = os.path.join(docs_path, 'defaults', '{}.yaml'.format(project_cfg))
+    project_cfg_file = os.path.join(
+        docs_path, "defaults", "{}.yaml".format(project_cfg)
+    )
     if os.path.isfile(project_cfg_file):
-        with open(os.path.join(docs_path, project_cfg_file), 'r') as f:
+        with open(os.path.join(docs_path, project_cfg_file), "r") as f:
             _project_cfg_data = yaml.safe_load(f)
         effective_config = _merge_yaml(effective_config, _project_cfg_data)
 
@@ -72,45 +74,63 @@ def collect_project_and_config():
 cfg = collect_project_and_config()
 
 # Parse the config and pull in sphinx conf.py settings
-project = cfg.get('project')
-version = cfg.get('version')
-release = cfg.get('release', version)
-author = cfg.get('author')
-copyright = cfg.get('copyright')
-
-needs_sphinx = cfg.get('needs_sphinx', '1.0')
-exclude_patterns = cfg.get('exclude_patterns', [])
-extensions = cfg.get('extensions', [])
-language = cfg.get('language', None)
-master_doc = cfg.get('master_doc', 'index')
-pygments_style = cfg.get('pygments_style', 'sphinx')
-source_suffix = cfg.get('source_suffix', '.rst')
-templates_path = cfg.get('templates_path', ['_templates'])
-todo_include_todos = cfg.get('todo_include_todos', False)
-
-html_extra_path = cfg.get('html_extra_path', [])
-html_favicon = cfg.get('html_favicon', None)
-html_logo = cfg.get('html_logo', None)
-html_sidebars = cfg.get('html_sidebars', {'**': ['localtoc.html', 'relations.html'], })
-html_static_path = cfg.get('html_static_path', [])
-html_theme = cfg.get('html_theme', 'bootstrap')
-html_theme_options = cfg.get('html_theme_options', {
-    'bootswatch_theme': "cerulean",
-    'navbar_sidebarrel': False,
-    'source_link_position': "footer",
-})
-if html_theme == 'opnfv':
+project = cfg.get("project")
+version = cfg.get("version")
+release = cfg.get("release", version)
+author = cfg.get("author")
+copyright = cfg.get("copyright")
+
+needs_sphinx = cfg.get("needs_sphinx", "1.0")
+exclude_patterns = cfg.get("exclude_patterns", [])
+extensions = cfg.get("extensions", [])
+language = cfg.get("language", None)
+master_doc = cfg.get("master_doc", "index")
+pygments_style = cfg.get("pygments_style", "sphinx")
+source_suffix = cfg.get("source_suffix", ".rst")
+templates_path = cfg.get("templates_path", ["_templates"])
+todo_include_todos = cfg.get("todo_include_todos", False)
+
+html_extra_path = cfg.get("html_extra_path", [])
+html_favicon = cfg.get("html_favicon", None)
+html_logo = cfg.get("html_logo", None)
+html_sidebars = cfg.get("html_sidebars", {"**": ["localtoc.html", "relations.html"]})
+html_static_path = cfg.get("html_static_path", [])
+html_theme = cfg.get("html_theme", "bootstrap")
+html_theme_options = cfg.get(
+    "html_theme_options",
+    {
+        "bootswatch_theme": "cerulean",
+        "navbar_sidebarrel": False,
+        "source_link_position": "footer",
+    },
+)
+if html_theme == "opnfv":
     import sphinx_opnfv_theme
+
     html_theme_path = sphinx_opnfv_theme.get_html_theme_path()
 else:
-    html_theme_path = cfg.get('html_theme_path', sphinx_bootstrap_theme.get_html_theme_path())
-htmlhelp_basename = cfg.get('htmlhelp_basename', 'DocsConf')
+    html_theme_path = cfg.get(
+        "html_theme_path", sphinx_bootstrap_theme.get_html_theme_path()
+    )
+htmlhelp_basename = cfg.get("htmlhelp_basename", "DocsConf")
 
 intersphinx_mapping = {
-    'common-packer': ('https://docs.releng.linuxfoundation.org/projects/common-packer/en/latest/', None),
-    'global-jjb': ('https://docs.releng.linuxfoundation.org/projects/global-jjb/en/latest/', None),
-    'lfdocs': ('https://docs.releng.linuxfoundation.org/en/latest/', None),
-    'lfdocs-conf': ('https://docs.releng.linuxfoundation.org/projects/lfdocs-conf/en/latest/', None),
-    'lftools': ('https://docs.releng.linuxfoundation.org/projects/lftools/en/latest/', None),
-    'python': ('https://docs.python.org/3', None),
+    "common-packer": (
+        "https://docs.releng.linuxfoundation.org/projects/common-packer/en/latest/",
+        None,
+    ),
+    "global-jjb": (
+        "https://docs.releng.linuxfoundation.org/projects/global-jjb/en/latest/",
+        None,
+    ),
+    "lfdocs": ("https://docs.releng.linuxfoundation.org/en/latest/", None),
+    "lfdocs-conf": (
+        "https://docs.releng.linuxfoundation.org/projects/lfdocs-conf/en/latest/",
+        None,
+    ),
+    "lftools": (
+        "https://docs.releng.linuxfoundation.org/projects/lftools/en/latest/",
+        None,
+    ),
+    "python": ("https://docs.python.org/3", None),
 }
index 3c9c941..c23a404 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -4,12 +4,8 @@ Setup for Docs Configuration
 from setuptools import setup, find_packages
 
 
-with open('requirements.txt') as f:
+with open("requirements.txt") as f:
     install_reqs = f.read().splitlines()
 
 
-setup(
-    setup_requires=['pbr'],
-    pbr=True,
-    install_requires=install_reqs
-)
+setup(setup_requires=["pbr"], pbr=True, install_requires=install_reqs)
index 3f30995..3abcdbc 100644 (file)
@@ -17,19 +17,20 @@ import os
 import pytest
 import sys
 
+
 @pytest.fixture()
 def config(tmpdir):
     """
     Create a basic conf.py and conf.cfg file for each test
     """
     # Create the base 'conf.py'
-    confpy = tmpdir.join('conf.py')
+    confpy = tmpdir.join("conf.py")
     confpy.write("from docs_conf.conf import *")
 
     # Create conf.cfg file with test defaults
     # TODO: Make this dynamic so each test can set their own conf.cfg
     # config.
-    confcfg = tmpdir.join('conf.yaml')
+    confcfg = tmpdir.join("conf.yaml")
     confcfg.write("---\nproject: myproject\nauthor: Pythonista")
 
     # Change to the tmpdir location so relative file lookups succeed
@@ -37,17 +38,19 @@ def config(tmpdir):
 
     # Import the 'conf.py' file
     sys.path.append(str(tmpdir))
-    conf_module = importlib.import_module('conf')
+    conf_module = importlib.import_module("conf")
 
     return conf_module
 
+
 def test_config(config):
     """
     Assert some basic assumption about how configurations are pulled in
     """
-    assert config.project == 'myproject'
-    assert config.author == 'Pythonista'
-    #assert 'latex_documents' in dir(config)
+    assert config.project == "myproject"
+    assert config.author == "Pythonista"
+    # assert 'latex_documents' in dir(config)
+
 
 def test_defaults(config):
     """
@@ -57,6 +60,7 @@ def test_defaults(config):
     # TODO
     assert True
 
+
 def test_project_override(config):
     """
     Test that setting sphinx.project pulls in the project specific
@@ -65,6 +69,7 @@ def test_project_override(config):
     # TODO
     assert True
 
+
 def test_theme_import(config):
     """
     Test setting sphinx.html_theme_module imports the correct theme