Skip to content

Commit 6e9caff

Browse files
committed
FIX: Avoid altering global dictionary
1 parent f26724d commit 6e9caff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

niworkflows/utils/bids.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#
2323
"""Helpers for handling BIDS-like neuroimaging structures."""
2424

25+
import copy
2526
import json
2627
import re
2728
import warnings
@@ -243,6 +244,9 @@ def collect_data(
243244
else:
244245
layout = BIDSLayout(str(bids_dir), validate=bids_validate)
245246

247+
if not queries:
248+
queries = copy.deepcopy(DEFAULT_BIDS_QUERIES)
249+
246250
layout_get_kwargs = {
247251
'return_type': 'file',
248252
'subject': participant_label,
@@ -252,7 +256,6 @@ def collect_data(
252256

253257
reserved_entities = [('subject', participant_label), ('session', session_id)]
254258

255-
queries = queries or DEFAULT_BIDS_QUERIES
256259
bids_filters = bids_filters or {}
257260
for acq, entities in bids_filters.items():
258261
# BIDS filters will not be able to override subject / session entities

0 commit comments

Comments
 (0)