Monitor files and directories, invoking callbacks when changes occur.
Multiple instances of this class can be created, but note that there is a per-user limit of the number of INotify instances allowed, which is controlled by /proc/sys/fs/inotify/max_user_instances
kaa.Object
└─ kaa.inotify.INotify
get_watches() | Returns a list of all paths monitored by the object. |
---|---|
has_watch() | Determine if the given path is currently watched by the INotify object. |
ignore() | Removes a watch on the given path. |
mask_to_string() | Converts a bitmask of events to a human-readable string. |
watch() | Begin monitoring a file or directory for specific events. |
event | Emitted when an event occurs on any file or directory currently being monitored by this INotify instance. |
---|
Returns a list of all paths monitored by the object.
Returns: | list of strings |
---|
Determine if the given path is currently watched by the INotify object.
Parameters: | path (str) – the path that had been previously passed to watch() |
---|---|
Returns: | True if there is a matching monitor, or False otherwise. |
Removes a watch on the given path.
Parameters: | path (str) – the path that had been previously passed to watch() |
---|---|
Returns: | True if a matching monitor was removed, or False otherwise. |
Converts a bitmask of events to a human-readable string.
Parameters: | mask (int) – the bitmask of events |
---|---|
Returns: | a string in the form EVENT1 | EVENT2 | EVENT3 ... |
Begin monitoring a file or directory for specific events.
Parameters: |
|
---|---|
Returns: | Signal object that is emitted when an event occurs on path. |
The default mask is anything that causes a change (new file, deleted file, modified file, or attribute change on the file).
Callbacks connected to the returned signal are invoked with the same arguments as the event signal.
The total number of watches (across all INotify instances) is controlled by /proc/sys/fs/inotify/max_user_watches
Emitted when an event occurs on any file or directory currently being monitored by this INotify instance.
Param mask: | a bitmask of events |
---|---|
Type mask: | int |
Param source: | the filename the event applies to |
Type filename: | str |
Param target: | if the mask contains both MOVED_TO | MOVED_FROM, filename was renamed to target. Otherwise, target is None. |