summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Martini <ookoi@mars.(none)>2008-03-31 04:08:49 +0200
committerSebastien Martini <ookoi@mars.(none)>2008-03-31 04:08:49 +0200
commit9b43851fd710e7a621e8b31f157e50c23720cd53 (patch)
treef5dacede9fda61d365605b24c8a8c0cf76060587
parent9bd63dc25643dc6959ad020de8c665d4698fe705 (diff)
downloadpyinotify-9b43851fd710e7a621e8b31f157e50c23720cd53.tar.gz
Cosmetic changes.
-rw-r--r--chain.py2
-rwxr-xr-xpyinotify.py30
-rw-r--r--stats.py2
3 files changed, 17 insertions, 17 deletions
diff --git a/chain.py b/chain.py
index a21f4f8..f374f21 100644
--- a/chain.py
+++ b/chain.py
@@ -28,7 +28,7 @@ class Empty(ProcessEvent):
fo = file('/var/log/pyinotify_log', 'w')
wm = WatchManager()
# It is important to pass named extra arguments like 'fileobj'.
-notifier = Notifier(wm,
+notifier = Notifier(wm,
default_proc_fun=Empty(TrackMofications(Log(fileobj=fo)),
msg='outtee chained function'))
wm.add_watch('/tmp', ALL_EVENTS)
diff --git a/pyinotify.py b/pyinotify.py
index f2cfb07..82442b1 100755
--- a/pyinotify.py
+++ b/pyinotify.py
@@ -847,10 +847,10 @@ class Notifier:
Read notifications, process events.
"""
- def __init__(self, watch_manager, default_proc_fun=ProcessEvent(),
+ def __init__(self, watch_manager, default_proc_fun=ProcessEvent(),
read_freq=0, treshold=0, timeout=None):
"""
- Initialization. read_freq, treshold and timeout parameters are used
+ Initialization. read_freq, treshold and timeout parameters are used
when looping.
@@ -865,10 +865,10 @@ class Notifier:
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
+ 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:
@@ -932,8 +932,8 @@ class Notifier:
queue_size = buf_[0]
if queue_size < self._treshold:
log.debug('(fd: %d) %d bytes available to read but '
- 'treshold is fixed to %d bytes' % (self._fd,
- queue_size,
+ 'treshold is fixed to %d bytes' % (self._fd,
+ queue_size,
self._treshold))
return
@@ -1059,7 +1059,7 @@ class Notifier:
def loop(self, callback=None, daemonize=False, **args):
"""
- Events are read only once time every min(read_freq, timeout)
+ 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.
@@ -1124,10 +1124,10 @@ class ThreadedNotifier(threading.Thread, Notifier):
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
+ 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:
@@ -1141,7 +1141,7 @@ class ThreadedNotifier(threading.Thread, Notifier):
# stop condition
self._stop_event = threading.Event()
# init Notifier base class
- Notifier.__init__(self, watch_manager, default_proc_fun, read_freq,
+ Notifier.__init__(self, watch_manager, default_proc_fun, read_freq,
treshold, timeout)
def stop(self):
@@ -1157,7 +1157,7 @@ class ThreadedNotifier(threading.Thread, Notifier):
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)
+ Events are read only once time every min(read_freq, timeout)
seconds at best and only if the size to read is >= treshold.
"""
# Read and process events while _stop_event condition
diff --git a/stats.py b/stats.py
index c7c31e3..f6b3adc 100644
--- a/stats.py
+++ b/stats.py
@@ -18,7 +18,7 @@ def on_loop(notifier):
wm = WatchManager()
# Stats is a subclass of ProcessEvent provided by pyinotify
# for computing basics statistics.
-s = Stats()
+s = Stats()
notifier = Notifier(wm, default_proc_fun=Identity(s), read_freq=5)
wm.add_watch('/tmp/', ALL_EVENTS, rec=True, auto_add=True)
notifier.loop(callback=on_loop)