Skip to content

Commit ab996c2

Browse files
authored
Fix style issues flagged by formatter (#562)
Style checks are currently failing: https://github.com/MIT-LCP/wfdb-python/actions/runs/21638973652/job/62372710762 This pull request fixes the pre-existing style issues by: - Removing extra blank lines, - Removing unnecessary parentheses in tuple unpacking - Reformatting multi-line exception strings
2 parents 8a5ae7e + d35192b commit ab996c2

File tree

7 files changed

+13
-20
lines changed

7 files changed

+13
-20
lines changed

tests/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import numpy as np
22

3-
43
_np_error_state = {}
54

65

wfdb/io/_coreio.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from wfdb.io import _url
66
from wfdb.io.download import config
77

8-
98
# Cloud protocols
109
CLOUD_PROTOCOLS = ["az://", "azureml://", "s3://", "gs://"]
1110

wfdb/io/_url.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from wfdb.version import __version__
1111

12-
1312
# Value for 'buffering' indicating that the entire file should be
1413
# buffered at once.
1514
BUFFER_WHOLE_FILE = -2
@@ -486,7 +485,7 @@ def _read_range(self, start, end):
486485
if buffer_store:
487486
# Load data into buffer and then return a copy to the
488487
# caller.
489-
(start, data) = xfer.content()
488+
start, data = xfer.content()
490489
self._buffer = data
491490
self._buffer_start = start
492491
self._buffer_end = start + len(data)
@@ -767,7 +766,7 @@ def openurl(
767766
(io.BufferedIOBase) or text file API (io.TextIOBase).
768767
769768
"""
770-
(scheme, netloc, path, _, _, _) = urllib.parse.urlparse(url)
769+
scheme, netloc, path, _, _, _ = urllib.parse.urlparse(url)
771770
if scheme == "":
772771
raise NetFileError("no scheme specified for URL: %r" % (url,), url=url)
773772

wfdb/io/annotation.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,9 @@ def convert_label_attribute(
14691469
return
14701470

14711471
label_map = self.create_label_map(inplace=False)
1472-
label_map.set_index(keys=pd.Index(label_map[source_field].values), inplace=True)
1472+
label_map.set_index(
1473+
keys=pd.Index(label_map[source_field].values), inplace=True
1474+
)
14731475

14741476
try:
14751477
target_item = label_map.loc[
@@ -1959,7 +1961,7 @@ def rdann(
19591961
filebytes = load_byte_pairs(record_name, extension, pn_dir)
19601962

19611963
# Get WFDB annotation fields from the file bytes
1962-
(sample, label_store, subtype, chan, num, aux_note) = proc_ann_bytes(
1964+
sample, label_store, subtype, chan, num, aux_note = proc_ann_bytes(
19631965
filebytes, sampto
19641966
)
19651967

@@ -1970,17 +1972,17 @@ def rdann(
19701972
)
19711973

19721974
# Try to extract information describing the annotation file
1973-
(fs, custom_labels) = interpret_defintion_annotations(
1975+
fs, custom_labels = interpret_defintion_annotations(
19741976
potential_definition_inds, aux_note
19751977
)
19761978

19771979
# Remove annotations that do not store actual sample and label information
1978-
(sample, label_store, subtype, chan, num, aux_note) = rm_empty_indices(
1980+
sample, label_store, subtype, chan, num, aux_note = rm_empty_indices(
19791981
rm_inds, sample, label_store, subtype, chan, num, aux_note
19801982
)
19811983

19821984
# Convert lists to numpy arrays dtype='int'
1983-
(label_store, subtype, chan, num) = lists_to_int_arrays(
1985+
label_store, subtype, chan, num = lists_to_int_arrays(
19841986
label_store, subtype, chan, num
19851987
)
19861988

wfdb/io/convert/csv.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -625,20 +625,16 @@ def csv2ann(
625625
df_CSV.columns = ["onset", "duration", "description"]
626626
df_out = format_ann_from_df(df_CSV)
627627
else:
628-
raise Exception(
629-
"""The number of columns in the CSV was not
630-
recognized."""
631-
)
628+
raise Exception("""The number of columns in the CSV was not
629+
recognized.""")
632630

633631
# Remove extension from input file name
634632
file_name = file_name.split(".")[0]
635633
if time_onset:
636634
if not fs:
637-
raise Exception(
638-
"""`fs` must be provided if `time_onset` is True
635+
raise Exception("""`fs` must be provided if `time_onset` is True
639636
since it is required to convert time onsets to
640-
samples"""
641-
)
637+
samples""")
642638
sample = (df_out["onset"].to_numpy() * fs).astype(np.int64)
643639
else:
644640
sample = df_out["onset"].to_numpy()

wfdb/io/download.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from wfdb.io import _url
99

10-
1110
# The PhysioNet index url
1211
PN_INDEX_URL = "https://physionet.org/files/"
1312
PN_CONTENT_URL = "https://physionet.org/content/"

wfdb/io/record.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from wfdb.io import util
1717
from wfdb.io._coreio import CLOUD_PROTOCOLS
1818

19-
2019
# -------------- WFDB Signal Calibration and Classification ---------- #
2120

2221

0 commit comments

Comments
 (0)