Skip to content

Commit 8bae649

Browse files
committed
Ruff
1 parent e5c74db commit 8bae649

5 files changed

Lines changed: 14 additions & 12 deletions

File tree

dataflow_transfer/dataflow_transfer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import time
33

44
from dataflow_transfer.run_classes.registry import RUN_CLASS_REGISTRY
5-
from dataflow_transfer.utils.filesystem import get_run_dir, find_runs
5+
from dataflow_transfer.utils.filesystem import find_runs, get_run_dir
66

77
logger = logging.getLogger(__name__)
88

dataflow_transfer/run_classes/generic_runs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import os
21
import logging
2+
import os
33
import re
44
from datetime import datetime
5-
from dataflow_transfer.utils.statusdb import StatusdbSession
5+
66
import dataflow_transfer.utils.filesystem as fs
7+
from dataflow_transfer.utils.statusdb import StatusdbSession
78

89
logger = logging.getLogger(__name__)
910

dataflow_transfer/run_classes/illumina_runs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from dataflow_transfer.run_classes.generic_runs import Run
2+
23
from .registry import register_run_class
34

45

dataflow_transfer/tests/test_run_classes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import os
2+
23
import pytest
34

5+
from dataflow_transfer.run_classes import generic_runs, illumina_runs
46

5-
from dataflow_transfer.run_classes import illumina_runs, generic_runs
67
# TODO: add tests for ONT and ELEMENT runs when those are implemented
78

89

dataflow_transfer/utils/filesystem.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import json
22
import logging
33
import os
4-
import xmltodict
54
import subprocess
65

6+
import xmltodict
7+
78
logger = logging.getLogger(__name__)
89

910

@@ -40,9 +41,7 @@ def rsync_is_running(src):
4041
def submit_background_process(command_str: str):
4142
"""Submit a command string as a background process."""
4243

43-
background_process = subprocess.Popen(
44-
command_str, stdout=subprocess.PIPE, shell=True
45-
)
44+
subprocess.Popen(command_str, stdout=subprocess.PIPE, shell=True)
4645

4746

4847
def parse_metadata_files(files):
@@ -52,10 +51,10 @@ def parse_metadata_files(files):
5251
for file_path in files:
5352
try:
5453
if file_path.endswith(".json"):
55-
with open(file_path, "r") as f:
54+
with open(file_path) as f:
5655
metadata[os.path.basename(file_path)] = json.load(f)
5756
elif file_path.endswith(".xml"):
58-
with open(file_path, "r") as f:
57+
with open(file_path) as f:
5958
xml_content = xmltodict.parse(
6059
f.read(), attr_prefix="", cdata_key="text"
6160
)
@@ -71,10 +70,10 @@ def parse_metadata_files(files):
7170

7271

7372
def check_exit_status(file_path):
74-
"""Check the exit status from a given file.
73+
"""Check the exit status from a given file.
7574
Return True if exit code is 0, else False."""
7675
if os.path.exists(file_path):
77-
with open(file_path, "r") as f:
76+
with open(file_path) as f:
7877
exit_code = f.read().strip()
7978
if exit_code == "0":
8079
return True

0 commit comments

Comments
 (0)