match_all_filters¶
match_all_filters(path, filters)
¶
Check if input path satisfies all the filters.
Added in 0.8.0
Parameters:
-
path(PathProtocol) –Path to check.
-
filters(Iterable[BaseFileFilter]) –Filters to test path against.
Returns:
-
bool–Trueif path matches all the filters,Falseotherwise.If filters are empty, returns
True.
Examples:
>>> from onetl.file.filter import Glob, ExcludeDir, match_all_filters
>>> from onetl.impl import RemoteFile, RemotePathStat
>>> filters = [Glob("*.csv"), ExcludeDir("/excluded")]
>>> match_all_filters(RemoteFile("/path/to/file.csv", stats=RemotePathStat()), filters)
True
>>> match_all_filters(RemoteFile("/path/to/file.txt", stats=RemotePathStat()), filters)
False
>>> match_all_filters(RemoteFile("/excluded/path/file.csv", stats=RemotePathStat()), filters)
False