Skip to content

Commit 5dc5f81

Browse files
committed
Apply black formatting settings to repo
1 parent 1ceaf6f commit 5dc5f81

19 files changed

+455
-213
lines changed

ad_email/ad_email.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- AdEmail
66
Send email to recipient via SMTP
77
"""
8+
89
import sys
910
import os
1011
import jinja2
@@ -111,7 +112,9 @@ def send_email(
111112
self.msg["Subject"] = email_subject
112113
self.msg["From"] = self.sender
113114
self.msg["To"] = recipients
114-
self.msg.attach(MIMEText(email_message, "html", "utf-8")) # Add msg to e-mail body
115+
self.msg.attach(
116+
MIMEText(email_message, "html", "utf-8")
117+
) # Add msg to e-mail body
115118
self.logger.info(self.logger.log_msgs["sending_email"], self.msg)
116119
# Configure SMTP server connection for sending email
117120
with smtplib.SMTP(

ad_email/test_ad_email.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
N.B. test_email_sending_success() will only pass when running on the
44
workstation where the required auth details are stored
55
"""
6+
67
import os
78
import pytest
89
from ad_email.ad_email import AdEmail
@@ -12,6 +13,7 @@
1213

1314
# TODO finish this test suite as it is currently incomplete
1415

16+
1517
@pytest.fixture(scope="function")
1618
def logger_obj():
1719
temp_log = os.path.join(test_data_temp, "temp.log")

ad_logger/ad_logger.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Automate demultiplex logging. Classes required for logging
33
"""
4+
45
import sys
56
import re
67
import logging
@@ -38,7 +39,7 @@ def set_root_logger() -> object:
3839
as the root logger will use these same syslog handler and stream handler
3940
:return logger: Logging object
4041
"""
41-
sensitive_formatter=SensitiveFormatter(get_logging_formatter())
42+
sensitive_formatter = SensitiveFormatter(get_logging_formatter())
4243
logger = logging.getLogger(AdLoggerConfig.REPO_NAME)
4344
stream_handler = logging.StreamHandler(sys.stdout)
4445
stream_handler.setFormatter(sensitive_formatter)
@@ -53,7 +54,7 @@ def set_root_logger() -> object:
5354
handlers=[
5455
stream_handler,
5556
syslog_handler,
56-
]
57+
],
5758
)
5859
return logger
5960

ad_logger/test_ad_logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
""" ad_logger.py pytest unit tests. The test suite is currently incomplete
22
"""
3+
34
import pytest
45
from toolbox import toolbox
56
from ad_logger import ad_logger
@@ -47,4 +48,3 @@ def test_get_loggers(self, logfiles_config, caplog):
4748
f"Test log message. Logger {loggers[logger_name].name}"
4849
)
4950
assert loggers[logger_name].name in caplog.text
50-

config/ad_config.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- ToolboxConfig
1010
- URConfig
1111
"""
12+
1213
import os
1314
import sys
1415
import datetime
@@ -86,7 +87,9 @@
8687
# DNAnexus upload agent path
8788
UPLOAD_AGENT_EXE = f"{DOCUMENT_ROOT}/apps/dnanexus-upload-agent-1.5.17-linux/ua"
8889
BCL2FASTQ_DOCKER = "seglh/bcl2fastq2:v2.20.0.422_60dbb5a"
89-
GATK_DOCKER = "broadinstitute/gatk:4.1.8.1" # TODO this image should have a hash added in future
90+
GATK_DOCKER = (
91+
"broadinstitute/gatk:4.1.8.1" # TODO this image should have a hash added in future
92+
)
9093

9194
LANE_METRICS_SUFFIX = ".illumina_lane_metrics"
9295
DEMUX_NOT_REQUIRED_MSG = "%s run. Does not need demultiplexing locally"
@@ -262,7 +265,10 @@
262265

263266
DX_CMDS = {
264267
"create_proj": 'PROJECT_ID="$(dx new project --bill-to %s "%s" --brief --auth ${AUTH})"',
265-
"find_proj_name": f"{SDK_SOURCE}; dx find projects --name *%s* " "--auth %s | awk '{print $3}'",
268+
"find_proj_name": (
269+
f"{SDK_SOURCE}; dx find projects --name *%s* "
270+
"--auth %s | awk '{print $3}'"
271+
),
266272
"proj_name_from_id": f"{SDK_SOURCE}; dx describe %s --auth %s --json | jq -r .name",
267273
"find_proj_id": f"{SDK_SOURCE}; dx describe %s --auth %s --json | jq -r .id",
268274
"find_execution_id": (
@@ -366,7 +372,7 @@ class DemultiplexConfig(PanelConfig):
366372
"checksums_do_not_match": "Checksums do not match", # Failure message written to md5sum file by integrity check scripts
367373
"samplesheet_success": "Samplesheet check successful with no errors identified: %s",
368374
"samplesheet_fail": "Processing halted. SampleSheet contains SampleSheet errors: %s ",
369-
"upload_flag_umis": "Runfolder contains UMIs. Runfolder will not be uploaded and requires manual upload: %s"
375+
"upload_flag_umis": "Runfolder contains UMIs. Runfolder will not be uploaded and requires manual upload: %s",
370376
}
371377
TESTING = TESTING
372378
BCL2FASTQ2_CMD = (
@@ -417,7 +423,7 @@ class SWConfig(PanelConfig):
417423
RUNFOLDERS = RUNFOLDERS
418424
PROD_ORGANISATION = "org-viapath_prod" # Prod org for billing
419425
if BRANCH == "main": # Prod branch
420-
426+
421427
BSPS_ID = "BSPS_MD"
422428
DNANEXUS_USERS = { # User access level
423429
# TODO remove InterpretationRequest user once per-user accounts set up
@@ -538,6 +544,7 @@ class ToolboxConfig(PanelConfig):
538544
"""
539545
Toolbox configuration
540546
"""
547+
541548
if BRANCH == "master":
542549
DNANEXUS_PROJECT_PREFIX = "002_" # Denotes production status of run
543550
else:
@@ -597,11 +604,13 @@ class URConfig:
597604
"upload_started": "Upload started", # Statement to write to DNAnexus upload started file
598605
}
599606

600-
class RunfolderCleanupConfig():
607+
608+
class RunfolderCleanupConfig:
601609
"""
602610
Runfolder Cleanup configuration
603611
"""
612+
604613
TIMESTAMP = TIMESTAMP
605614
RUNFOLDER_PATTERN = RUNFOLDER_PATTERN
606615
RUNFOLDERS = RUNFOLDERS
607-
CREDENTIALS = CREDENTIALS
616+
CREDENTIALS = CREDENTIALS

config/panel_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
dry_lab True if required to share with dry lab, None if not
4848
umis True if run has UMIs
4949
"""
50+
5051
# TODO in future do we want to swap physical paths for file IDs
5152

5253
TOOLS_PROJECT = "project-ByfFPz00jy1fk6PjpZ95F27J" # 001_ToolsReferenceData

conftest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
Variables used across test modules, including the setup and teardown fixture
33
that is run before and after every test. This is the top-level testing configuration
44
"""
5+
56
import os
67
import re
78
import shutil
89
import pytest
910
import tarfile
1011
import logging
1112
from shutil import copy
13+
1214
# sys.path.append("..")
1315
from ad_logger import ad_logger
1416
from toolbox import toolbox
@@ -65,6 +67,7 @@
6567
},
6668
]
6769

70+
6871
def patch_toolbox(monkeypatch):
6972
"""
7073
Apply patches required for toolbox script. These point the paths to the
@@ -103,7 +106,9 @@ def run_before_and_after_session():
103106
for destination in to_copy_interop_to:
104107
shutil.copytree(os.path.join(test_data_dir_unzipped, "InterOp"), destination)
105108

106-
test_data_unzipped = os.path.join(test_data_dir_unzipped, "demultiplex_test_files", "test_runfolders")
109+
test_data_unzipped = os.path.join(
110+
test_data_dir_unzipped, "demultiplex_test_files", "test_runfolders"
111+
)
107112

108113
directories = [
109114
os.path.join(test_data_unzipped, d)
@@ -114,7 +119,9 @@ def run_before_and_after_session():
114119

115120
for directory in directories:
116121
if re.match(".*999999_.*", directory):
117-
fastqs_dir = os.path.join(test_data_unzipped, directory, "Data", "Intensities", "BaseCalls/")
122+
fastqs_dir = os.path.join(
123+
test_data_unzipped, directory, "Data", "Intensities", "BaseCalls/"
124+
)
118125
os.makedirs(fastqs_dir, exist_ok=True)
119126
copy(dummy_fastq, fastqs_dir)
120127
yield # Where the testing happens

0 commit comments

Comments
 (0)