Ejemplo n.º 1
0
 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]
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
0
 def __init__(self, test, results):
     self.test = weakproxy(test)
     self.results = iter(results)
Ejemplo n.º 7
0
 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
Ejemplo n.º 8
0
 def __init__(self):
     self._contexts = [self.DEFAULT_OPTIONS.copy()]
     self.cmd = CommandNamespace(weakproxy(self))
Ejemplo n.º 9
0
 def __init__(self):
     self._contexts = [self.DEFAULT_OPTIONS.copy()]
     self.cmd = CommandNamespace(weakproxy(self))
Ejemplo n.º 10
0
 def __init__(self, model):
     self._model = weakproxy(model)
     self._scheduler = Scheduler()