Skip to content

Commit ae1a78c

Browse files
committed
style(scripts): apply Ruff formatter
1 parent 672e953 commit ae1a78c

4 files changed

Lines changed: 30 additions & 12 deletions

File tree

krakenparser/stats/diversity.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ def main() -> None:
133133
)
134134
args = parser.parse_args()
135135

136-
seed_label = str(args.seed) if args.seed is not None else "not set (results will vary between runs)"
136+
seed_label = (
137+
str(args.seed)
138+
if args.seed is not None
139+
else "not set (results will vary between runs)"
140+
)
137141
_log.info("Rarefaction depth: %d | seed: %s", args.depth, seed_label)
138142

139143
input_file = Path(args.input)

tests/test_cli.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333

3434
def test_convert2csv_main(counts_txt_file, tmp_path, monkeypatch):
3535
out = tmp_path / "out.csv"
36-
monkeypatch.setattr(sys, "argv", ["c2c", "-i", str(counts_txt_file), "-o", str(out)])
36+
monkeypatch.setattr(
37+
sys, "argv", ["c2c", "-i", str(counts_txt_file), "-o", str(out)]
38+
)
3739
convert2csv_main()
3840
assert out.exists()
3941

@@ -96,9 +98,7 @@ def test_mpa_table_main(tmp_path, monkeypatch):
9698
a.write_text(_MPA_A)
9799
b.write_text(_MPA_B)
98100
out = tmp_path / "COMBINED.txt"
99-
monkeypatch.setattr(
100-
sys, "argv", ["mt", "-i", str(a), str(b), "-o", str(out)]
101-
)
101+
monkeypatch.setattr(sys, "argv", ["mt", "-i", str(a), str(b), "-o", str(out)])
102102
mpa_table_main()
103103
assert out.exists()
104104

@@ -110,9 +110,7 @@ def test_mpa_table_main(tmp_path, monkeypatch):
110110

111111
def test_transform2mpa_main_single(kreport_file, tmp_path, monkeypatch):
112112
out = tmp_path / "out.MPA.TXT"
113-
monkeypatch.setattr(
114-
sys, "argv", ["t2m", "-r", str(kreport_file), "-o", str(out)]
115-
)
113+
monkeypatch.setattr(sys, "argv", ["t2m", "-r", str(kreport_file), "-o", str(out)])
116114
transform2mpa_main()
117115
assert out.exists()
118116

@@ -139,7 +137,17 @@ def test_diversity_main_with_seed(counts_csv_file, tmp_path, monkeypatch):
139137
monkeypatch.setattr(
140138
sys,
141139
"argv",
142-
["div", "-i", str(counts_csv_file), "-o", str(out_dir), "-d", "1000", "-s", "42"],
140+
[
141+
"div",
142+
"-i",
143+
str(counts_csv_file),
144+
"-o",
145+
str(out_dir),
146+
"-d",
147+
"1000",
148+
"-s",
149+
"42",
150+
],
143151
)
144152
diversity_main()
145153
assert (out_dir / "alpha_div.csv").exists()
@@ -148,7 +156,9 @@ def test_diversity_main_with_seed(counts_csv_file, tmp_path, monkeypatch):
148156
def test_diversity_main_no_seed(counts_csv_file, tmp_path, monkeypatch):
149157
out_dir = tmp_path / "div"
150158
monkeypatch.setattr(
151-
sys, "argv", ["div", "-i", str(counts_csv_file), "-o", str(out_dir), "-d", "1000"]
159+
sys,
160+
"argv",
161+
["div", "-i", str(counts_csv_file), "-o", str(out_dir), "-d", "1000"],
152162
)
153163
diversity_main()
154164

tests/test_integration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,9 @@ def test_combine_mpa_missing_input_raises(tmp_path):
429429
existing = tmp_path / "a.MPA.TXT"
430430
existing.write_text(SAMPLE_MPA_A)
431431
with pytest.raises(FileNotFoundError):
432-
combine_mpa([str(existing), str(tmp_path / "ghost.MPA.TXT")], str(tmp_path / "out.txt"))
432+
combine_mpa(
433+
[str(existing), str(tmp_path / "ghost.MPA.TXT")], str(tmp_path / "out.txt")
434+
)
433435

434436

435437
# ---------------------------------------------------------------------------

tests/test_units.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ def test_strip_path_prefix_tab_less_line():
162162

163163

164164
def test_strip_path_prefix_normal():
165-
assert _strip_path_prefix("d__Bacteria|s__E_coli\t100\t200") == "s__E_coli\t100\t200"
165+
assert (
166+
_strip_path_prefix("d__Bacteria|s__E_coli\t100\t200") == "s__E_coli\t100\t200"
167+
)
166168

167169

168170
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)