def _ensure_monitor(self, handler_file): handler_dir = os.path.dirname(handler_file) monitor = self._repo_monitors.get(handler_dir) if monitor is None: monitor = FileMonitor(handler_dir) monitor.on('change', self._on_change) self._repo_monitors[handler_dir] = monitor