Beispiel #1
0
 def __init__(self,
              timeout=DEFAULT_OBSERVER_TIMEOUT,
              generate_full_events=False):
     if (generate_full_events):
         BaseObserver.__init__(self,
                               emitter_class=InotifyFullEmitter,
                               timeout=timeout)
     else:
         BaseObserver.__init__(self,
                               emitter_class=InotifyEmitter,
                               timeout=timeout)
Beispiel #2
0
 def __init__(self, stat, listdir, polling_interval=1):
     """
     :param stat: stat function. See ``os.stat`` for details.
     :param listdir: listdir function. See ``os.scandir`` for details.
     :type polling_interval: float
     :param polling_interval: interval in seconds between polling the file system.
     """
     emitter_cls = partial(PollingEmitter, stat=stat, listdir=listdir)
     BaseObserver.__init__(self,
                           emitter_class=emitter_cls,
                           timeout=polling_interval)
Beispiel #3
0
 def __init__(self, timeout=DEFAULT_OBSERVER_TIMEOUT):
     BaseObserver.__init__(self,
                           emitter_class=KqueueEmitter,
                           timeout=timeout)
Beispiel #4
0
 def schedule(self, event_handler, path, recursive=False):
     # Fix for issue #26: Trace/BPT error when given a unicode path
     # string. https://github.com/gorakhargosh/watchdog/issues#issue/26
     if isinstance(path, str):
         path = unicodedata.normalize('NFC', path)
     return BaseObserver.schedule(self, event_handler, path, recursive)