diff --git a/lib/tfw/components/inotify/inotify.py b/lib/tfw/components/inotify/inotify.py index a989f83..4f69a02 100644 --- a/lib/tfw/components/inotify/inotify.py +++ b/lib/tfw/components/inotify/inotify.py @@ -76,11 +76,6 @@ class InotifyObserver: self._reset() def _reset(self): - dispatch_event = self._dispatch_event - class TransformerEventHandler(PatternMatchingEventHandler): - def on_any_event(self, event): - dispatch_event(event) - if isinstance(self._paths, str): self._paths = [self._paths] if isinstance(self._paths, Iterable): @@ -89,10 +84,11 @@ class InotifyObserver: raise ValueError('Expected one or more string paths.') patterns = self._files+self.patterns - self.handler = TransformerEventHandler(patterns if patterns else None, self.exclude) + handler = PatternMatchingEventHandler(patterns if patterns else None, self.exclude) + handler.on_any_event = self._dispatch_event self._observer.unschedule_all() for path in self.paths: - self._observer.schedule(self.handler, path, self._recursive) + self._observer.schedule(handler, path, self._recursive) def _extract_files_from_paths(self): files, paths = [], []