def _on_wrapper(*handlers: T.Callable) -> T.Callable: """wrapper for on decorator""" if event not in self._events: self._events[event] = [] for handler in handlers: self._events[event].append(weakproxy(handler)) return handlers[0]
def start_events_process(self, name: str, klass: Type[EventsProcess]) -> None: with self._registry_dict_lock: self._registry_dict[name] = process = klass( _registry=weakproxy(self)) process.start() LOGGER.debug("New process `%s' started at %s", name, self)
def get_user_client(self, user, password, populate=True): """ Returns a new client for the given user. This is a lightweight client that only uses different credentials and shares the transport with the underlying client """ return XCLIClientForUser(weakproxy(self), user, password, populate=populate)
def get_remote_client(self, target_name, user=None, password=None): """ Returns a new client for the remote target. This is a lightweight client that only uses different credentials and shares the transport with the underlying client """ if user: base = self.get_user_client(user, password, populate=False) else: base = weakproxy(self) return RemoteXCLIClient(base, target_name, populate=True)
def __init__(self, test, results): self.test = weakproxy(test) self.results = iter(results)
def __setitem__(self, key: str, value: Type[SctEvent]): if not value.is_abstract() and key not in self.max_severities: raise ValueError(f"There is no max severity configured for {key}") super().__setitem__(key, weakproxy(value)) # pylint: disable=no-member; pylint doesn't know about Dict
def __init__(self): self._contexts = [self.DEFAULT_OPTIONS.copy()] self.cmd = CommandNamespace(weakproxy(self))
def __init__(self, model): self._model = weakproxy(model) self._scheduler = Scheduler()