Glob Manager¶
The GlobManager
is responsible for expanding globs and ensuring
that only files are returned.
Multiple globs can be passed in to the class, these are then expanded and matching files (no directories) are returned.
As an example, the following code would set up a GlobManager
class
that would find all files ending in .py
.
>>> manager = GlobManager(['**/*.py'])
To actually get the files matching the specified globs the get_files()
method can be called:
>>> manager.get_files()
-
class
watch_do.glob_manager.
GlobManager
(globs)[source]¶ This class expands the globs that are provided to it.
Multiple globs can be specified in order to watch a multitude of files.
Initialise the
GlobManager
.Parameters: globs (list) – A list of globs (as strings) that this class will expand. -
get_files
()[source]¶ Expand the globs and return a
set
of matching files.Returns: A set
of strings containing the files that matched the globs passed into this class.Return type: set
-
globs
¶ set – A
set
of globs that were passed into this class.
-
last_files
¶ set – The
set
of files last returned by theget_files()
method.
-