(self, path_to_watch: str)
| 251 | return [types.Update.de_json(ju) for ju in json_updates] |
| 252 | |
| 253 | def _setup_change_detector(self, path_to_watch: str) -> None: |
| 254 | try: |
| 255 | from watchdog.observers import Observer |
| 256 | from telebot.ext.reloader import EventHandler |
| 257 | except ImportError: |
| 258 | raise ImportError( |
| 259 | 'Please install watchdog and psutil before using restart_on_change option.' |
| 260 | ) |
| 261 | |
| 262 | self.event_handler = EventHandler() |
| 263 | path = path_to_watch if path_to_watch else None |
| 264 | if path is None: |
| 265 | # Make it possible to specify --path argument to the script |
| 266 | path = sys.argv[sys.argv.index('--path') + 1] if '--path' in sys.argv else '.' |
| 267 | |
| 268 | self.event_observer = Observer() |
| 269 | self.event_observer.schedule(self.event_handler, path, recursive=True) |
| 270 | self.event_observer.start() |
| 271 | |
| 272 | async def polling(self, non_stop: bool=True, skip_pending=False, interval: int=0, timeout: int=20, |
| 273 | request_timeout: Optional[int]=None, allowed_updates: Optional[List[str]]=None, |
no test coverage detected