Skip to content

Commit 3a2eae4

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 9662339 commit 3a2eae4

13 files changed

Lines changed: 20 additions & 30 deletions

File tree

‎.github/workflows/validate_release_tag.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def get_version_from_module(content: str) -> str:
3333
parser = argparse.ArgumentParser()
3434
parser.add_argument("GITHUB_REF", help="The GITHUB_REF environmental variable")
3535
args = parser.parse_args()
36-
assert args.GITHUB_REF.startswith(
37-
"refs/tags/v"
38-
), f'GITHUB_REF should start with "refs/tags/v": {args.GITHUB_REF}'
36+
assert args.GITHUB_REF.startswith("refs/tags/v"), (
37+
f'GITHUB_REF should start with "refs/tags/v": {args.GITHUB_REF}'
38+
)
3939
tag_version = args.GITHUB_REF[11:]
4040
package_version = get_version_from_module(
4141
Path("aiida_hyperqueue/__init__.py").read_text(encoding="utf-8")

‎aiida_hyperqueue/cli/alloc.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import click
2-
32
from aiida.cmdline.params import arguments, options
43
from aiida.cmdline.utils import echo
54

@@ -59,8 +58,8 @@ def cmd_add(
5958

6059
with computer.get_transport() as transport:
6160
retval, _, stderr = transport.exec_command_wait(
62-
f'hq alloc add slurm --backlog {backlog} --time-limit {time_limit} --name ahq {hyper} '
63-
f'--workers-per-alloc {workers_per_alloc} -- {" ".join(slurm_options)}'
61+
f"hq alloc add slurm --backlog {backlog} --time-limit {time_limit} --name ahq {hyper} "
62+
f"--workers-per-alloc {workers_per_alloc} -- {' '.join(slurm_options)}"
6463
)
6564

6665
if retval != 0:

‎aiida_hyperqueue/cli/install.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import click
66
import requests
7-
87
from aiida import orm
98
from aiida.cmdline.utils import echo
109

@@ -66,8 +65,7 @@ def cmd_install(
6665
tar_path = temp_dir / "hq.tar.gz"
6766

6867
with open(tar_path, "wb") as f:
69-
for chunk in response.iter_content(chunk_size=8192):
70-
f.write(chunk)
68+
f.writelines(response.iter_content(chunk_size=8192))
7169

7270
with tarfile.open(tar_path, "r") as tar:
7371
tar.extractall(path=temp_dir)

‎aiida_hyperqueue/cli/params/options.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import functools
44

55
import click
6-
76
from aiida.cmdline.params import options as core_options
87
from aiida.cmdline.params import types as core_types
98

‎aiida_hyperqueue/cli/root.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
import click
6-
76
from aiida.cmdline.groups.verdi import VerdiCommandGroup
87

98
from .params import options

‎aiida_hyperqueue/cli/server.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import click
2-
32
from aiida.cmdline.utils import echo
43

54
from .params import arguments

‎aiida_hyperqueue/scheduler.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def _parse_submit_output(self, retval: int, stdout: str, stderr: str) -> str:
215215
)
216216

217217
def _get_joblist_command(
218-
self, jobs: t.Optional[list] = None, user: t.Optional[str] = None
218+
self, jobs: list | None = None, user: str | None = None
219219
) -> str:
220220
"""Return the ``hq`` command for listing the active jobs.
221221
@@ -255,7 +255,7 @@ def _parse_joblist_output(self, retval: int, stdout: str, stderr: str) -> list:
255255
hq_job_dict["id"]
256256
) # must be str, if it is a int job will not waiting
257257
job_info.title = hq_job_dict["name"]
258-
stats: t.List[str] = [
258+
stats: list[str] = [
259259
stat for stat, v in hq_job_dict["task_stats"].items() if v > 0
260260
]
261261
if hq_job_dict["task_count"] != 1 or len(stats) != 1:

‎docs/source/conf.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
import time
1414

15-
import aiida_hyperqueue
16-
1715
from aiida import load_profile
1816
from aiida.storage.sqlite_temp import SqliteTempBackend
1917

18+
import aiida_hyperqueue
19+
2020
# -- AiiDA-related setup --------------------------------------------------
2121
temp_profile = SqliteTempBackend.create_profile("temp-profile")
2222
load_profile(temp_profile, allow_switch=True)
@@ -71,9 +71,7 @@
7171
else f"{copyright_first_year}-{current_year}"
7272
)
7373
# pylint: disable=redefined-builtin
74-
copyright = "{}, {}. All rights reserved".format(
75-
copyright_year_string, copyright_owners
76-
)
74+
copyright = f"{copyright_year_string}, {copyright_owners}. All rights reserved"
7775

7876
# The version info for the project you're documenting, acts as replacement for
7977
# |version| and |release|, also used in various other places throughout the

‎tests/conftest.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import signal
55
import subprocess
66
import time
7+
from collections.abc import Iterable
78
from dataclasses import dataclass
89
from pathlib import Path
9-
from collections.abc import Iterable
1010

1111
import pytest
1212

@@ -103,9 +103,7 @@ def check_running_processes(self):
103103
for p in self.processes:
104104
if p.final_check and p.process.poll() is not None:
105105
raise Exception(
106-
"Process {0} crashed (log in {1}/{0}.out)".format(
107-
p.name, self.work_path
108-
)
106+
f"Process {p.name} crashed (log in {self.work_path}/{p.name}.out)"
109107
)
110108

111109
def kill_all(self):

‎tests/test_cli_alloc.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
2-
from click.testing import CliRunner
3-
42
from aiida.transports.transport import Transport as TransportClass
3+
from click.testing import CliRunner
54

65

76
@pytest.fixture

0 commit comments

Comments
 (0)