fs.wildcard¶
Match wildcard filenames.
-
fs.wildcard.
get_matcher
(patterns, case_sensitive)¶ Get a callable that matches names against the given patterns.
Parameters: Returns: a matcher that will return
True
if the name given as an argument matches any of the given patterns.Return type: callable
Example
>>> from fs import wildcard >>> is_python = wildcard.get_matcher(['*.py'], True) >>> is_python('__init__.py') True >>> is_python('foo.txt') False
-
fs.wildcard.
imatch
(pattern, name)¶ Test whether a name matches a wildcard pattern (case insensitive).
Parameters: Returns: True
if the filename matches the pattern.Return type:
-
fs.wildcard.
imatch_any
(patterns, name)¶ Test if a name matches any of a list of patterns (case insensitive).
Will return
True
ifpatterns
is an empty list.Parameters: Returns: True
if the name matches at least one of the patterns.Return type:
-
fs.wildcard.
match
(pattern, name)¶ Test whether a name matches a wildcard pattern.
Parameters: Returns: True
if the filename matches the pattern.Return type: