Skip to content
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

Upgrade black to 24.3.0 #3618

Merged
merged 1 commit into from
Apr 19, 2024
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
12 changes: 6 additions & 6 deletions contrib/analysis/sos_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ def sync_process_sos(self, combined_data: dict):
else:
self.seen_sos_valid[sosreport] = extracted_sos_data
else:
combined_data["sosreports"][sosreport][
"extracted_sos"
] = self.seen_sos_invalid[sosreport]
combined_data["sosreports"][sosreport]["extracted_sos"] = (
self.seen_sos_invalid[sosreport]
)
else:
combined_data["sosreports"][sosreport][
"extracted_sos"
] = self.seen_sos_valid[sosreport]
combined_data["sosreports"][sosreport]["extracted_sos"] = (
self.seen_sos_valid[sosreport]
)
2 changes: 1 addition & 1 deletion lib/pbench/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, cfg_name):
try:
self.logger_host = self._conf.get("logging", "logger_host")
self.logger_port = self._conf.get("logging", "logger_port")
except (NoOptionError) as exc:
except NoOptionError as exc:
raise BadConfig(str(exc))

try:
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/agent/redis_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Redis Convenience classes
"""

import json
import logging
import time
Expand Down
4 changes: 1 addition & 3 deletions lib/pbench/agent/tool_meister.py
Original file line number Diff line number Diff line change
Expand Up @@ -1779,9 +1779,7 @@ def sysinfo(self, data: Dict[str, str]) -> int:
self._send_client_status(
"success"
if failures == 0
else f"{failures} failures sending sysinfo data"
if not msg
else msg
else f"{failures} failures sending sysinfo data" if not msg else msg
)

return failures
Expand Down
8 changes: 5 additions & 3 deletions lib/pbench/agent/tool_meister_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,9 +1105,11 @@ def start(_prog: str, cli_params: Namespace) -> int:
tm = dict(
benchmark_run_dir=str(benchmark_run_dir),
channel_prefix=cli_tm_channel_prefix,
tds_hostname=params["origin_host"]
if "origin_host" in params
else tool_data_sink.host,
tds_hostname=(
params["origin_host"]
if "origin_host" in params
else tool_data_sink.host
),
tds_port=tool_data_sink.port,
controller=full_hostname,
tool_group=tool_group.name,
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/agent/toolmetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Classes for working with and manipulating the tool-scripts/meta.json file.
"""

import json


Expand Down
1 change: 1 addition & 0 deletions lib/pbench/cli/agent/commands/results/clear.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
pbench-clear-results
"""

import shutil
import sys

Expand Down
1 change: 1 addition & 0 deletions lib/pbench/cli/agent/commands/triggers/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
triggers from a specific group.

"""

import sys

import click
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/cli/agent/commands/triggers/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
directory.

"""

import logging
import sys

Expand Down
11 changes: 7 additions & 4 deletions lib/pbench/common/configtools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Configtools """

from __future__ import print_function

# python3
Expand Down Expand Up @@ -34,9 +35,11 @@ def file_list(root):
rootdir = os.path.dirname(root)
flist = [root]
dirlist = [
os.path.abspath("%s/%s" % (rootdir, x))
if not os.path.isabs(x)
else os.path.abspath(x)
(
os.path.abspath("%s/%s" % (rootdir, x))
if not os.path.isabs(x)
else os.path.abspath(x)
)
for x in dirlist
]
webbnh marked this conversation as resolved.
Show resolved Hide resolved
# insert the directory of the root file at the beginning
Expand Down Expand Up @@ -221,7 +224,7 @@ def main(conf, args, opts, files):
print("[%s]" % sec)
items = conf.items(sec)
items.sort()
for (n, v) in items:
for n, v in items:
print("%s = %s" % (n, v))
print()
return 0
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/common/selinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

[1] https://github.com/pycontribs/selinux
"""

try:
import selinux
except ImportError:
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/common/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Utility functions common to both agent and server.
"""

from collections import deque
from functools import partial
import hashlib
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/server/database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
For any new database model added in the models directory an import statement
of the same is required here.
"""

from pbench.server.database.database import Database
from pbench.server.database.models.api_keys import APIKey # noqa F401
from pbench.server.database.models.audit import Audit # noqa F401
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create Date: 2023-05-03 09:50:29.609672

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-08-10 20:31:22.937542

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Create Date: 2024-04-03 12:07:47.018612

"""

from alembic import op

# revision identifiers, used by Alembic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-04-18 20:03:26.080554

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Create Date: 2023-04-11 19:20:36.892126

"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Create Date: 2023-03-03 14:32:16.955897

"""

from alembic import op

# revision identifiers, used by Alembic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-02-05 15:58:25.408754

"""

from alembic import op

# Revision identifiers, used by Alembic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Revises: fa12f45a2a5a
Create Date: 2023-01-23 20:44:32.238138
"""

from alembic import op

# revision identifiers, used by Alembic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-02-26 23:24:16.650879

"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
6a764f154. That commit was the latest working version of the Pbench Server
deployed in Red Hat's staging environment.
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-01-30 19:33:14.976874

"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
Expand Down
1 change: 0 additions & 1 deletion lib/pbench/server/database/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def decode_sql_error(
fallback: Optional[Callable[[Exception], Exception]] = None,
**kwargs
) -> Exception:

"""Analyze an exception for a SQL constraint violation

Analyzes SQLAlchemy IntegrityException instances for NOT NULL and UNIQUE
Expand Down
1 change: 0 additions & 1 deletion lib/pbench/server/database/models/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ def query(
dataset: Optional[Dataset] = None,
**kwargs,
) -> "list[Audit]":

"""Return a list of Audit objects matching the query parameters.

The definition allows an exact search based on any column of the table
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/server/database/models/server_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
The list of available settings are defined by the OPTION_* variables of this
module.
"""

import re
from typing import Optional

Expand Down
6 changes: 3 additions & 3 deletions lib/pbench/server/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3336,9 +3336,9 @@ def __init__(
except configparser.NoOptionError:
pass
else:
self.at_metadata[
"tar-ball-creation-timestamp"
] = PbenchTarBall.convert_to_dt(tb_ts_str)[1]
self.at_metadata["tar-ball-creation-timestamp"] = (
PbenchTarBall.convert_to_dt(tb_ts_str)[1]
)
try:
raw_size = self.mdconf.get("run", "raw_size")
except configparser.NoOptionError:
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Common test support functions."""

import json
from pathlib import Path
from typing import Callable, Dict
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/test/unit/agent/test_tool_meister_stop.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for the Tool Meister "stop" module.
"""

from pbench.agent.tool_meister_stop import RedisServer


Expand Down
1 change: 1 addition & 0 deletions lib/pbench/test/unit/agent/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for the utils module.
"""

import os
import signal
import time
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/test/unit/common/test_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test PbenchConfig class and objects
"""

from configparser import ConfigParser, NoOptionError, NoSectionError
from typing import Any, Dict, List

Expand Down
1 change: 1 addition & 0 deletions lib/pbench/test/unit/common/test_wait_for_uri.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test wait_for_uri() module method"""

from contextlib import contextmanager
import socket
from typing import Tuple
Expand Down
16 changes: 10 additions & 6 deletions lib/pbench/test/unit/server/test_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,17 +477,21 @@ def test_delete_failures(
responses.add(
responses.DELETE,
"https://relay.example.com/uri1",
status=status1[0]
if isinstance(status1[0], int)
else HTTPStatus.ALREADY_REPORTED,
status=(
status1[0]
if isinstance(status1[0], int)
else HTTPStatus.ALREADY_REPORTED
),
body=status1[0] if isinstance(status1[0], Exception) else None,
)
responses.add(
responses.DELETE,
"https://relay.example.com/uri2",
status=status2[0]
if isinstance(status2[0], int)
else HTTPStatus.ALREADY_REPORTED,
status=(
status2[0]
if isinstance(status2[0], int)
else HTTPStatus.ALREADY_REPORTED
),
body=status2[0] if isinstance(status2[0], Exception) else None,
)
response = client.post(
Expand Down
1 change: 1 addition & 0 deletions lib/pbench/test/unit/server/test_shell_cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the Gunicorn driver module, `shell`, to ensure it is usable."""

from configparser import NoOptionError, NoSectionError
import logging
import os
Expand Down
2 changes: 1 addition & 1 deletion lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
black==22.12.0
black==24.3.0
flake8==6.0.0
isort==5.12.0
Loading