Source

python-inotify / inotify / watcher.py

Diff from to

inotify/watcher.py

         self.threshold = threshold
         self._iocbuf = array.array('i', [0])
 
+    def readable(self):
+        fcntl.ioctl(self.fd, termios.FIONREAD, self._iocbuf, True)
+        return self._iocbuf[0]
+
     def __call__(self):
-        fcntl.ioctl(self.fd, termios.FIONREAD, self._iocbuf, True)
-        return self._iocbuf[0] >= threshold
+        return self.readable() >= self.threshold