Skip to content

Commit

Permalink
use iglob iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
waldie11 committed Dec 23, 2024
1 parent c9044da commit 07dfb44
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions mne_bids/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -2487,12 +2487,8 @@ def _return_root_paths(root, datatype=None, ignore_json=True, ignore_nosub=False
if ignore_nosub:
search_str = "sub-*/" + search_str

paths = list(
map(
lambda fn: Path(root, fn),
glob.glob(search_str, root_dir=root, recursive=True),
)
)
paths = [ Path(root, fn) for fn in glob.iglob(search_str, root_dir=root, recursive=True) ]

# Only keep files (not directories), ...
# and omit the JSON sidecars if `ignore_json` is True.
if ignore_json:
Expand Down

0 comments on commit 07dfb44

Please sign in to comment.