Skip to content

Add Zuul job python-black and format Python files #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = {}