Module pyinotify :: Class WatchManager
[show private | hide private]
[frames | no frames]

Type WatchManager

object --+
         |
        WatchManager


Provide operations for watching files and directories. Integrated dictionary is used to reference watched items.
Method Summary
  __init__(self)
Initialization: init inotify, init watch manager dictionary.
dict of str: int add_watch(self, path, mask, proc_fun, rec, auto_add, do_glob)
Add watch(s) on given path(s) with the specified mask and optionnally with a processing function and recursive flag.
string or None get_path(self, wd)
Returns the path associated to WD, if WD doesn't exist None is returned.
int or None get_wd(self, path)
Returns the watch descriptor associated to path.
dict of int: bool rm_watch(self, wd, rec)
Removes watch(s).
dict of int: bool update_watch(self, wd, mask, proc_fun, rec, auto_add)
Update existing watch(s).
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

__init__(self)
(Constructor)

Initialization: init inotify, init watch manager dictionary. Raise OSError if initialization fails.
Overrides:
__builtin__.object.__init__

add_watch(self, path, mask, proc_fun=None, rec=False, auto_add=False, do_glob=False)

Add watch(s) on given path(s) with the specified mask and optionnally with a processing function and recursive flag.
Parameters:
path - Path to watch, the path can either be a file or a directory. Also accepts a sequence (list) of paths.
           (type=string or list of string)
mask - Bitmask of events.
           (type=int)
proc_fun - Processing object.
           (type=function or ProcessEvent instance or instance of one of its subclasses or callable object.)
rec - Recursively add watches from path on all its subdirectories, set to False by default (doesn't follows symlinks).
           (type=bool)
auto_add - Automatically add watches on newly created directories in the watch's path.
           (type=bool)
do_glob - Do globbing on pathname.
           (type=bool)
Returns:
dict of paths associated to watch descriptors. A wd value is positive if the watch has been sucessfully added, otherwise the value is negative. If the path is invalid it will be not included in this dict.
           (type=dict of str: int)

get_path(self, wd)

Returns the path associated to WD, if WD doesn't exist None is returned.
Parameters:
wd - watch descriptor.
           (type=int)
Returns:
path or None.
           (type=string or None)

get_wd(self, path)

Returns the watch descriptor associated to path. This method has an prohibitive cost, always prefer to keep the WD.
Parameters:
path - path.
           (type=str)
Returns:
WD or None.
           (type=int or None)

rm_watch(self, wd, rec=False)

Removes watch(s).
Parameters:
wd - Watch Descriptor of the file or directory to unwatch. Also accepts a list of WDs.
           (type=int or list of int.)
rec - Recursively removes watches on every already watched subdirectories and subfiles.
           (type=bool)
Returns:
dict of watch descriptors associated to booleans values. True if the corresponding wd has been successfully removed, False otherwise.
           (type=dict of int: bool)

update_watch(self, wd, mask=None, proc_fun=None, rec=False, auto_add=False)

Update existing watch(s). Both the mask and the processing object can be modified.
Parameters:
wd - Watch Descriptor to update. Also accepts a list of watch descriptors.
           (type=int or list of int)
mask - Optional new bitmask of events.
           (type=int)
proc_fun - Optional new processing function.
           (type=function or ProcessEvent instance or instance of one of its subclasses or callable object.)
rec - Recursively update watches on every already watched subdirectories and subfiles.
           (type=bool)
auto_add - Automatically add watches on newly created directories in the watch's path.
           (type=bool)
Returns:
dict of watch descriptors associated to booleans values. True if the corresponding wd has been successfully updated, False otherwise.
           (type=dict of int: bool)

Generated by Epydoc 2.1 on Tue Jul 10 21:40:43 2007 http://epydoc.sf.net