Skip to content

Commit 84c3bbd

Browse files
authored
Upgrade black to 24.3.0 (#3618)
Recommended by dependabot due to a CVE (which doesn't really affect us). On the whole, the changes caused by this new version seem trivial and innocuous (like adding blank lines after file docstrings) or minor improvements in readability (the new wrapping of compound dict references and broken ternary expressions). This supercedes dependabot's #3453.
1 parent c695339 commit 84c3bbd

36 files changed

+60
-29
lines changed

contrib/analysis/sos_collection.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,10 @@ def sync_process_sos(self, combined_data: dict):
333333
else:
334334
self.seen_sos_valid[sosreport] = extracted_sos_data
335335
else:
336-
combined_data["sosreports"][sosreport][
337-
"extracted_sos"
338-
] = self.seen_sos_invalid[sosreport]
336+
combined_data["sosreports"][sosreport]["extracted_sos"] = (
337+
self.seen_sos_invalid[sosreport]
338+
)
339339
else:
340-
combined_data["sosreports"][sosreport][
341-
"extracted_sos"
342-
] = self.seen_sos_valid[sosreport]
340+
combined_data["sosreports"][sosreport]["extracted_sos"] = (
341+
self.seen_sos_valid[sosreport]
342+
)

lib/pbench/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, cfg_name):
3232
try:
3333
self.logger_host = self._conf.get("logging", "logger_host")
3434
self.logger_port = self._conf.get("logging", "logger_port")
35-
except (NoOptionError) as exc:
35+
except NoOptionError as exc:
3636
raise BadConfig(str(exc))
3737

3838
try:

lib/pbench/agent/redis_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Redis Convenience classes
22
"""
3+
34
import json
45
import logging
56
import time

lib/pbench/agent/tool_meister.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,9 +1779,7 @@ def sysinfo(self, data: Dict[str, str]) -> int:
17791779
self._send_client_status(
17801780
"success"
17811781
if failures == 0
1782-
else f"{failures} failures sending sysinfo data"
1783-
if not msg
1784-
else msg
1782+
else f"{failures} failures sending sysinfo data" if not msg else msg
17851783
)
17861784

17871785
return failures

lib/pbench/agent/tool_meister_start.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,9 +1105,11 @@ def start(_prog: str, cli_params: Namespace) -> int:
11051105
tm = dict(
11061106
benchmark_run_dir=str(benchmark_run_dir),
11071107
channel_prefix=cli_tm_channel_prefix,
1108-
tds_hostname=params["origin_host"]
1109-
if "origin_host" in params
1110-
else tool_data_sink.host,
1108+
tds_hostname=(
1109+
params["origin_host"]
1110+
if "origin_host" in params
1111+
else tool_data_sink.host
1112+
),
11111113
tds_port=tool_data_sink.port,
11121114
controller=full_hostname,
11131115
tool_group=tool_group.name,

lib/pbench/agent/toolmetadata.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
Classes for working with and manipulating the tool-scripts/meta.json file.
44
"""
5+
56
import json
67

78

lib/pbench/cli/agent/commands/results/clear.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
pbench-clear-results
33
"""
4+
45
import shutil
56
import sys
67

lib/pbench/cli/agent/commands/triggers/list.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
triggers from a specific group.
66
77
"""
8+
89
import sys
910

1011
import click

lib/pbench/cli/agent/commands/triggers/register.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
directory.
1111
1212
"""
13+
1314
import logging
1415
import sys
1516

lib/pbench/common/configtools.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
""" Configtools """
2+
23
from __future__ import print_function
34

45
# python3
@@ -34,9 +35,11 @@ def file_list(root):
3435
rootdir = os.path.dirname(root)
3536
flist = [root]
3637
dirlist = [
37-
os.path.abspath("%s/%s" % (rootdir, x))
38-
if not os.path.isabs(x)
39-
else os.path.abspath(x)
38+
(
39+
os.path.abspath("%s/%s" % (rootdir, x))
40+
if not os.path.isabs(x)
41+
else os.path.abspath(x)
42+
)
4043
for x in dirlist
4144
]
4245
# insert the directory of the root file at the beginning
@@ -221,7 +224,7 @@ def main(conf, args, opts, files):
221224
print("[%s]" % sec)
222225
items = conf.items(sec)
223226
items.sort()
224-
for (n, v) in items:
227+
for n, v in items:
225228
print("%s = %s" % (n, v))
226229
print()
227230
return 0

lib/pbench/common/selinux.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
1313
[1] https://github.com/pycontribs/selinux
1414
"""
15+
1516
try:
1617
import selinux
1718
except ImportError:

lib/pbench/common/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Utility functions common to both agent and server.
33
"""
4+
45
from collections import deque
56
from functools import partial
67
import hashlib

lib/pbench/server/database/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
For any new database model added in the models directory an import statement
44
of the same is required here.
55
"""
6+
67
from pbench.server.database.database import Database
78
from pbench.server.database.models.api_keys import APIKey # noqa F401
89
from pbench.server.database.models.audit import Audit # noqa F401

lib/pbench/server/database/alembic/versions/1a91bc68d6de_update_api_key.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Create Date: 2023-05-03 09:50:29.609672
77
88
"""
9+
910
from alembic import op
1011
import sqlalchemy as sa
1112

lib/pbench/server/database/alembic/versions/313cfbf6e74b_index_map.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2023-08-10 20:31:22.937542
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011

lib/pbench/server/database/alembic/versions/558608818623_warningstate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Create Date: 2024-04-03 12:07:47.018612
88
99
"""
10+
1011
from alembic import op
1112

1213
# revision identifiers, used by Alembic.

lib/pbench/server/database/alembic/versions/5679217a62bb_sync_message.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2023-04-18 20:03:26.080554
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011

lib/pbench/server/database/alembic/versions/80c8c690f09b_api_key.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Create Date: 2023-04-11 19:20:36.892126
77
88
"""
9+
910
from alembic import op
1011
import sqlalchemy as sa
1112
from sqlalchemy.dialects import postgresql

lib/pbench/server/database/alembic/versions/9cc638cb865c_operationname.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
Create Date: 2023-03-03 14:32:16.955897
99
1010
"""
11+
1112
from alembic import op
1213

1314
# revision identifiers, used by Alembic.

lib/pbench/server/database/alembic/versions/9df060db17de_tokens_store_expiration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2023-02-05 15:58:25.408754
66
77
"""
8+
89
from alembic import op
910

1011
# Revision identifiers, used by Alembic.

lib/pbench/server/database/alembic/versions/e6b44fb7c065_rework_database_models_and_class_names.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Revises: fa12f45a2a5a
55
Create Date: 2023-01-23 20:44:32.238138
66
"""
7+
78
from alembic import op
89

910
# revision identifiers, used by Alembic.

lib/pbench/server/database/alembic/versions/f628657bed56_user_table_update_oidc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2023-02-26 23:24:16.650879
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011
from sqlalchemy.dialects import postgresql

lib/pbench/server/database/alembic/versions/fa12f45a2a5a_initial_database_schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
6a764f154. That commit was the latest working version of the Pbench Server
1111
deployed in Red Hat's staging environment.
1212
"""
13+
1314
from alembic import op
1415
import sqlalchemy as sa
1516

lib/pbench/server/database/alembic/versions/ffcc6daffedb_drop_doc_ids.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Create Date: 2024-01-30 19:33:14.976874
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011
from sqlalchemy.dialects import postgresql

lib/pbench/server/database/models/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def decode_sql_error(
6161
fallback: Optional[Callable[[Exception], Exception]] = None,
6262
**kwargs
6363
) -> Exception:
64-
6564
"""Analyze an exception for a SQL constraint violation
6665
6766
Analyzes SQLAlchemy IntegrityException instances for NOT NULL and UNIQUE

lib/pbench/server/database/models/audit.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ def query(
292292
dataset: Optional[Dataset] = None,
293293
**kwargs,
294294
) -> "list[Audit]":
295-
296295
"""Return a list of Audit objects matching the query parameters.
297296
298297
The definition allows an exact search based on any column of the table

lib/pbench/server/database/models/server_settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
The list of available settings are defined by the OPTION_* variables of this
88
module.
99
"""
10+
1011
import re
1112
from typing import Optional
1213

lib/pbench/server/indexer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3336,9 +3336,9 @@ def __init__(
33363336
except configparser.NoOptionError:
33373337
pass
33383338
else:
3339-
self.at_metadata[
3340-
"tar-ball-creation-timestamp"
3341-
] = PbenchTarBall.convert_to_dt(tb_ts_str)[1]
3339+
self.at_metadata["tar-ball-creation-timestamp"] = (
3340+
PbenchTarBall.convert_to_dt(tb_ts_str)[1]
3341+
)
33423342
try:
33433343
raw_size = self.mdconf.get("run", "raw_size")
33443344
except configparser.NoOptionError:

lib/pbench/test/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Common test support functions."""
2+
23
import json
34
from pathlib import Path
45
from typing import Callable, Dict

lib/pbench/test/unit/agent/test_tool_meister_stop.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for the Tool Meister "stop" module.
22
"""
3+
34
from pbench.agent.tool_meister_stop import RedisServer
45

56

lib/pbench/test/unit/agent/test_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for the utils module.
22
"""
3+
34
import os
45
import signal
56
import time

lib/pbench/test/unit/common/test_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Test PbenchConfig class and objects
22
"""
3+
34
from configparser import ConfigParser, NoOptionError, NoSectionError
45
from typing import Any, Dict, List
56

lib/pbench/test/unit/common/test_wait_for_uri.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test wait_for_uri() module method"""
2+
23
from contextlib import contextmanager
34
import socket
45
from typing import Tuple

lib/pbench/test/unit/server/test_relay.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -477,17 +477,21 @@ def test_delete_failures(
477477
responses.add(
478478
responses.DELETE,
479479
"https://relay.example.com/uri1",
480-
status=status1[0]
481-
if isinstance(status1[0], int)
482-
else HTTPStatus.ALREADY_REPORTED,
480+
status=(
481+
status1[0]
482+
if isinstance(status1[0], int)
483+
else HTTPStatus.ALREADY_REPORTED
484+
),
483485
body=status1[0] if isinstance(status1[0], Exception) else None,
484486
)
485487
responses.add(
486488
responses.DELETE,
487489
"https://relay.example.com/uri2",
488-
status=status2[0]
489-
if isinstance(status2[0], int)
490-
else HTTPStatus.ALREADY_REPORTED,
490+
status=(
491+
status2[0]
492+
if isinstance(status2[0], int)
493+
else HTTPStatus.ALREADY_REPORTED
494+
),
491495
body=status2[0] if isinstance(status2[0], Exception) else None,
492496
)
493497
response = client.post(

lib/pbench/test/unit/server/test_shell_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test the Gunicorn driver module, `shell`, to ensure it is usable."""
2+
23
from configparser import NoOptionError, NoSectionError
34
import logging
45
import os

lint-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
black==22.12.0
1+
black==24.3.0
22
flake8==6.0.0
33
isort==5.12.0

0 commit comments

Comments
 (0)