Skip to content

Commit e9b1b93

Browse files
committed
Add code formatter
1 parent 2fdc77e commit e9b1b93

File tree

11 files changed

+49
-32
lines changed

11 files changed

+49
-32
lines changed

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"sphinx_design",
3939
"sphinx_inline_tabs",
4040
"sphinx_copybutton",
41-
"exasol.toolbox.sphinx.multiversion"
41+
"exasol.toolbox.sphinx.multiversion",
4242
]
4343

4444
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}

doc/user_guide/modules/sphinx/multiversion/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Sphinx configuration file."""
2+
23
import time
34

45
author = "Jan Holthuis"

exasol/toolbox/metrics.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,14 @@ def char(value: str, default: str = "H") -> str:
157157
return value[0]
158158
return default
159159

160-
weight = {"LL": 1/18, "LM": 1/15, "LH": 1/12, "ML": 1/9, "MM": 1/6, "MH": 1/3}
160+
weight = {
161+
"LL": 1 / 18,
162+
"LM": 1 / 15,
163+
"LH": 1 / 12,
164+
"ML": 1 / 9,
165+
"MM": 1 / 6,
166+
"MH": 1 / 3,
167+
}
161168
exp = 0.0
162169
for infos in ratings:
163170
severity = infos["issue_severity"]

exasol/toolbox/nox/_lint.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
def _pylint(session: Session, files: Iterable[str]) -> None:
1313
session.run(
14-
"poetry",
15-
"run",
16-
"python",
17-
"-m",
18-
"pylint",
19-
"--output-format",
20-
"colorized,json:.lint.json,text:.lint.txt",
21-
*files)
14+
"poetry",
15+
"run",
16+
"python",
17+
"-m",
18+
"pylint",
19+
"--output-format",
20+
"colorized,json:.lint.json,text:.lint.txt",
21+
*files,
22+
)
2223

2324

2425
def _type_check(session: Session, files: Iterable[str]) -> None:

exasol/toolbox/nox/_shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _context(session: Session, **kwargs: Any) -> MutableMapping[str, Any]:
6565
parser = _context_parser()
6666
namespace, args = parser.parse_known_args(session.posargs)
6767
cli_context: MutableMapping[str, Any] = vars(namespace)
68-
cli_context['fwd-args'] = args
68+
cli_context["fwd-args"] = args
6969
default_context = {"db_version": "7.1.9", "coverage": False}
7070
# Note: ChainMap scans last to first
7171
return ChainMap(kwargs, cli_context, default_context)

exasol/toolbox/nox/_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _test_command(
2828
else []
2929
)
3030
pytest_command = ["pytest", "-v", f"{path}"]
31-
return base_command + coverage_command + pytest_command + context['fwd-args']
31+
return base_command + coverage_command + pytest_command + context["fwd-args"]
3232

3333

3434
def _unit_tests(

exasol/toolbox/sphinx/multiversion/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
The original version and its defaults were minimally adjusted to work in Exasol's projects with the defaults and without adding an extra template. The [Shibuya](https://github.com/lepture/shibuya) theme is expected to be used for HTML, which already evaluates the versions field in the HTML context and generates an appropriate selector for the versions.
1616
"""
1717

18-
from exasol.toolbox.version import VERSION
1918
from exasol.toolbox.sphinx.multiversion.main import main
2019
from exasol.toolbox.sphinx.multiversion.sphinx import setup
20+
from exasol.toolbox.version import VERSION
2121

2222
__version__ = VERSION
2323

exasol/toolbox/sphinx/multiversion/sphinx.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from sphinx.locale import _
1010
from sphinx.util import i18n as sphinx_i18n
1111

12+
from exasol.toolbox.version import VERSION
13+
1214
logger = logging.getLogger(__name__)
1315

1416
DATE_FMT = "%Y-%m-%d %H:%M:%S %z"
@@ -136,11 +138,13 @@ def in_development(self):
136138
def __iter__(self):
137139
tags = (
138140
ExasolVersionTag(tag)
139-
for tag in self.tags if ExasolVersionTag.is_valid_tag(tag)
141+
for tag in self.tags
142+
if ExasolVersionTag.is_valid_tag(tag)
140143
)
141144
yield from self.branches
142145
yield from [
143-
t.version for t in sorted(tags, key=lambda t: t.version_triple, reverse=True)
146+
t.version
147+
for t in sorted(tags, key=lambda t: t.version_triple, reverse=True)
144148
]
145149

146150
def __getitem__(self, name):
@@ -167,22 +171,19 @@ def vpathto(self, other_version_name):
167171
other_outputroot = os.path.abspath(other_version["outputdir"])
168172
outputroot = os.path.commonpath((current_outputroot, other_outputroot))
169173

170-
current_outputroot = os.path.relpath(
171-
current_outputroot, start=outputroot)
174+
current_outputroot = os.path.relpath(current_outputroot, start=outputroot)
172175
other_outputroot = os.path.relpath(other_outputroot, start=outputroot)
173176

174177
# Ensure that we use POSIX separators in the path (for the HTML code)
175178
if os.sep != posixpath.sep:
176-
current_outputroot = posixpath.join(
177-
*os.path.split(current_outputroot))
179+
current_outputroot = posixpath.join(*os.path.split(current_outputroot))
178180
other_outputroot = posixpath.join(*os.path.split(other_outputroot))
179181

180182
# Find relative path to root of other_version's outputdir
181183
current_outputdir = posixpath.dirname(
182184
posixpath.join(current_outputroot, self.context["pagename"])
183185
)
184-
other_outputdir = posixpath.relpath(
185-
other_outputroot, start=current_outputdir)
186+
other_outputdir = posixpath.relpath(other_outputroot, start=current_outputdir)
186187

187188
if not self.vhasdoc(other_version_name):
188189
return posixpath.join(other_outputdir, "index.html")
@@ -284,14 +285,10 @@ def setup(app):
284285
app.add_config_value("smv_current_version", "", "html")
285286
app.add_config_value("smv_latest_version", "master", "html")
286287
app.add_config_value("smv_tag_whitelist", DEFAULT_TAG_WHITELIST, "html")
287-
app.add_config_value("smv_branch_whitelist",
288-
DEFAULT_BRANCH_WHITELIST, "html")
289-
app.add_config_value("smv_remote_whitelist",
290-
DEFAULT_REMOTE_WHITELIST, "html")
291-
app.add_config_value("smv_released_pattern",
292-
DEFAULT_RELEASED_PATTERN, "html")
293-
app.add_config_value("smv_outputdir_format",
294-
DEFAULT_OUTPUTDIR_FORMAT, "html")
288+
app.add_config_value("smv_branch_whitelist", DEFAULT_BRANCH_WHITELIST, "html")
289+
app.add_config_value("smv_remote_whitelist", DEFAULT_REMOTE_WHITELIST, "html")
290+
app.add_config_value("smv_released_pattern", DEFAULT_RELEASED_PATTERN, "html")
291+
app.add_config_value("smv_outputdir_format", DEFAULT_OUTPUTDIR_FORMAT, "html")
295292
app.add_config_value("smv_build_targets", DEFAULT_BUILD_TARGETS, "html")
296293
app.add_config_value(
297294
"smv_clean_intermediate_files",
@@ -301,7 +298,7 @@ def setup(app):
301298
app.connect("config-inited", config_inited)
302299

303300
return {
304-
"version": "0.2",
301+
"version": VERSION,
305302
"parallel_read_safe": True,
306303
"parallel_write_safe": True,
307304
}

exasol/toolbox/tools/security.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""This module contains security related CLI tools and code"""
2+
23
import json
34
import re
45
import subprocess

noxconfig.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Configuration for nox based task runner"""
2+
23
from __future__ import annotations
34

45
from dataclasses import dataclass
@@ -35,8 +36,15 @@ class Config:
3536
root: Path = Path(__file__).parent
3637
doc: Path = Path(__file__).parent / "doc"
3738
version_file: Path = Path(__file__).parent / "exasol" / "toolbox" / "version.py"
38-
path_filters: Iterable[str] = ("dist", ".eggs", "venv", "metrics-schema", "project-template", "idioms")
39+
path_filters: Iterable[str] = (
40+
"dist",
41+
".eggs",
42+
"venv",
43+
"metrics-schema",
44+
"project-template",
45+
"idioms",
46+
)
3947
plugins = [UpdateTemplates]
40-
48+
4149

4250
PROJECT_CONFIG = Config()

0 commit comments

Comments
 (0)