Skip to content

Commit

Permalink
ruff manual changes
Browse files Browse the repository at this point in the history
  • Loading branch information
javierggt committed Mar 12, 2024
1 parent 6d4a40e commit 2c9631c
Show file tree
Hide file tree
Showing 18 changed files with 167 additions and 90 deletions.
4 changes: 2 additions & 2 deletions actions/build/files/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ def main():
if not tmp_dir.exists():
tmp_dir.mkdir()
with tempfile.TemporaryDirectory(dir=tmp_dir) as tmp_dir:
tmp_dir = pathlib.Path(tmp_dir)
skare3_path = tmp_dir / "skare3"
tmp_path = pathlib.Path(tmp_dir)
skare3_path = tmp_path / "skare3"
print(f"skare3_path: {skare3_path}")

# fetch skare3
Expand Down
5 changes: 4 additions & 1 deletion skare3_tools/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""
Skare3-tools configuration.
The configuration is automatically set with default values which specify the location of the skare3
repository, the different conda channels used, the Github organizations who own the packages, and
the directory where to store cached data. This happens the first time this module is imported.
Expand Down Expand Up @@ -113,14 +115,15 @@ def _app_data_dir_():

def init(config=None, reset=False):
"""
Initialize config.
:param config: dict.
A dictionary with configuration entries (used to "update" the current config, not replace).
:param reset: bool.
Flag to "reset" the configuration (from defaults).
:return:
"""
global CONFIG
global CONFIG # noqa: PLW0603
app_data_dir = _app_data_dir_()
if app_data_dir is None:
raise Exception(
Expand Down
1 change: 1 addition & 0 deletions skare3_tools/dashboard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Tools to display package information on web pages.
Most implementation is in the :mod:`~skare3_tools.dashboard.views` submodule.
"""

Expand Down
4 changes: 3 additions & 1 deletion skare3_tools/dashboard/views/test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

def html(text):
"""
Convert colorized text to html.
This assumes an input from the terminal and replaces some standard characters so they are
interpreted in html:
- some ANSI escape codes (https://en.wikipedia.org/wiki/ANSI_escape_code#Colors)
Expand Down Expand Up @@ -61,7 +63,7 @@ def html(text):
result = ""
depth = 0
i = 0
matches = [m for m in re.finditer(r"\x1b\[[0-9;]+m", text)]
matches = list(re.finditer(r"\x1b\[[0-9;]+m", text))
for m in matches:
s, e = m.span()
c = text[s:e]
Expand Down
2 changes: 1 addition & 1 deletion skare3_tools/dashboard/views/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def main():
with open(args.file_in, "r") as f:
results = json.load(f)
for key in ["architecture", "hostname", "system", "platform"]:
if type(results["run_info"][key]) is list:
if isinstance(results["run_info"][key], list):
results["run_info"][key] = ", ".join(results["run_info"][key])

with open(args.file_out, "w") as out:
Expand Down
2 changes: 1 addition & 1 deletion skare3_tools/dashboard/views/test_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_stream():
tests["test_suites"] = {t["name"]: t for t in tests["test_suites"]}

test_suite_names = sorted(
set(sum([[k for k in t["test_suites"].keys()] for t in test_runs], []))
set(sum([list(t["test_suites"].keys()) for t in test_runs], []))
)
test_suites = []
column_names = [str(i) for i in range(len(test_runs))]
Expand Down
Loading

0 comments on commit 2c9631c

Please sign in to comment.