def watch(self, callback): def callback_wrapper(): entries = self.get_new_entries() if entries: callback(entries) timer = TimerClass(self.poll_interval, callback_wrapper) timer.daemon = True timer.start() return timer
def watch(self, callback: Callable[..., Any]) -> TimerClass: def callback_wrapper() -> None: entries = self.get_new_entries() if entries: callback(entries) timer = TimerClass(self.poll_interval, callback_wrapper) timer.daemon = True timer.start() return timer