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

Class AsyncNotifier

source code


This notifier inherits from asyncore.file_dispatcher in order to be able to use pyinotify along with the asyncore framework.

Instance Methods [hide private]
 
__init__(self, watch_manager, default_proc_fun=None, read_freq=0, threshold=0, timeout=None, channel_map=None)
Initializes the async notifier.
source code
 
handle_read(self)
When asyncore tells us we can read from the fd, we proceed processing events.
source code

Inherited from asyncore.file_dispatcher: set_file

Inherited from asyncore.dispatcher: __getattr__, __repr__, __str__, accept, add_channel, bind, close, connect, create_socket, del_channel, handle_accept, handle_close, handle_connect, handle_connect_event, handle_error, handle_expt, handle_expt_event, handle_read_event, handle_write, handle_write_event, listen, log, log_info, readable, recv, send, set_reuse_addr, set_socket, writable

Inherited from Notifier: append_event, check_events, coalesce_events, loop, proc_fun, process_events, read_events, stop

Inherited from Notifier (private): _sleep

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

Class Variables [hide private]

Inherited from asyncore.dispatcher: accepting, addr, closing, connected, connecting, debug, ignore_log_types

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, watch_manager, default_proc_fun=None, read_freq=0, threshold=0, timeout=None, channel_map=None)
(Constructor)

source code 

Initializes the async notifier. The only additional parameter is 'channel_map' which is the optional asyncore private map. See Notifier class for the meaning of the others parameters.

Parameters:
  • watch_manager - Watch Manager.
  • default_proc_fun - Default processing method. If None, a new instance of PrintAllEvents will be assigned.
  • read_freq - if read_freq == 0, events are read asap, if read_freq is > 0, this thread sleeps max(0, read_freq - (timeout / 1000)) seconds. But if timeout is None it may be different because poll is blocking waiting for something to read.
  • threshold - File descriptor will be read only if the accumulated size to read becomes >= threshold. If != 0, you likely want to use it in combination with an appropriate value for read_freq because without that you would keep looping without really reading anything and that until the amount of events to read is >= threshold. At least with read_freq set you might sleep.
  • timeout - see read_freq above. If provided, it must be set in milliseconds. See https://docs.python.org/2/library/select.html#polling-objects
Overrides: object.__init__

handle_read(self)

source code 

When asyncore tells us we can read from the fd, we proceed processing events. This method can be overridden for handling a notification differently.

Overrides: asyncore.dispatcher.handle_read