diff --git a/datumaro/components/extractor.py b/datumaro/components/extractor.py index b6acee097f..1c81462779 100644 --- a/datumaro/components/extractor.py +++ b/datumaro/components/extractor.py @@ -623,11 +623,11 @@ def _find_sources_recursive(cls, path, ext, extractor_name, sources = [] for d in range(max_depth + 1): sources.extend({'url': p, 'format': extractor_name} for p in - iglob(osp.join(path, *('*' * d), dirname, filename + ext))) + iglob(osp.join(path, *('*' * d), dirname, filename + ext)) + if (callable(file_filter) and file_filter(p)) \ + or (not callable(file_filter))) if sources: break - if callable(file_filter): - sources = [s for s in sources if file_filter(s['url'])] return sources class Transform(Extractor):