Skip to content

Commit 51f254a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5bf6fef commit 51f254a

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

mne_bids/path.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,12 @@ def _return_root_paths(
26322632
if ignore_nosub:
26332633
dt_search = f"sub-*/{dt_search}"
26342634
paths.extend(
2635-
[Path(root, fn) for fn in glob.iglob(dt_search, root_dir=root, recursive=True)]
2635+
[
2636+
Path(root, fn)
2637+
for fn in glob.iglob(
2638+
dt_search, root_dir=root, recursive=True
2639+
)
2640+
]
26362641
)
26372642
else:
26382643
search_str = "**/*.*"

mne_bids/tests/test_path.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,12 @@ def test_return_root_paths_entity_aware(tmp_path):
12671267
assert len(all_paths) >= 2
12681268

12691269
# Entity-aware scan for subjA should only return files under sub-subjA
1270-
subj_paths = _return_root_paths(root_str, datatype=("meg", "eeg"), ignore_json=True, entities={"subject": "subjA"})
1270+
subj_paths = _return_root_paths(
1271+
root_str,
1272+
datatype=("meg", "eeg"),
1273+
ignore_json=True,
1274+
entities={"subject": "subjA"},
1275+
)
12711276
assert len(subj_paths) < len(all_paths)
12721277
assert all("sub-subjA" in str(p) for p in subj_paths)
12731278

@@ -1303,18 +1308,32 @@ def fake_iglob(pattern, root_dir=None, recursive=False):
13031308

13041309
def fake_filter(paths, ignore_json):
13051310
# convert returned strings into Path objects rooted at fake_root
1306-
return [Path(fake_root, p) for p in fake_results if (not ignore_json) or (not p.endswith('.json'))]
1311+
return [
1312+
Path(fake_root, p)
1313+
for p in fake_results
1314+
if (not ignore_json) or (not p.endswith(".json"))
1315+
]
13071316

13081317
monkeypatch.setattr(mb_path, "_filter_paths_optimized", fake_filter)
13091318

13101319
# ignore_json=True should filter out the .json entry
1311-
paths = _return_root_paths(fake_root, datatype=("meg", "eeg"), ignore_json=True, entities={"subject": "subjA"})
1320+
paths = _return_root_paths(
1321+
fake_root,
1322+
datatype=("meg", "eeg"),
1323+
ignore_json=True,
1324+
entities={"subject": "subjA"},
1325+
)
13121326
assert all(isinstance(p, Path) for p in paths)
13131327
# only the .fif entry for subjA should remain
13141328
assert any(p.suffix == ".fif" and "sub-subjA" in str(p) for p in paths)
13151329

13161330
# ignore_json=False should include the .json entry
1317-
paths_all = _return_root_paths(fake_root, datatype=("meg", "eeg"), ignore_json=False, entities={"subject": "subjA"})
1331+
paths_all = _return_root_paths(
1332+
fake_root,
1333+
datatype=("meg", "eeg"),
1334+
ignore_json=False,
1335+
entities={"subject": "subjA"},
1336+
)
13181337
assert any(str(p).endswith(".json") for p in paths_all)
13191338

13201339

0 commit comments

Comments
 (0)