Skip to content

Commit

Permalink
Add Zuul job python-black and format Python files (#19)
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Neumann <[email protected]>
  • Loading branch information
sbstnnmnn authored Nov 15, 2023
1 parent cff26c0 commit d9c2b84
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
jobs:
- flake8
- hadolint
- python-black
gate:
jobs:
- flake8
- hadolint
- python-black
periodic-daily:
jobs:
- flake8
- hadolint
- python-black
21 changes: 12 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@

template_service = environment.get_template("service.j2")
fp = open(f"/output/{SERVICE}.rst", "w+")
template_data = {
"name": SERVICE,
"sections": sorted(groups.keys())
}
template_data = {"name": SERVICE, "sections": sorted(groups.keys())}
fp.write(template_service.render(template_data))

template = environment.get_template("confval.j2")
for name, data in groups.items():
_, options = data['namespaces'][0]
_, options = data["namespaces"][0]

if not options:
next
Expand All @@ -44,7 +41,10 @@
option_type = "Boolean"
elif isinstance(option.type, types.Integer):
if option.type.min and option.type.max:
option_type = "Integer, ``>= %d``, ``<= %d``" % (option.type.min, option.type.max)
option_type = "Integer, ``>= %d``, ``<= %d``" % (
option.type.min,
option.type.max,
)
elif option.type.min:
option_type = "Integer, ``>= %d``" % option.type.min
elif option.type.max:
Expand All @@ -53,7 +53,10 @@
option_type = "Integer"
elif isinstance(option.type, types.Float):
if option.type.min and option.type.max:
option_type = "Float, ``>= %.2f``, <= ``%.2f``" % (option.type.min, option.type.max)
option_type = "Float, ``>= %.2f``, <= ``%.2f``" % (
option.type.min,
option.type.max,
)
elif option.type.min:
option_type = "Float, ``>= %.2f``" % option.type.min
elif option.type.max:
Expand All @@ -77,8 +80,8 @@
fp = open(f"/output/{SERVICE}-{name}.rst", "w+")
template_data = {
"name": name,
"options": sorted(options, key=attrgetter('name')),
"types": option_types
"options": sorted(options, key=attrgetter("name")),
"types": option_types,
}
fp.write(template.render(template_data))

Expand Down
52 changes: 24 additions & 28 deletions output/conf.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
extensions = [
'sphinx_toolbox.confval'
]
source_suffix = '.rst'
master_doc = 'index'
project = u'Reference'
copyright = u'2021-2023, OSISM GmbH'
author = u'OSISM GmbH'
version = u''
release = u''
language = 'en'
extensions = ["sphinx_toolbox.confval"]
source_suffix = ".rst"
master_doc = "index"
project = "Reference"
copyright = "2021-2023, OSISM GmbH"
author = "OSISM GmbH"
version = ""
release = ""
language = "en"
exclude_patterns = []
pygments_style = 'sphinx'
pygments_style = "sphinx"
todo_include_todos = True
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"
html_show_sphinx = False
html_show_sourcelink = False
html_show_copyright = True
htmlhelp_basename = 'documentation'
htmlhelp_basename = "documentation"
html_theme_options = {
'display_version': False,
'canonical_url': 'https://docs.osism.tech/reference/',
'style_external_links': True,
'logo_only': True,
'prev_next_buttons_location': None
"display_version": False,
"canonical_url": "https://docs.osism.tech/reference/",
"style_external_links": True,
"logo_only": True,
"prev_next_buttons_location": None,
}
html_context = {
'display_github': True,
'github_user': 'osism',
'github_repo': 'openstack-configuration-reference',
'github_version': 'main',
'conf_py_path': '/output/'
"display_github": True,
"github_user": "osism",
"github_repo": "openstack-configuration-reference",
"github_version": "main",
"conf_py_path": "/output/",
}
html_logo = 'images/logo.png'
html_static_path = [
'_static'
]
html_logo = "images/logo.png"
html_static_path = ["_static"]
latex_elements = {}

0 comments on commit d9c2b84

Please sign in to comment.