Skip to content

Commit 0a0e1e6

Browse files
committed
fix: apply ruff formatting to code style
1 parent 0b09522 commit 0a0e1e6

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/clinical_dbs_annotator/ui/amplitude_split_widget.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def get_amplitude_text(self) -> str:
110110
e.g. ``"1.5_1.0"``.
111111
"""
112112
total_text = self._amp_edit.text().strip()
113-
113+
114114
# For single or no cathode, return total amplitude
115115
if len(self._cathode_labels) <= 1:
116116
return total_text
@@ -161,9 +161,9 @@ def _rebuild_rows(self) -> None:
161161
self._clear_rows()
162162

163163
# Check if we have a single grouped contact (E1, E2, etc.)
164-
if (len(self._cathode_labels) == 1 and
165-
len(self._cathode_labels[0]) >= 2 and
166-
self._cathode_labels[0][0] == 'E' and
164+
if (len(self._cathode_labels) == 1 and
165+
len(self._cathode_labels[0]) >= 2 and
166+
self._cathode_labels[0][0] == 'E' and
167167
self._cathode_labels[0][1:].isdigit()):
168168
# Create segment rows for grouped contact
169169
self._create_segment_rows_only(self._cathode_labels[0])
@@ -233,7 +233,7 @@ def _create_segment_rows_only(self, parent_lbl: str) -> None:
233233

234234
for seg_idx, seg_label in enumerate(seg_labels):
235235
seg_lbl = f"{parent_lbl}{seg_label}"
236-
236+
237237
row_w = QWidget()
238238
row_layout = QHBoxLayout(row_w)
239239
row_layout.setContentsMargins(20, 0, 0, 0) # Regular indentation (not extra)
@@ -285,7 +285,7 @@ def _create_segment_rows_only(self, parent_lbl: str) -> None:
285285
self._rows[seg_lbl] = (row_w, pct_edit, ma_label)
286286
self._layout.addWidget(row_w)
287287

288-
288+
289289
def _on_pct_edited(self, edited_label: str) -> None:
290290
"""Called when user finishes editing a percentage field."""
291291
self._read_and_rebalance(edited_label)
@@ -437,7 +437,7 @@ def get_cathode_labels(canvas) -> list[str]:
437437
for contact_idx in range(model.num_contacts):
438438
# Check if this contact level is directional (has segments)
439439
is_contact_directional = model.is_level_directional(contact_idx)
440-
440+
441441
if is_contact_directional:
442442
# This contact has segments - check individual segments
443443
seg_states = [

src/clinical_dbs_annotator/views/step1_view.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ def _is_single_grouped_directional(self, cathode_labels: list[str], canvas) -> b
125125
"""Check if a single cathode label represents a grouped directional contact."""
126126
if len(cathode_labels) != 1 or not canvas or not canvas.model:
127127
return False
128-
128+
129129
lbl = cathode_labels[0]
130130
# Check if this is a grouped contact (no segment suffix) that could be directional
131131
if len(lbl) >= 2 and lbl[0] == 'E' and lbl[1:].isdigit():
132132
try:
133133
contact_idx = int(lbl[1:])
134-
return (canvas.model.is_directional and
134+
return (canvas.model.is_directional and
135135
canvas.model.is_level_directional(contact_idx))
136136
except (ValueError, IndexError):
137137
pass
@@ -635,7 +635,7 @@ def _get_anode_cathode_texts(self, canvas: ElectrodeCanvas) -> tuple[str, str]:
635635
for contact_idx in range(model.num_contacts):
636636
# Check if this contact level is directional (has segments)
637637
is_contact_directional = model.is_level_directional(contact_idx)
638-
638+
639639
if is_contact_directional:
640640
# This contact has segments - check individual segments
641641
seg_states = [canvas.contact_states.get((contact_idx, seg), ContactState.OFF) for seg in range(3)]

src/clinical_dbs_annotator/views/step3_view.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,11 @@ def _get_anode_cathode_texts(self, canvas: ElectrodeCanvas) -> tuple[str, str]:
529529
for contact_idx in range(model.num_contacts):
530530
# Check if this contact level is directional (has segments)
531531
is_contact_directional = model.is_level_directional(contact_idx)
532-
532+
533533
if is_contact_directional:
534534
# This contact has segments - check individual segments
535535
seg_states = [canvas.contact_states.get((contact_idx, seg), ContactState.OFF) for seg in range(3)]
536-
536+
537537
# Always show individual segments, never group them
538538
seg_labels = ["a", "b", "c"]
539539
for seg, seg_state in enumerate(seg_states):
@@ -563,25 +563,25 @@ def _is_single_grouped_directional(self, cathode_labels: list[str], canvas) -> b
563563
"""Check if we have a single grouped directional contact (all 3 segments selected)."""
564564
if len(cathode_labels) != 1:
565565
return False
566-
566+
567567
lbl = cathode_labels[0]
568568
# Check if this is a grouped contact (E1, E2, etc., not E1a, E1b)
569569
is_grouped = (len(lbl) >= 2 and lbl[0] == 'E' and lbl[1:].isdigit())
570-
570+
571571
if not is_grouped:
572572
return False
573-
573+
574574
# Verify that this contact actually has all 3 segments selected on the canvas
575575
try:
576576
contact_idx = int(lbl[1:])
577577
model = canvas.model
578578
if not model or not model.is_directional:
579579
return False
580-
580+
581581
# Check if this contact level is directional
582582
if not model.is_level_directional(contact_idx):
583583
return False
584-
584+
585585
# Check if all 3 segments are cathodic
586586
seg_states = [
587587
canvas.contact_states.get((contact_idx, seg), ContactState.OFF)

0 commit comments

Comments
 (0)