Skip to content

Commit 5d013ee

Browse files
Merge pull request #10 from Waltham-Data-Science/claude/fix-lint-formatting-nbwSK
Reformat long lines to improve code readability
2 parents 2b3e273 + e827f5c commit 5d013ee

3 files changed

Lines changed: 10 additions & 30 deletions

File tree

src/ndi/fun/plot.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ def bar3(
5555
import matplotlib.pyplot as plt
5656
except ImportError as exc:
5757
raise ImportError(
58-
"matplotlib is required for ndi.fun.plot. "
59-
"Install it with: pip install matplotlib"
58+
"matplotlib is required for ndi.fun.plot. " "Install it with: pip install matplotlib"
6059
) from exc
6160

6261
import pandas as pd
@@ -91,21 +90,14 @@ def bar3(
9190
ax = axes[i]
9291
for j in range(g2_size):
9392
for k in range(g3_size):
94-
mask = (
95-
(group_indices[0] == i)
96-
& (group_indices[1] == j)
97-
& (group_indices[2] == k)
98-
)
93+
mask = (group_indices[0] == i) & (group_indices[1] == j) & (group_indices[2] == k)
9994
vals = df.loc[mask, plotting_variable].values
10095
x = j * (g3_size + 1) + k + 1
10196
if len(vals) > 0:
10297
ax.bar(x, np.nanmean(vals), color=colors[k])
10398

10499
# Format subplot
105-
tick_positions = [
106-
(g3_size + 1) * j + (g3_size + 1) / 2
107-
for j in range(g2_size)
108-
]
100+
tick_positions = [(g3_size + 1) * j + (g3_size + 1) / 2 for j in range(g2_size)]
109101
ax.set_xticks(tick_positions)
110102
ax.set_xticklabels([str(g) for g in groups[1]])
111103
ax.set_title(str(groups[0][i]))
@@ -150,8 +142,7 @@ def multichan(
150142
import matplotlib.pyplot as plt
151143
except ImportError as exc:
152144
raise ImportError(
153-
"matplotlib is required for ndi.fun.plot. "
154-
"Install it with: pip install matplotlib"
145+
"matplotlib is required for ndi.fun.plot. " "Install it with: pip install matplotlib"
155146
) from exc
156147

157148
data = np.asarray(data)
@@ -222,8 +213,7 @@ def stimulusTimeseries(
222213
import matplotlib.pyplot as plt
223214
except ImportError as exc:
224215
raise ImportError(
225-
"matplotlib is required for ndi.fun.plot. "
226-
"Install it with: pip install matplotlib"
216+
"matplotlib is required for ndi.fun.plot. " "Install it with: pip install matplotlib"
227217
) from exc
228218

229219
# Read stimulus data from the probe
@@ -240,9 +230,7 @@ def stimulusTimeseries(
240230
for entry in stimulus_data:
241231
if isinstance(entry, dict) and "stimid" in entry:
242232
ids.extend(
243-
entry["stimid"]
244-
if isinstance(entry["stimid"], list)
245-
else [entry["stimid"]]
233+
entry["stimid"] if isinstance(entry["stimid"], list) else [entry["stimid"]]
246234
)
247235
stimid = ids if ids else None
248236

@@ -254,14 +242,10 @@ def stimulusTimeseries(
254242
stimon = stimulus_time_data.stimon
255243
stimoff = stimulus_time_data.stimoff
256244
else:
257-
raise ValueError(
258-
"stimulus_time_data must contain 'stimon' and 'stimoff' fields"
259-
)
245+
raise ValueError("stimulus_time_data must contain 'stimon' and 'stimoff' fields")
260246

261247
if stimon is None or stimoff is None:
262-
raise ValueError(
263-
"stimulus_time_data must contain 'stimon' and 'stimoff' fields"
264-
)
248+
raise ValueError("stimulus_time_data must contain 'stimon' and 'stimoff' fields")
265249

266250
stimon = np.asarray(stimon).ravel()
267251
stimoff = np.asarray(stimoff).ravel()

tests/matlab_tests/test_jess_haley.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,7 @@ def test_doc_ids_match(self, otr_tables):
244244
def test_stack_all_mode(self, ontology_table_row_docs):
245245
from ndi.fun.doc_table import ontologyTableRowDoc2Table
246246

247-
data_tables, doc_ids = ontologyTableRowDoc2Table(
248-
ontology_table_row_docs, stack_all=True
249-
)
247+
data_tables, doc_ids = ontologyTableRowDoc2Table(ontology_table_row_docs, stack_all=True)
250248
assert len(data_tables) == 1
251249
assert len(data_tables[0]) == sum(EXPECTED_OTR_GROUP_SIZES_SORTED)
252250

tests/test_cloud_live.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -946,9 +946,7 @@ def test_deferred_delete_and_undelete(self, client, cloud_config, can_write):
946946

947947
# Should be accessible again with documents intact
948948
time.sleep(2)
949-
ds = _retry_on_server_error(
950-
lambda: getDataset(ds_id, client=client), retry_on_404=True
951-
)
949+
ds = _retry_on_server_error(lambda: getDataset(ds_id, client=client), retry_on_404=True)
952950
ds_fetched_id = ds.get("_id", ds.get("id", ""))
953951
assert ds_fetched_id == ds_id
954952

0 commit comments

Comments
 (0)