"""Asynchronous pyinotify implementation"""
-import pyinotify
import asyncore
+try:
+ # pylint: disable-msg=E0611
+ from pyinotify import pyinotify
+except ImportError:
+ import pyinotify
+
class AsyncNotifier(asyncore.file_dispatcher):
"""An asyncore dispatcher for inotify events.
"""
+ # pylint: disable-msg=W0622,W0212
+ def __init__(self, watch_manager, default_proc_fun=None, map=None):
+ """Initializes this class.
- def __init__(self, watch_manager,
- default_proc_fun=None,
- map=None):
- """
- Constructor for AsyncNotifier, a special asyncore file_dispatcher that
- actually wraps a pyinotify Notifier, making it asyncronous.
+ This is a a special asyncore file_dispatcher that actually wraps a
+ pyinotify Notifier, making it asyncronous.
"""
if default_proc_fun is None:
- default_proc_fun=pyinotify.ProcessEvent()
+ default_proc_fun = pyinotify.ProcessEvent()
+
self.notifier = pyinotify.Notifier(watch_manager, default_proc_fun)
+
# here we need to steal the file descriptor from the notifier, so we can
# use it in the global asyncore select, and avoid calling the
# check_events() function of the notifier (which doesn't allow us to select
def handle_read(self):
self.notifier.read_events()
self.notifier.process_events()
-