Skip to content

Commit e5cf563

Browse files
audristroyerclaude
andcommitted
Fix black/ruff formatting across src and tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6cc0410 commit e5cf563

7 files changed

Lines changed: 18 additions & 30 deletions

File tree

src/ndi/cloud/api/files.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ def get_file_details(
175175
)
176176

177177

178-
179-
180178
def get_file_collection_upload_url(
181179
client: CloudClient,
182180
org_id: str,

src/ndi/cloud/download.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@ def _log(msg: str) -> None:
182182
return report
183183

184184

185-
186-
187185
def _download_chunk_zip(
188186
url: str,
189187
timeout: float = 20.0,

src/ndi/fun/doc.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ def all_types() -> list[str]:
4444
return sorted(types)
4545

4646

47-
48-
4947
def find_fuid(session: Any, fuid: str) -> tuple[Any | None, str]:
5048
"""Search session for a document containing a file with the given UID.
5149

src/ndi/fun/doc_table.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,7 @@ def subject_summary(
400400
om_docs = session.database_search(Query("").isa("openminds_subject"))
401401

402402
# Per-subject openminds data: {subject_id: {type: [doc_props, ...]}}
403-
om_by_subject: dict[str, dict[str, list[dict]]] = {
404-
sid: {} for sid in subject_info
405-
}
403+
om_by_subject: dict[str, dict[str, list[dict]]] = {sid: {} for sid in subject_info}
406404

407405
for doc in om_docs:
408406
props = doc.document_properties if hasattr(doc, "document_properties") else doc

src/ndi/fun/table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def _agg(series: pd.Series) -> Any:
185185

186186
result = (
187187
result.groupby(unique_variables, sort=False)
188-
.agg({c: _agg for c in other_cols})
188+
.agg(dict.fromkeys(other_cols, _agg))
189189
.reset_index()
190190
)
191191

tests/matlab_tests/test_jess_haley.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import json
2727
import os
2828
from pathlib import Path
29-
from typing import Any
3029

3130
import pytest
3231

@@ -141,13 +140,11 @@ def test_document_type_counts(self, jess_haley_dataset):
141140
actual_count = actual.get(dtype, 0)
142141
if dtype == "session":
143142
# Dataset init adds 1 extra session doc
144-
assert actual_count >= expected, (
145-
f"{dtype}: expected >= {expected}, got {actual_count}"
146-
)
143+
assert (
144+
actual_count >= expected
145+
), f"{dtype}: expected >= {expected}, got {actual_count}"
147146
else:
148-
assert actual_count == expected, (
149-
f"{dtype}: expected {expected}, got {actual_count}"
150-
)
147+
assert actual_count == expected, f"{dtype}: expected {expected}, got {actual_count}"
151148

152149
def test_all_documents_have_base_id(self, all_docs_raw):
153150
"""Every document has a base.id field."""
@@ -227,9 +224,9 @@ def test_groups_by_variable_names(self, otr_tables):
227224
def test_group_row_counts(self, otr_tables):
228225
data_tables, _ = otr_tables
229226
actual_sizes = sorted([len(dt) for dt in data_tables], reverse=True)
230-
assert actual_sizes == EXPECTED_OTR_GROUP_SIZES_SORTED, (
231-
f"Group sizes mismatch: {actual_sizes} != {EXPECTED_OTR_GROUP_SIZES_SORTED}"
232-
)
227+
assert (
228+
actual_sizes == EXPECTED_OTR_GROUP_SIZES_SORTED
229+
), f"Group sizes mismatch: {actual_sizes} != {EXPECTED_OTR_GROUP_SIZES_SORTED}"
233230

234231
def test_data_dict_extraction(self, otr_tables):
235232
"""At least one group has bacterial plate columns."""
@@ -261,9 +258,9 @@ def test_encounter_table_has_numeric_data(self, otr_tables):
261258
# Find the encounter table (largest group, ~20411 rows)
262259
encounter_table = max(data_tables, key=len)
263260
decel_col = "CElegansBehavioralAssay_DecelerationUponEncounter"
264-
assert decel_col in encounter_table.columns, (
265-
f"'{decel_col}' not in largest group columns: {list(encounter_table.columns)}"
266-
)
261+
assert (
262+
decel_col in encounter_table.columns
263+
), f"'{decel_col}' not in largest group columns: {list(encounter_table.columns)}"
267264
assert pd.api.types.is_numeric_dtype(encounter_table[decel_col])
268265

269266
def test_bacterial_plate_table_has_expected_columns(self, otr_tables):
@@ -633,7 +630,9 @@ def test_session_id_consistency(self, jess_haley_dataset):
633630
# Note: session_id is the session object's ID, NOT the session
634631
# document's base.id. The Jess Haley dataset has 3 unique session_ids.
635632
assert len(session_ids) >= 2, f"Expected >= 2 unique session_ids, got {session_ids}"
636-
assert len(session_ids) <= 10, f"Too many session_ids ({len(session_ids)}), data may be corrupt"
633+
assert (
634+
len(session_ids) <= 10
635+
), f"Too many session_ids ({len(session_ids)}), data may be corrupt"
637636

638637

639638
# ===========================================================================
@@ -668,7 +667,7 @@ def test_plot_document_type_distribution(self, jess_haley_dataset):
668667
ax.barh(doc_types, doc_counts, color="steelblue")
669668
ax.set_xlabel("Count")
670669
ax.set_title("Jess Haley Dataset: Document Type Distribution")
671-
for i, (t, c) in enumerate(zip(doc_types, doc_counts)):
670+
for i, (_t, c) in enumerate(zip(doc_types, doc_counts)):
672671
ax.text(c + 100, i, str(c), va="center", fontsize=8)
673672
plt.tight_layout()
674673
plt.savefig(out / "doc_type_distribution.png", dpi=150)
@@ -681,7 +680,6 @@ def test_plot_subject_experiment_types(self, jess_haley_dataset):
681680
import matplotlib
682681

683682
matplotlib.use("Agg")
684-
import re
685683
from collections import Counter
686684

687685
import matplotlib.pyplot as plt
@@ -870,7 +868,7 @@ def test_render_video_frame_sequence(self, all_docs_raw):
870868
time_per_frame = time_scale[2] if len(time_scale) > 2 else 1.0
871869

872870
fig, axes = plt.subplots(2, 4, figsize=(16, 8))
873-
for idx, (ax, fi) in enumerate(zip(axes.flat, frame_indices)):
871+
for _idx, (ax, fi) in enumerate(zip(axes.flat, frame_indices)):
874872
cap.set(cv2.CAP_PROP_POS_FRAMES, fi)
875873
ret, frame = cap.read()
876874
if ret:

tests/test_fun.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,7 @@ def test_with_mock_session(self):
332332
}
333333
}
334334
doc2 = MagicMock()
335-
doc2.document_properties = {
336-
"document_class": {"class_name": "subject"}
337-
}
335+
doc2.document_properties = {"document_class": {"class_name": "subject"}}
338336
session = MagicMock()
339337
session.database_search.return_value = [doc1, doc2]
340338

0 commit comments

Comments
 (0)