Skip to content

Commit 5a34b83

Browse files
committed
fix: Ensure dotfiles are always filtered
Coerce ignore to list to handle other sequence types (tuples) being passed.
1 parent 882aaa3 commit 5a34b83

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/bids/layout/validation.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@
3232

3333
DEFAULT_LOCATIONS_TO_IGNORE = {
3434
re.compile(r"^/(code|models|sourcedata|stimuli)"),
35-
re.compile(r'/\.'),
3635
}
3736

37+
ALWAYS_IGNORE = (
38+
re.compile(r'/\.'), # dotfiles should never be indexed
39+
)
40+
3841
def absolute_path_deprecation_warning():
3942
warnings.warn("The absolute_paths argument will be removed from PyBIDS "
4043
"in 0.14. You can easily access the relative path of "
@@ -156,9 +159,11 @@ def _sort_patterns(patterns, root):
156159

157160
def validate_indexing_args(ignore, force_index, root):
158161
if ignore is None:
159-
ignore = list(
160-
DEFAULT_LOCATIONS_TO_IGNORE - set(force_index or [])
161-
)
162+
ignore = DEFAULT_LOCATIONS_TO_IGNORE - set(force_index or [])
163+
164+
ignore = list(ignore)
165+
166+
ignore.extend(ALWAYS_IGNORE)
162167

163168
# root has already been validated to be a directory
164169
ignore = _sort_patterns(ignore, root)

0 commit comments

Comments
 (0)