mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-08 22:17:17 +00:00
Make recursive watching optional and underscore private attributes/methods
This commit is contained in:
parent
d2131682a8
commit
20bfe3c352
@ -68,7 +68,8 @@ class InotifyObserver:
|
||||
self._path = path
|
||||
self._patterns = patterns
|
||||
self._exclude = exclude
|
||||
self.observer = Observer()
|
||||
self._recursive = recursive
|
||||
self._observer = Observer()
|
||||
self._reset(path, patterns, exclude)
|
||||
|
||||
def _reset(self, path, patterns, exclude):
|
||||
@ -77,8 +78,8 @@ class InotifyObserver:
|
||||
def on_any_event(self, event):
|
||||
dispatch_event(event)
|
||||
self.handler = TransformerEventHandler(patterns, exclude)
|
||||
self.observer.unschedule_all()
|
||||
self.observer.schedule(self.handler, path, recursive)
|
||||
self._observer.unschedule_all()
|
||||
self._observer.schedule(self.handler, path, self._recursive)
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
@ -108,11 +109,11 @@ class InotifyObserver:
|
||||
self._reset(self._path, self._patterns, exclude)
|
||||
|
||||
def start(self):
|
||||
self.observer.start()
|
||||
self._observer.start()
|
||||
|
||||
def stop(self):
|
||||
self.observer.stop()
|
||||
self.observer.join()
|
||||
self._observer.stop()
|
||||
self._observer.join()
|
||||
|
||||
def dispatch_event(self, event):
|
||||
event_to_action = {
|
||||
|
Loading…
Reference in New Issue
Block a user