Welcome to Grigori’s documentation!¶
Quickstart¶
Requirements¶
This module has no requirements. The requirements.dev.txt is for development to the module only and contains packages like Sphinx and setuptools.
Example¶
The simple example below watches the current directory for any changes, and notifies us of the file and type of the change.
For more detailed usage please see the Usage
from grigori import Watcher
directory = './'
w = Watcher(directory)
for changes in w.watch():
for change in changes:
print("file '%s' has been changed in the following way: '%s'" % (change["file"], change["type"]))
Usage¶
More usage
grigori¶
grigori package¶
Submodules¶
grigori.watcher module¶
-
class
grigori.watcher.
Change
[source]¶ Bases:
enum.IntEnum
Simple Enum representing the different types of changes to a file.
-
ADDED
= 1¶
-
DELETED
= 3¶
-
MODIFIED
= 2¶
-
-
class
grigori.watcher.
Watcher
(directory: str, recursive: bool = False, polling_interval: int = 1000, file_pattern: str = '.+', directory_pattern: str = '.+', cache: bool = False)[source]¶ Bases:
object
Class that starts watching your files.
Module contents¶
Basic watcher module.
The grigori
module contains two classes:
grigori.Change
grigori.Watcher
You can use the grigori.Watcher
class to create a watcher instance. Then you have the choice if you want to
use callbacks or a for loop. To use callbacks, use the grigori.Watcher.wait()
method. To use the for loop, use the
grigori.Watcher.watch()
method.