pyinotify (version 0.8.0s)
index
../pyinotify.py

pyinotify
 
@author: Sebastien Martini
@license: GPL 2
@contact: seb@dbzteam.org

 
Modules
       
array
atexit
ctypes
errno
fcntl
fnmatch
logging.handlers
logging
os
psyco
re
select
struct
sys
termios
threading
time

 
Classes
       
__builtin__.object
Color
ColorTheme
AnsiColorTheme
BlackAndWhite
DefaultTheme
NoTheme
EventsCodes
ExcludeFilter
Notifier
ThreadedNotifier(threading.Thread, Notifier)
SysCtlINotify
Watch
WatchManager
exceptions.Exception(exceptions.BaseException)
NotifierError
ProcessEventError
WatchManagerError
_Event(__builtin__.object)
Event
_ProcessEvent(__builtin__.object)
ProcessEvent
ChainIf
Stats
threading.Thread(threading._Verbose)
ThreadedNotifier(threading.Thread, Notifier)

 
class AnsiColorTheme(ColorTheme)
    
Method resolution order:
AnsiColorTheme
ColorTheme
__builtin__.object

Methods defined here:
__getattr__(self, attr)

Data and other attributes defined here:
style_active = ''
style_class_name = ''
style_closed = ''
style_emph_field_name = ''
style_emph_field_value = ''
style_even = ''
style_fail = ''
style_field_name = ''
style_field_value = ''
style_id = ''
style_left = ''
style_normal = ''
style_not_printable = ''
style_odd = ''
style_prompt = ''
style_punct = ''
style_right = ''
style_success = ''
style_watchlist_name = ''
style_watchlist_type = ''
style_watchlist_value = ''
style_yellow = ''

Methods inherited from ColorTheme:
__repr__(self)

Data descriptors inherited from ColorTheme:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class BlackAndWhite(AnsiColorTheme)
    
Method resolution order:
BlackAndWhite
AnsiColorTheme
ColorTheme
__builtin__.object

Methods inherited from AnsiColorTheme:
__getattr__(self, attr)

Data and other attributes inherited from AnsiColorTheme:
style_active = ''
style_class_name = ''
style_closed = ''
style_emph_field_name = ''
style_emph_field_value = ''
style_even = ''
style_fail = ''
style_field_name = ''
style_field_value = ''
style_id = ''
style_left = ''
style_normal = ''
style_not_printable = ''
style_odd = ''
style_prompt = ''
style_punct = ''
style_right = ''
style_success = ''
style_watchlist_name = ''
style_watchlist_type = ''
style_watchlist_value = ''
style_yellow = ''

Methods inherited from ColorTheme:
__repr__(self)

Data descriptors inherited from ColorTheme:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ChainIf(ProcessEvent)
    Makes conditional chaining depending on the result of the nested
processing instance.
 
 
Method resolution order:
ChainIf
ProcessEvent
_ProcessEvent
__builtin__.object

Methods defined here:
my_init(self, func)
process_default(self, event)

Methods inherited from ProcessEvent:
__call__(self, event)
__init__(self, pevent=None, **kargs)
Enable chaining of ProcessEvent instances.
 
@param pevent: optional callable object, will be called on event
               processing (before self).
@type pevent: callable
@param kargs: optional arguments delagated to template method my_init
@type kargs: dict
nested_pevent(self)

Data and other attributes inherited from ProcessEvent:
pevent = None

Methods inherited from _ProcessEvent:
__repr__(self)

Data descriptors inherited from _ProcessEvent:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Color(__builtin__.object)
     Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
black = '\x1b[30m'
blink = '\x1b[5m'
blue = '\x1b[34m'
bold = '\x1b[1m'
cyan = '\x1b[36m'
green = '\x1b[32m'
grey = '\x1b[37m'
invert = '\x1b[7m'
normal = '\x1b[0m'
purple = '\x1b[35m'
red = '\x1b[31m'
uline = '\x1b[4m'
yellow = '\x1b[33m'

 
class ColorTheme(__builtin__.object)
     Methods defined here:
__getattr__(self, attr)
__repr__(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class DefaultTheme(AnsiColorTheme)
    
Method resolution order:
DefaultTheme
AnsiColorTheme
ColorTheme
__builtin__.object

Data and other attributes defined here:
style_active = '\x1b[30m'
style_class_name = '\x1b[31m\x1b[1m'
style_closed = '\x1b[37m'
style_emph_field_name = '\x1b[34m\x1b[4m\x1b[1m'
style_emph_field_value = '\x1b[35m\x1b[4m\x1b[1m'
style_even = '\x1b[30m\x1b[1m'
style_fail = '\x1b[31m\x1b[1m'
style_field_name = '\x1b[34m'
style_field_value = '\x1b[35m'
style_id = '\x1b[34m\x1b[1m'
style_left = '\x1b[34m\x1b[7m'
style_normal = '\x1b[0m'
style_not_printable = '\x1b[37m'
style_odd = '\x1b[30m'
style_prompt = '\x1b[34m\x1b[1m'
style_punct = '\x1b[0m'
style_right = '\x1b[31m\x1b[7m'
style_success = '\x1b[34m\x1b[1m'
style_watchlist_type = '\x1b[34m'
style_watchlist_value = '\x1b[35m'
style_yellow = '\x1b[33m'

Methods inherited from AnsiColorTheme:
__getattr__(self, attr)

Data and other attributes inherited from AnsiColorTheme:
style_watchlist_name = ''

Methods inherited from ColorTheme:
__repr__(self)

Data descriptors inherited from ColorTheme:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Event(_Event)
    This class contains all the useful informations about the observed
event. However, the incorporation of each field is not guaranteed and
depends on the type of event. In effect, some fields are irrelevant
for some kind of event (for example 'cookie' is meaningless for
IN_CREATE whereas it is useful for IN_MOVE_TO).
 
The possible fields are:
  - wd (int): Watch Descriptor.
  - mask (int): Mask.
  - maskname (str): Readable event name.
  - path (str): path of the file or directory being watched.
  - name (str): Basename of the file or directory against which the
          event was raised, in case where the watched directory
          is the parent directory. None if the event was raised
          on the watched item itself. This field is always provided
          even if the string is ''.
  - pathname (str): absolute path of: path + name
  - cookie (int): Cookie.
  - dir (bool): is the event raised against directory.
 
 
Method resolution order:
Event
_Event
__builtin__.object

Methods defined here:
__init__(self, raw)
Concretely, this is the raw event plus inferred infos.

Methods inherited from _Event:
__repr__(self)
@return: String representation.
@rtype: str

Data descriptors inherited from _Event:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class EventsCodes(__builtin__.object)
    Set of codes corresponding to each kind of events.
Some of these flags are used to communicate with inotify, whereas
the others are sent to userspace by inotify notifying some events.
 
@cvar IN_ACCESS: File was accessed.
@type IN_ACCESS: int
@cvar IN_MODIFY: File was modified.
@type IN_MODIFY: int
@cvar IN_ATTRIB: Metadata changed.
@type IN_ATTRIB: int
@cvar IN_CLOSE_WRITE: Writtable file was closed.
@type IN_CLOSE_WRITE: int
@cvar IN_CLOSE_NOWRITE: Unwrittable file closed.
@type IN_CLOSE_NOWRITE: int
@cvar IN_OPEN: File was opened.
@type IN_OPEN: int
@cvar IN_MOVED_FROM: File was moved from X.
@type IN_MOVED_FROM: int
@cvar IN_MOVED_TO: File was moved to Y.
@type IN_MOVED_TO: int
@cvar IN_CREATE: Subfile was created.
@type IN_CREATE: int
@cvar IN_DELETE: Subfile was deleted.
@type IN_DELETE: int
@cvar IN_DELETE_SELF: Self (watched item itself) was deleted.
@type IN_DELETE_SELF: int
@cvar IN_MOVE_SELF: Self (watched item itself) was moved.
@type IN_MOVE_SELF: int
@cvar IN_UNMOUNT: Backing fs was unmounted.
@type IN_UNMOUNT: int
@cvar IN_Q_OVERFLOW: Event queued overflowed.
@type IN_Q_OVERFLOW: int
@cvar IN_IGNORED: File was ignored.
@type IN_IGNORED: int
@cvar IN_ONLYDIR: only watch the path if it is a directory (new
                  in kernel 2.6.15).
@type IN_ONLYDIR: int
@cvar IN_DONT_FOLLOW: don't follow a symlink (new in kernel 2.6.15).
                      IN_ONLYDIR we can make sure that we don't watch
                      the target of symlinks.
@type IN_DONT_FOLLOW: int
@cvar IN_MASK_ADD: add to the mask of an already existing watch (new
                   in kernel 2.6.14).
@type IN_MASK_ADD: int
@cvar IN_ISDIR: Event occurred against dir.
@type IN_ISDIR: int
@cvar IN_ONESHOT: Only send event once.
@type IN_ONESHOT: int
@cvar ALL_EVENTS: Alias for considering all of the events.
@type ALL_EVENTS: int
 
  Static methods defined here:
maskname(mask)
Return the event name associated to mask. IN_ISDIR is appended when
appropriate. Note: only one event is returned, because only one is
raised once at a time.
 
@param mask: mask.
@type mask: int
@return: event name.
@rtype: str

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
ALL_FLAGS = {'ALL_EVENTS': 4095, 'IN_ACCESS': 1, 'IN_ATTRIB': 4, 'IN_CLOSE_NOWRITE': 16, 'IN_CLOSE_WRITE': 8, 'IN_CREATE': 256, 'IN_DELETE': 512, 'IN_DELETE_SELF': 1024, 'IN_DONT_FOLLOW': 33554432, 'IN_IGNORED': 32768, ...}
ALL_VALUES = {1: 'IN_ACCESS', 2: 'IN_MODIFY', 4: 'IN_ATTRIB', 8: 'IN_CLOSE_WRITE', 16: 'IN_CLOSE_NOWRITE', 32: 'IN_OPEN', 64: 'IN_MOVED_FROM', 128: 'IN_MOVED_TO', 256: 'IN_CREATE', 512: 'IN_DELETE', ...}
EVENT_FLAGS = {'IN_IGNORED': 32768, 'IN_Q_OVERFLOW': 16384, 'IN_UNMOUNT': 8192}
FLAG_COLLECTIONS = {'EVENT_FLAGS': {'IN_IGNORED': 32768, 'IN_Q_OVERFLOW': 16384, 'IN_UNMOUNT': 8192}, 'OP_FLAGS': {'IN_ACCESS': 1, 'IN_ATTRIB': 4, 'IN_CLOSE_NOWRITE': 16, 'IN_CLOSE_WRITE': 8, 'IN_CREATE': 256, 'IN_DELETE': 512, 'IN_DELETE_SELF': 1024, 'IN_MODIFY': 2, 'IN_MOVED_FROM': 64, 'IN_MOVED_TO': 128, ...}, 'SPECIAL_FLAGS': {'IN_DONT_FOLLOW': 33554432, 'IN_ISDIR': 1073741824, 'IN_MASK_ADD': 536870912, 'IN_ONESHOT': 2147483648L, 'IN_ONLYDIR': 16777216}}
OP_FLAGS = {'IN_ACCESS': 1, 'IN_ATTRIB': 4, 'IN_CLOSE_NOWRITE': 16, 'IN_CLOSE_WRITE': 8, 'IN_CREATE': 256, 'IN_DELETE': 512, 'IN_DELETE_SELF': 1024, 'IN_MODIFY': 2, 'IN_MOVED_FROM': 64, 'IN_MOVED_TO': 128, ...}
SPECIAL_FLAGS = {'IN_DONT_FOLLOW': 33554432, 'IN_ISDIR': 1073741824, 'IN_MASK_ADD': 536870912, 'IN_ONESHOT': 2147483648L, 'IN_ONLYDIR': 16777216}

 
class ExcludeFilter(__builtin__.object)
    ExcludeFilter is an exclusion filter.
 
  Methods defined here:
__call__(self, path)
@param path: path to match against regexps.
@type path: str
@return: return True is path has been matched and should
         be excluded, False otherwise.
@rtype: bool
__init__(self, arg_lst)
@param arg_lst: is either a list or dict of patterns:
                [pattern1, ..., patternn]
                {'filename1': (list1, listn), ...} where list1 is
                a list of patterns
@type arg_lst: list or dict

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class NoTheme(ColorTheme)
    
Method resolution order:
NoTheme
ColorTheme
__builtin__.object

Methods inherited from ColorTheme:
__getattr__(self, attr)
__repr__(self)

Data descriptors inherited from ColorTheme:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Notifier(__builtin__.object)
    Read notifications, process events.
 
  Methods defined here:
__init__(self, watch_manager, default_proc_fun=<ProcessEvent>, read_freq=0, treshold=0, timeout=None)
Initialization. read_freq, treshold and timeout parameters are used
when looping.
 
@param watch_manager: Watch Manager.
@type watch_manager: WatchManager instance
@param default_proc_fun: Default processing method.
@type default_proc_fun: instance of ProcessEvent
@param read_freq: if read_freq == 0, events are read asap,
                  if read_freq is > 0, this thread sleeps
                  max(0, read_freq - timeout) seconds. But if
                  timeout is None it can be different because
                  poll is blocking waiting for something to read.
@type read_freq: int
@param treshold: File descriptor will be read only if its size to
                 read is >= treshold. If != 0, you likely want to
                 use it in combination with read_freq because
                 without that you keep looping without really reading
                 anything and that until the amount to read
                 is >= treshold. At least with read_freq you may sleep.
@type treshold: int
@param timeout:
   see http://docs.python.org/lib/poll-objects.html#poll-objects
@type timeout: int
check_events(self)
Check for new events available to read, blocks up to timeout
milliseconds.
 
@return: New events to read.
@rtype: bool
loop(self, callback=None, daemonize=False, **args)
Events are read only once time every min(read_freq, timeout)
seconds at best and only if the size to read is >= treshold.
 
@param callback: Functor called after each event processing. Expects
                 to receive notifier object (self) as first parameter.
@type callback: callable
@param daemonize: This thread is daemonized if set to True.
@type daemonize: boolean
proc_fun(self)
process_events(self)
Routine for processing events from queue by calling their
associated proccessing function (instance of ProcessEvent).
It also do internal processings, to keep the system updated.
read_events(self)
Read events from device, build _RawEvents, and enqueue them.
stop(self)
Close the inotify's instance (close its file descriptor).
It destroys all existing watches, pending events,...

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class NotifierError(exceptions.Exception)
    Notifier Exception. Raised on Notifier error.
 
 
Method resolution order:
NotifierError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, msg)
@param msg: Exception string's description.
@type msg: string

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x8141680>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
class ProcessEvent(_ProcessEvent)
    Process events objects, can be specialized via subclassing, thus its
behavior can be overriden:
 
Note: you should not override __init__ in your subclass instead define
my_init() method, this method will be called from the constructor of
this class with optional parameters.
 
  1. Provide methods, e.g. process_IN_DELETE for processing a given kind
     of event (eg. IN_DELETE in this case).
  2. Or/and provide methods for processing events by 'family', e.g.
     process_IN_CLOSE method will process both IN_CLOSE_WRITE and
     IN_CLOSE_NOWRITE events (if process_IN_CLOSE_WRITE and
     process_IN_CLOSE_NOWRITE aren't defined).
  3. Or/and override process_default for processing the remaining kind of
     events.
 
 
Method resolution order:
ProcessEvent
_ProcessEvent
__builtin__.object

Methods defined here:
__call__(self, event)
__init__(self, pevent=None, **kargs)
Enable chaining of ProcessEvent instances.
 
@param pevent: optional callable object, will be called on event
               processing (before self).
@type pevent: callable
@param kargs: optional arguments delagated to template method my_init
@type kargs: dict
my_init(self, **kargs)
Override this method when subclassing if you want to achieve
custom initialization of your subclass' instance. You MUST pass
keyword arguments. This method does nothing by default.
 
@param kargs: optional arguments delagated to template method my_init
@type kargs: dict
nested_pevent(self)
process_default(self, event)
Default default processing event method. Print event
on standart output.
 
@param event: Event to be processed.
@type event: Event instance

Data and other attributes defined here:
pevent = None

Methods inherited from _ProcessEvent:
__repr__(self)

Data descriptors inherited from _ProcessEvent:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ProcessEventError(exceptions.Exception)
    ProcessEventError Exception. Raised on ProcessEvent error.
 
 
Method resolution order:
ProcessEventError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, msg)
@param msg: Exception string's description.
@type msg: string

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x8141680>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
class Stats(ProcessEvent)
    
Method resolution order:
Stats
ProcessEvent
_ProcessEvent
__builtin__.object

Methods defined here:
__repr__(self)
__str__(self, scale=45)
dump(self, filename)
my_init(self)
process_default(self, event)

Methods inherited from ProcessEvent:
__call__(self, event)
__init__(self, pevent=None, **kargs)
Enable chaining of ProcessEvent instances.
 
@param pevent: optional callable object, will be called on event
               processing (before self).
@type pevent: callable
@param kargs: optional arguments delagated to template method my_init
@type kargs: dict
nested_pevent(self)

Data and other attributes inherited from ProcessEvent:
pevent = None

Data descriptors inherited from _ProcessEvent:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class SysCtlINotify(__builtin__.object)
    Access (read, write) inotify's variables through sysctl.
 
Examples:
  - Read variable: myvar = max_queued_events.value
  - Update variable: max_queued_events.value = 42
 
  Methods defined here:
__init__(self, attrname)
__repr__(self)
get_val(self)
@return: stored value.
@rtype: int
set_val(self, nval)
@param nval: set to nval.
@type nval: int

Static methods defined here:
__new__(cls, *p, **k)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
value
@return: stored value.
@rtype: int

Data and other attributes defined here:
inotify_attrs = {'max_queued_events': 3, 'max_user_instances': 1, 'max_user_watches': 2}

 
class ThreadedNotifier(threading.Thread, Notifier)
    This notifier inherits from threading.Thread for instantiating a separate
thread, and also inherits from Notifier, because it is a threaded notifier.
 
This class is only maintained for legacy reasons, everything possible with
this class is also possible with Notifier, but Notifier is _better_ under
many aspects (not threaded, can be daemonized, won't unnecessarily read
for events).
 
 
Method resolution order:
ThreadedNotifier
threading.Thread
threading._Verbose
Notifier
__builtin__.object

Methods defined here:
__init__(self, watch_manager, default_proc_fun=<ProcessEvent>, read_freq=0, treshold=0, timeout=10000)
Initialization, initialize base classes. read_freq, treshold and
timeout parameters are used when looping.
 
@param watch_manager: Watch Manager.
@type watch_manager: WatchManager instance
@param default_proc_fun: Default processing method.
@type default_proc_fun: instance of ProcessEvent
@param read_freq: if read_freq == 0, events are read asap,
                  if read_freq is > 0, this thread sleeps
                  max(0, read_freq - timeout) seconds.
@type read_freq: int
@param treshold: File descriptor will be read only if its size to
                 read is >= treshold. If != 0, you likely want to
                 use it in combination with read_freq because
                 without that you keep looping without really reading
                 anything and that until the amount to read
                 is >= treshold. At least with read_freq you may sleep.
@type treshold: int
@param timeout:
   see http://docs.python.org/lib/poll-objects.html#poll-objects
   Read the corresponding comment in the source code before changing
   it.
@type timeout: int
loop(self)
Thread's main loop. don't meant to be called by user directly.
Call start() instead.
 
Events are read only once time every min(read_freq, timeout)
seconds at best and only if the size to read is >= treshold.
run(self)
Start the thread's loop: read and process events until the method
stop() is called.
Never call this method directly, instead call the start() method
inherited from threading.Thread, which then will call run().
stop(self)
Stop the notifier's loop. Stop notification. Join the thread.

Methods inherited from threading.Thread:
__repr__(self)
getName(self)
isAlive(self)
isDaemon(self)
join(self, timeout=None)
setDaemon(self, daemonic)
setName(self, name)
start(self)

Data descriptors inherited from threading._Verbose:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from Notifier:
check_events(self)
Check for new events available to read, blocks up to timeout
milliseconds.
 
@return: New events to read.
@rtype: bool
proc_fun(self)
process_events(self)
Routine for processing events from queue by calling their
associated proccessing function (instance of ProcessEvent).
It also do internal processings, to keep the system updated.
read_events(self)
Read events from device, build _RawEvents, and enqueue them.

 
class Watch(__builtin__.object)
    Represent a watch, i.e. a file or directory being watched.
 
  Methods defined here:
__init__(self, **keys)
Initializations.
 
@param wd: Watch descriptor.
@type wd: int
@param path: Path of the file or directory being watched.
@type path: str
@param mask: Mask.
@type mask: int
@param proc_fun: Processing callable object.
@type proc_fun:
@param auto_add: Automatically add watches on new directories.
@type auto_add: bool
__repr__(self)
@return: String representation.
@rtype: str

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class WatchManager(__builtin__.object)
    Provide operations for watching files and directories. Integrated
dictionary is used to reference watched items.
 
  Methods defined here:
__init__(self, exclude_filter=<function <lambda> at 0xb7c44e9c>)
Initialization: init inotify, init watch manager dictionary.
Raise OSError if initialization fails.
 
@param exclude_filter: boolean function, returns True if current
                       path must be excluded from being watched.
                       Convenient for providing a common exclusion
                       filter for every call to add_watch.
@type exclude_filter: bool
add_watch(self, path, mask, proc_fun=None, rec=False, auto_add=False, do_glob=False, quiet=True, exclude_filter=None)
Add watch(s) on given path(s) with the specified mask and
optionnally with a processing function and recursive flag.
 
@param path: Path to watch, the path can either be a file or a
             directory. Also accepts a sequence (list) of paths.
@type path: string or list of string
@param mask: Bitmask of events.
@type mask: int
@param proc_fun: Processing object.
@type proc_fun: function or ProcessEvent instance or instance of
                one of its subclasses or callable object.
@param rec: Recursively add watches from path on all its
            subdirectories, set to False by default (doesn't
            follows symlinks).
@type rec: bool
@param auto_add: Automatically add watches on newly created
                 directories in the watch's path.
@type auto_add: bool
@param do_glob: Do globbing on pathname.
@type do_glob: bool
@param quiet: if True raise an WatchManagerError exception on
              error. See example not_quiet.py
@type quiet: bool
@param exclude_filter: boolean function, returns True if current
                       path must be excluded from being watched.
                       Has precedence on exclude_filter defined
                       into __init__.
@type exclude_filter: bool
@return: 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 into this dict.
@rtype: dict of {str: int}
get_path(self, wd)
Returns the path associated to WD, if WD is unknown
None is returned.
 
@param wd: watch descriptor.
@type wd: int
@return: path or None.
@rtype: 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.
If path is unknown None is returned.
 
@param path: path.
@type path: str
@return: WD or None.
@rtype: int or None
rm_watch(self, wd, rec=False, quiet=True)
Removes watch(s).
 
@param wd: Watch Descriptor of the file or directory to unwatch.
           Also accepts a list of WDs.
@type wd: int or list of int.
@param rec: Recursively removes watches on every already watched
            subdirectories and subfiles.
@type rec: bool
@param quiet: if True raise an WatchManagerError exception on
              error. See example not_quiet.py
@type quiet: bool
@return: dict of watch descriptors associated to booleans values.
         True if the corresponding wd has been successfully
         removed, False otherwise.
@rtype: dict of int: bool
update_watch(self, wd, mask=None, proc_fun=None, rec=False, auto_add=False, quiet=True)
Update existing watch(s). Both the mask and the processing
object can be modified.
 
@param wd: Watch Descriptor to update. Also accepts a list of
             watch descriptors.
@type wd: int or list of int
@param mask: Optional new bitmask of events.
@type mask: int
@param proc_fun: Optional new processing function.
@type proc_fun: function or ProcessEvent instance or instance of
                one of its subclasses or callable object.
@param rec: Recursively update watches on every already watched
            subdirectories and subfiles.
@type rec: bool
@param auto_add: Automatically add watches on newly created
                 directories in the watch's path.
@type auto_add: bool
@param quiet: if True raise an WatchManagerError exception on
              error. See example not_quiet.py
@type quiet: bool
@return: dict of watch descriptors associated to booleans values.
         True if the corresponding wd has been successfully
         updated, False otherwise.
@rtype: dict of int: bool
watch_transient_file(self, filename, mask, proc_class)
Watch a transient file, which will be created and deleted frequently
over time (e.g. pid file).
 
@param filename: Filename.
@type filename: string
@param mask: Bitmask of events, should contain IN_CREATE and IN_DELETE.
@type mask: int
@param proc_class: ProcessEvent (or of one of its subclass), beware of
                   accepting a ProcessEvent's instance as argument into
                   __init__, see transient_file.py example for more
                   details.
@type proc_class: ProcessEvent's instance or of one of its subclasses.
@return: See add_watch().
@rtype: See add_watch().

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class WatchManagerError(exceptions.Exception)
    WatchManager Exception. Raised on error encountered on watches
operations.
 
 
Method resolution order:
WatchManagerError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, msg, wmd)
@param msg: Exception string's description.
@type msg: string
@param wmd: Results of previous operations made by the same function
            on previous wd or paths. It also contains the item which
            raised this exception.
@type wmd: dict

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x8141680>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
Functions
       
command_line()
glob0(dirname, basename)
glob1(dirname, pattern)
has_magic(s)
iglob(pathname)

 
Data
        ALL_EVENTS = 4095
IN_ACCESS = 1
IN_ATTRIB = 4
IN_CLOSE_NOWRITE = 16
IN_CLOSE_WRITE = 8
IN_CREATE = 256
IN_DELETE = 512
IN_DELETE_SELF = 1024
IN_DONT_FOLLOW = 33554432
IN_IGNORED = 32768
IN_ISDIR = 1073741824
IN_MASK_ADD = 536870912
IN_MODIFY = 2
IN_MOVED_FROM = 64
IN_MOVED_TO = 128
IN_MOVE_SELF = 2048
IN_ONESHOT = 2147483648L
IN_ONLYDIR = 16777216
IN_OPEN = 32
IN_Q_OVERFLOW = 16384
IN_UNMOUNT = 8192
LIBC = <CDLL 'None', handle b7fd6668 at b7c365ec>
__author__ = 'seb@dbzteam.org (Sebastien Martini)'
__version__ = '0.8.0s'
color_theme = <DefaultTheme>
console_handler = <logging.StreamHandler instance at 0xb7cf8dec>
flagc = 'EVENT_FLAGS'
i = 'max_user_watches'
log = <logging.Logger instance at 0xb7ce7fac>
magic_check = <_sre.SRE_Pattern object at 0xb7c350c0>
max_queued_events = <max_queued_events=16384>
max_user_instances = <max_user_instances=128>
max_user_watches = <max_user_watches=524288>
name = 'IN_UNMOUNT'
val = 8192
valc = {'IN_IGNORED': 32768, 'IN_Q_OVERFLOW': 16384, 'IN_UNMOUNT': 8192}

 
Author
        seb@dbzteam.org (Sebastien Martini)