Module pyinotify :: Class ProcessEvent
[hide private]
[frames] | no frames]

Class ProcessEvent

source code


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 a 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.
Instance Methods [hide private]
 
__init__(self, pevent=None, **kargs)
Enable chaining of ProcessEvent instances.
source code
 
my_init(self, **kargs)
Override this method when subclassing if you want to achieve custom initialization of your subclass' instance.
source code
bool
__call__(self, event)
To behave like a functor the object must be callable.
source code
 
nested_pevent(self) source code
 
process_default(self, event)
Default default processing event method.
source code

Inherited from _ProcessEvent: __repr__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  pevent = None
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, pevent=None, **kargs)
(Constructor)

source code 

Enable chaining of ProcessEvent instances.

Parameters:
  • pevent (callable) - optional callable object, will be called on event processing (before self).
  • kargs (dict) - optional arguments delagated to template method my_init
Overrides: object.__init__

my_init(self, **kargs)

source code 

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.

Parameters:
  • kargs (dict) - optional arguments delagated to template method my_init

__call__(self, event)
(Call operator)

source code 

To behave like a functor the object must be callable. This method is a dispatch method. Lookup order:

  1. process_MASKNAME method
  2. process_FAMILY_NAME method
  3. otherwise call process_default
Parameters:
  • event - Event to be processed.
Returns: bool
By convention when used from the ProcessEvent class:
  • Returning False or None (default value) means keep on executing next chained functors (see chain.py example).
  • Returning True instead means do not execute next processing functions.
Raises:
Overrides: _ProcessEvent.__call__
(inherited documentation)

process_default(self, event)

source code 

Default default processing event method. Print event on standart output.

Parameters:
  • event (Event instance) - Event to be processed.