Skip to content

Commit 048c781

Browse files
authored
Merge pull request #461 from kedhammar/ruff
Ruff format
2 parents 3c6e004 + d1d21f6 commit 048c781

File tree

9 files changed

+25
-22
lines changed

9 files changed

+25
-22
lines changed

VERSIONLOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# TACA Version Log
22

3-
## 20241216.1
3+
## 20250122.1
4+
5+
Ruff formatting.
6+
7+
## 20241216.2
48

59
Do not run ToulligQC if its output directory can be found.
610

taca/cleanup/cleanup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,13 @@ def _def_get_size_unit(s):
571571
gb = mb * 1000
572572
tb = gb * 1000
573573
if s > tb:
574-
s = f"~{int(s/tb)}tb"
574+
s = f"~{int(s / tb)}tb"
575575
elif s > gb:
576-
s = f"~{int(s/gb)}gb"
576+
s = f"~{int(s / gb)}gb"
577577
elif s > mb:
578-
s = f"~{int(s/mb)}mb"
578+
s = f"~{int(s / mb)}mb"
579579
elif s > kb:
580-
s = f"~{int(s/kb)}kb"
580+
s = f"~{int(s / kb)}kb"
581581
elif s > 0:
582582
s = f"~{int(s)}b"
583583
return str(s)

taca/element/Element_Runs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@ def make_demux_manifests(
437437

438438
# Get '[SAMPLES]' section
439439
split_contents = manifest_contents.split("[SAMPLES]")
440-
assert (
441-
len(split_contents) == 2
442-
), f"Could not split sample rows out of manifest {manifest_contents}"
440+
assert len(split_contents) == 2, (
441+
f"Could not split sample rows out of manifest {manifest_contents}"
442+
)
443443
sample_section = split_contents[1].strip().split("\n")
444444

445445
# Split into header and rows
@@ -560,7 +560,7 @@ def make_demux_manifests(
560560
"[RUNVALUES]",
561561
"KeyName, Value",
562562
f"manifest_file, {file_name}",
563-
f"manifest_group, {n+1}/{len(grouped_df)}",
563+
f"manifest_group, {n + 1}/{len(grouped_df)}",
564564
f"built_from, {manifest_to_split}",
565565
]
566566
)

taca/nanopore/ONT_run_classes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ def __init__(self, run_abspath: str):
3737
None # This will be defined upon instantiation of a child class
3838
)
3939

40-
assert re.match(
41-
ONT_RUN_PATTERN, self.run_name
42-
), f"Run {self.run_name} doesn't look like a run dir"
40+
assert re.match(ONT_RUN_PATTERN, self.run_name), (
41+
f"Run {self.run_name} doesn't look like a run dir"
42+
)
4343

4444
# Parse MinKNOW sample and experiment name
4545
with open(self.get_file("/run_path.txt")) as stream:
@@ -143,9 +143,9 @@ def touch_db_entry(self):
143143
pore_count_history_file = os.path.join(
144144
self.run_abspath, "pore_count_history.csv"
145145
)
146-
assert os.path.isfile(
147-
pore_count_history_file
148-
), f"Couldn't find {pore_count_history_file}"
146+
assert os.path.isfile(pore_count_history_file), (
147+
f"Couldn't find {pore_count_history_file}"
148+
)
149149

150150
self.db.create_ongoing_run(self, run_path_file, pore_count_history_file)
151151
logger.info(

taca/utils/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def query_yes_no(question, default="yes", force=False):
176176
elif choice in valid:
177177
return valid[choice]
178178
else:
179-
sys.stdout.write('Please respond with "yes" or "no" ' '(or "y" or "n").\n')
179+
sys.stdout.write('Please respond with "yes" or "no" (or "y" or "n").\n')
180180

181181

182182
def return_unique(seq):

taca/utils/statusdb.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ def merge_dicts(d1, d2):
225225
pass # same leaf value
226226
else:
227227
logger.debug(
228-
f"Values for key {key} in d1 and d2 differ, "
229-
"using the value of d1"
228+
f"Values for key {key} in d1 and d2 differ, using the value of d1"
230229
)
231230
else:
232231
d1[key] = d2[key]

taca/utils/transfer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def transfer(self):
269269
# If we are not overwriting, return False
270270
if not self.overwrite:
271271
logger.debug(
272-
f'target "{self.dest_path}" exists and will not be ' "overwritten"
272+
f'target "{self.dest_path}" exists and will not be overwritten'
273273
)
274274
return False
275275
# If the target is a mount, let's not mess with it

tests/nanopore/test_ONT_run_classes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def create_ONT_run_dir(
171171
"unknown_positive",
172172
"zero",
173173
]:
174-
f.write(f"{state},{i},{i*100}\n")
174+
f.write(f"{state},{i},{i * 100}\n")
175175

176176
if sync_finished:
177177
open(f"{run_path}/.sync_finished", "w").close()

tests/nanopore/test_instrument_transfer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,15 @@ def test_dump_pore_count_history(setup_test_fixture):
398398

399399
# Nothing to add, no file
400400
tmp = tempfile.TemporaryDirectory()
401-
run_path = tmp.name + f"/experiment/sample/{DUMMY_RUN_NAME.replace('TEST','FLG')}"
401+
run_path = tmp.name + f"/experiment/sample/{DUMMY_RUN_NAME.replace('TEST', 'FLG')}"
402402
os.makedirs(run_path)
403403
new_file = instrument_transfer.dump_pore_count_history(run_path, pore_counts)
404404
assert open(new_file).read() == ""
405405
tmp.cleanup()
406406

407407
# Nothing to add, file is present
408408
tmp = tempfile.TemporaryDirectory()
409-
run_path = tmp.name + f"/experiment/sample/{DUMMY_RUN_NAME.replace('TEST','FLG')}"
409+
run_path = tmp.name + f"/experiment/sample/{DUMMY_RUN_NAME.replace('TEST', 'FLG')}"
410410
os.makedirs(run_path)
411411
open(run_path + "/pore_count_history.csv", "w").write("test")
412412
new_file = instrument_transfer.dump_pore_count_history(run_path, pore_counts)

0 commit comments

Comments
 (0)