Skip to content

Commit d57c079

Browse files
committed
appease ruff
1 parent f73035d commit d57c079

File tree

9 files changed

+27
-28
lines changed

9 files changed

+27
-28
lines changed

autotest/test_build.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def test_build(function_tmpdir, target: str) -> None:
6060
pm.target = target
6161
pm.inplace = True
6262
fc = os.environ.get("FC", "gfortran")
63-
assert (
64-
pymake.build_apps(target, pm, verbose=True, clean=False) == 0
65-
), f"could not compile {target}"
63+
assert pymake.build_apps(target, pm, verbose=True, clean=False) == 0, (
64+
f"could not compile {target}"
65+
)
6666

6767

6868
@pytest.mark.base
@@ -73,9 +73,9 @@ def test_meson_build(function_tmpdir, target: str) -> None:
7373
cc = os.environ.get("CC", "gcc")
7474
pymake.linker_update_environment(cc=cc, fc=fc)
7575
with set_dir(function_tmpdir):
76-
assert (
77-
pymake.build_apps(target, verbose=True, clean=False, meson=True) == 0
78-
), f"could not compile {target}"
76+
assert pymake.build_apps(target, verbose=True, clean=False, meson=True) == 0, (
77+
f"could not compile {target}"
78+
)
7979

8080

8181
@pytest.mark.base

autotest/test_cli_cmds.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ def run_cli_cmd(cmd: list) -> None:
3636
stderr = stderr.decode()
3737
print(stderr)
3838

39-
assert (
40-
process.returncode == 0
41-
), f"'{' '.join(cmd)}' failed\n\tstatus code {process.returncode}\n"
39+
assert process.returncode == 0, (
40+
f"'{' '.join(cmd)}' failed\n\tstatus code {process.returncode}\n"
41+
)
4242
return
4343

4444

autotest/test_gridgen.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,6 @@ def test_compile(pm, target):
9191
],
9292
)
9393
def test_gridgen(cmd, workspace, target):
94-
assert run_gridgen(
95-
cmd, workspace / "examples" / "biscayne", target
96-
), f"could not run {cmd}"
94+
assert run_gridgen(cmd, workspace / "examples" / "biscayne", target), (
95+
f"could not run {cmd}"
96+
)

autotest/test_mf6_existing_meson.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import sys
33
from pathlib import Path
44
from platform import system
5-
from typing import List
65

76
import pytest
87
from modflow_devtools.misc import set_dir
@@ -15,7 +14,7 @@
1514

1615

1716
@pytest.fixture(scope="module")
18-
def targets() -> List[Path]:
17+
def targets() -> list[Path]:
1918
target = TARGET_NAME
2019
ext, shared_ext = get_binary_suffixes()
2120
executables = [target, "zbud6", "mf5to6", "libmf6"]
@@ -90,9 +89,9 @@ def test_build_with_existing_meson(pm, module_tmpdir, workspace, targets):
9089

9190
# make modflow 6 with existing meson.build file
9291
returncode = pymake.meson_build(workspace, fc, cc, appdir=pm.appdir)
93-
assert (
94-
returncode == 0
95-
), "could not build modflow 6 applications using existing meson.build file"
92+
assert returncode == 0, (
93+
"could not build modflow 6 applications using existing meson.build file"
94+
)
9695

9796
# check that all of the executables exist
9897
for executable in targets:

autotest/test_requests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def run_cli_cmd(cmd: list) -> None:
6565
stderr = stderr.decode()
6666
print(stderr)
6767

68-
assert (
69-
process.returncode == 0
70-
), f"'{' '.join(cmd)}' failed\n\tstatus code {process.returncode}\n"
68+
assert process.returncode == 0, (
69+
f"'{' '.join(cmd)}' failed\n\tstatus code {process.returncode}\n"
70+
)
7171

7272

7373
@pytest.mark.dependency("latest_version")

pymake/utils/_compiler_language_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def _get_fortran_files(srcfiles, extensions=False):
2222
list of fortran files or unique fortran file extensions
2323
2424
"""
25-
if isinstance(srcfiles, (str,)):
25+
if isinstance(srcfiles, str):
2626
srcfiles = [srcfiles]
2727
files_out = []
2828
for srcfile in srcfiles:

pymake/utils/_file_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def _get_extra_exclude_files(external_file):
2020
if external_file is None:
2121
files = None
2222
else:
23-
if isinstance(external_file, (list, tuple)):
23+
if isinstance(external_file, list | tuple):
2424
files = external_file
2525
elif os.path.isfile(external_file):
2626
efpth = os.path.dirname(external_file)

pymake/utils/_usgs_src_update.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ def _update_vs2dt_files(srcdir, fc, cc, arch, double):
666666

667667

668668
def _update_mf6_files(
669-
srcdir: Union[str, os.PathLike],
669+
srcdir: str | os.PathLike,
670670
fc: str,
671671
cc: str,
672672
arch: str,
@@ -699,7 +699,7 @@ def _update_mf6_files(
699699

700700

701701
def _update_libmf6_files(
702-
srcdir: Union[str, os.PathLike],
702+
srcdir: str | os.PathLike,
703703
fc: str,
704704
cc: str,
705705
arch: str,
@@ -733,7 +733,7 @@ def _update_libmf6_files(
733733

734734
# common source file replacement functions
735735
def _update_mf6_external_dependencies(
736-
srcdir: Union[str, os.PathLike],
736+
srcdir: str | os.PathLike,
737737
target: str = "mf6",
738738
) -> None:
739739
"""

pymake/utils/download.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def compressall(
143143
if dir_pths is None:
144144
dir_pths = []
145145
else:
146-
if isinstance(dir_pths, (str, Path)):
146+
if isinstance(dir_pths, str | Path):
147147
dir_pths = [dir_pths]
148148

149149
# convert find to a list if a str (a tuple is allowed)
@@ -862,7 +862,7 @@ def getmfexes(
862862
download_dir = os.path.join(".", "download_dir")
863863
if isinstance(exes, str):
864864
exes = tuple(exes)
865-
elif isinstance(exes, (int, float)):
865+
elif isinstance(exes, int | float):
866866
msg = "exes keyword must be a string or a list/tuple of strings"
867867
raise TypeError(msg)
868868

@@ -944,7 +944,7 @@ def getmfnightly(
944944
download_dir = os.path.join(".", "download_dir")
945945
if isinstance(exes, str):
946946
exes = tuple(exes)
947-
elif isinstance(exes, (int, float)):
947+
elif isinstance(exes, int | float):
948948
msg = "exes keyword must be a string or a list/tuple of strings"
949949
raise TypeError(msg)
950950

0 commit comments

Comments
 (0)