match_all_filters#
- onetl.file.filter.match_all_filters.match_all_filters(path: PathProtocol, filters: Iterable[BaseFileFilter]) bool #
Check if input path satisfies all the filters.
- Parameters:
- path
onetl.base.path_protocol.PathProtocol
Path to check.
- filtersIterable of
onetl.base.base_file_filter.BaseFileFilter
Filters to test path against.
- path
- Returns:
True
if path matches all the filters,False
otherwise.- If filters are empty, returns
True
.
Examples
from onetl.file.filter import Glob, ExcludeDir, match_all_filters from onetl.impl import LocalPath filters = [Glob("*.csv"), ExcludeDir("/excluded")] assert match_all_filters(LocalPath("/path/to/file.csv"), filters) assert not match_all_filters(LocalPath("/path/to/file.txt"), filters) assert not match_all_filters(LocalPath("/excluded/path/file.csv"), filters)