Mercurial > libervia-backend
diff libervia/frontends/bridge/dbus_bridge.py @ 4280:4cf98f506269
bridge(constructor): fix template parsing, which was broken following `black` reformating.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 12 Jul 2024 17:58:06 +0200 |
parents | 0d7bb4df2343 |
children | 3a550e9a2b55 |
line wrap: on
line diff
--- a/libervia/frontends/bridge/dbus_bridge.py Fri Jul 05 17:18:37 2024 +0200 +++ b/libervia/frontends/bridge/dbus_bridge.py Fri Jul 12 17:58:06 2024 +0200 @@ -173,25 +173,15 @@ return get_plugin_method - def action_launch( - self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None - ): + + def action_launch(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return str( - self.db_core_iface.action_launch( - callback_id, - data, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return str(self.db_core_iface.action_launch(callback_id, data, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) def actions_get(self, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: @@ -199,12 +189,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.actions_get(profile_key, **kwargs) def config_get(self, section, name, callback=None, errback=None): @@ -213,69 +203,45 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return str(self.db_core_iface.config_get(section, name, **kwargs)) - def connect( - self, - profile_key="@DEFAULT@", - password="", - options={}, - callback=None, - errback=None, - ): + def connect(self, profile_key="@DEFAULT@", password='', options={}, callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.connect( - profile_key, - password, - options, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.connect(profile_key, password, options, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def contact_add( - self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None - ): + def contact_add(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.contact_add(entity_jid, profile_key, **kwargs) - def contact_del( - self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None - ): + def contact_del(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.contact_del( - entity_jid, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.contact_del(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def contact_get(self, arg_0, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: @@ -283,38 +249,22 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.contact_get( - arg_0, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.contact_get(arg_0, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def contact_update( - self, - entity_jid, - name, - groups, - profile_key="@DEFAULT@", - callback=None, - errback=None, - ): + def contact_update(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler - return self.db_core_iface.contact_update( - entity_jid, name, groups, profile_key, **kwargs - ) + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return self.db_core_iface.contact_update(entity_jid, name, groups, profile_key, **kwargs) def contacts_get(self, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: @@ -322,28 +272,21 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.contacts_get( - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.contacts_get(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def contacts_get_from_group( - self, group, profile_key="@DEFAULT@", callback=None, errback=None - ): + def contacts_get_from_group(self, group, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.contacts_get_from_group(group, profile_key, **kwargs) def devices_infos_get(self, bare_jid, profile_key, callback=None, errback=None): @@ -352,99 +295,35 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return str( - self.db_core_iface.devices_infos_get( - bare_jid, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return str(self.db_core_iface.devices_infos_get(bare_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) - def disco_find_by_features( - self, - namespaces, - identities, - bare_jid=False, - service=True, - roster=True, - own_jid=True, - local_device=False, - profile_key="@DEFAULT@", - callback=None, - errback=None, - ): + def disco_find_by_features(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.disco_find_by_features( - namespaces, - identities, - bare_jid, - service, - roster, - own_jid, - local_device, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.disco_find_by_features(namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def disco_infos( - self, - entity_jid, - node="", - use_cache=True, - profile_key="@DEFAULT@", - callback=None, - errback=None, - ): + def disco_infos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.disco_infos( - entity_jid, - node, - use_cache, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.disco_infos(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def disco_items( - self, - entity_jid, - node="", - use_cache=True, - profile_key="@DEFAULT@", - callback=None, - errback=None, - ): + def disco_items(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.disco_items( - entity_jid, - node, - use_cache, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.disco_items(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def disconnect(self, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: @@ -452,13 +331,8 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.disconnect( - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.disconnect(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def encryption_namespace_get(self, arg_0, callback=None, errback=None): if callback is None: @@ -466,12 +340,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return str(self.db_core_iface.encryption_namespace_get(arg_0, **kwargs)) def encryption_plugins_get(self, callback=None, errback=None): @@ -480,33 +354,22 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return str(self.db_core_iface.encryption_plugins_get(**kwargs)) - def encryption_trust_ui_get( - self, to_jid, namespace, profile_key, callback=None, errback=None - ): + def encryption_trust_ui_get(self, to_jid, namespace, profile_key, callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return str( - self.db_core_iface.encryption_trust_ui_get( - to_jid, - namespace, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return str(self.db_core_iface.encryption_trust_ui_get(to_jid, namespace, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) def entities_data_get(self, jids, keys, profile, callback=None, errback=None): if callback is None: @@ -514,12 +377,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.entities_data_get(jids, keys, profile, **kwargs) def entity_data_get(self, jid, keys, profile, callback=None, errback=None): @@ -528,12 +391,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.entity_data_get(jid, keys, profile, **kwargs) def features_get(self, profile_key, callback=None, errback=None): @@ -542,42 +405,17 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.features_get( - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.features_get(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def history_get( - self, - from_jid, - to_jid, - limit, - between=True, - filters="", - profile="@NONE@", - callback=None, - errback=None, - ): + def history_get(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.history_get( - from_jid, - to_jid, - limit, - between, - filters, - profile, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.history_get(from_jid, to_jid, limit, between, filters, profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def image_check(self, arg_0, callback=None, errback=None): if callback is None: @@ -585,12 +423,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return str(self.db_core_iface.image_check(arg_0, **kwargs)) def image_convert(self, source, dest, arg_2, extra, callback=None, errback=None): @@ -599,37 +437,17 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return str( - self.db_core_iface.image_convert( - source, - dest, - arg_2, - extra, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return str(self.db_core_iface.image_convert(source, dest, arg_2, extra, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) - def image_generate_preview( - self, image_path, profile_key, callback=None, errback=None - ): + def image_generate_preview(self, image_path, profile_key, callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return str( - self.db_core_iface.image_generate_preview( - image_path, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return str(self.db_core_iface.image_generate_preview(image_path, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) def image_resize(self, image_path, width, height, callback=None, errback=None): if callback is None: @@ -637,17 +455,8 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return str( - self.db_core_iface.image_resize( - image_path, - width, - height, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return str(self.db_core_iface.image_resize(image_path, width, height, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) def init_pre_script(self, callback=None, errback=None): if callback is None: @@ -655,10 +464,8 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.init_pre_script( - timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.init_pre_script(timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def is_connected(self, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: @@ -666,31 +473,27 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.is_connected(profile_key, **kwargs) - def main_resource_get( - self, contact_jid, profile_key="@DEFAULT@", callback=None, errback=None - ): + def main_resource_get(self, contact_jid, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler - return str( - self.db_core_iface.main_resource_get(contact_jid, profile_key, **kwargs) - ) + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return str(self.db_core_iface.main_resource_get(contact_jid, profile_key, **kwargs)) def menu_help_get(self, menu_id, language, callback=None, errback=None): if callback is None: @@ -698,40 +501,22 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return str(self.db_core_iface.menu_help_get(menu_id, language, **kwargs)) - def menu_launch( - self, - menu_type, - path, - data, - security_limit, - profile_key, - callback=None, - errback=None, - ): + def menu_launch(self, menu_type, path, data, security_limit, profile_key, callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.menu_launch( - menu_type, - path, - data, - security_limit, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.menu_launch(menu_type, path, data, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def menus_get(self, language, security_limit, callback=None, errback=None): if callback is None: @@ -739,12 +524,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.menus_get(language, security_limit, **kwargs) def message_encryption_get(self, to_jid, profile_key, callback=None, errback=None): @@ -753,40 +538,22 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler - return str( - self.db_core_iface.message_encryption_get(to_jid, profile_key, **kwargs) - ) + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return str(self.db_core_iface.message_encryption_get(to_jid, profile_key, **kwargs)) - def message_encryption_start( - self, - to_jid, - namespace="", - replace=False, - profile_key="@NONE@", - callback=None, - errback=None, - ): + def message_encryption_start(self, to_jid, namespace='', replace=False, profile_key="@NONE@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.message_encryption_start( - to_jid, - namespace, - replace, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.message_encryption_start(to_jid, namespace, replace, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def message_encryption_stop(self, to_jid, profile_key, callback=None, errback=None): if callback is None: @@ -794,43 +561,17 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.message_encryption_stop( - to_jid, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.message_encryption_stop(to_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def message_send( - self, - to_jid, - message, - subject={}, - mess_type="auto", - extra={}, - profile_key="@NONE@", - callback=None, - errback=None, - ): + def message_send(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.message_send( - to_jid, - message, - subject, - mess_type, - extra, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.message_send(to_jid, message, subject, mess_type, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def namespaces_get(self, callback=None, errback=None): if callback is None: @@ -838,89 +579,55 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.namespaces_get(**kwargs) - def notification_add( - self, - type_, - body_plain, - body_rich, - title, - is_global, - requires_action, - arg_6, - priority, - expire_at, - extra, - callback=None, - errback=None, - ): + def notification_add(self, type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra, callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler - return self.db_core_iface.notification_add( - type_, - body_plain, - body_rich, - title, - is_global, - requires_action, - arg_6, - priority, - expire_at, - extra, - **kwargs, - ) + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return self.db_core_iface.notification_add(type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra, **kwargs) - def notification_delete( - self, id_, is_global, profile_key, callback=None, errback=None - ): + def notification_delete(self, id_, is_global, profile_key, callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler - return self.db_core_iface.notification_delete( - id_, is_global, profile_key, **kwargs - ) + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return self.db_core_iface.notification_delete(id_, is_global, profile_key, **kwargs) - def notifications_expired_clean( - self, limit_timestamp, profile_key, callback=None, errback=None - ): + def notifications_expired_clean(self, limit_timestamp, profile_key, callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler - return self.db_core_iface.notifications_expired_clean( - limit_timestamp, profile_key, **kwargs - ) + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return self.db_core_iface.notifications_expired_clean(limit_timestamp, profile_key, **kwargs) def notifications_get(self, filters, profile_key, callback=None, errback=None): if callback is None: @@ -928,120 +635,59 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return str(self.db_core_iface.notifications_get(filters, profile_key, **kwargs)) - def param_get_a( - self, - name, - category, - attribute="value", - profile_key="@DEFAULT@", - callback=None, - errback=None, - ): - if callback is None: - error_handler = None - else: - if errback is None: - errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} - if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler - return str( - self.db_core_iface.param_get_a( - name, category, attribute, profile_key, **kwargs - ) - ) - - def param_get_a_async( - self, - name, - category, - attribute="value", - security_limit=-1, - profile_key="@DEFAULT@", - callback=None, - errback=None, - ): + def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return str( - self.db_core_iface.param_get_a_async( - name, - category, - attribute, - security_limit, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} + if callback is not None: + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return str(self.db_core_iface.param_get_a(name, category, attribute, profile_key, **kwargs)) - def param_set( - self, - name, - value, - category, - security_limit=-1, - profile_key="@DEFAULT@", - callback=None, - errback=None, - ): + def param_get_a_async(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} - if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler - return self.db_core_iface.param_set( - name, value, category, security_limit, profile_key, **kwargs - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return str(self.db_core_iface.param_get_a_async(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) - def param_ui_get( - self, - security_limit=-1, - app="", - extra="", - profile_key="@DEFAULT@", - callback=None, - errback=None, - ): + def param_set(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return str( - self.db_core_iface.param_ui_get( - security_limit, - app, - extra, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} + if callback is not None: + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return self.db_core_iface.param_set(name, value, category, security_limit, profile_key, **kwargs) + + def param_ui_get(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@", callback=None, errback=None): + if callback is None: + error_handler = None + else: + if errback is None: + errback = log.error + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return str(self.db_core_iface.param_ui_get(security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) def params_categories_get(self, callback=None, errback=None): if callback is None: @@ -1049,28 +695,26 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.params_categories_get(**kwargs) - def params_register_app( - self, xml, security_limit=-1, app="", callback=None, errback=None - ): + def params_register_app(self, xml, security_limit=-1, app='', callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.params_register_app(xml, security_limit, app, **kwargs) def params_template_load(self, filename, callback=None, errback=None): @@ -1079,12 +723,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.params_template_load(filename, **kwargs) def params_template_save(self, filename, callback=None, errback=None): @@ -1093,64 +737,36 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.params_template_save(filename, **kwargs) - def params_values_from_category_get_async( - self, - category, - security_limit=-1, - app="", - extra="", - profile_key="@DEFAULT@", - callback=None, - errback=None, - ): + def params_values_from_category_get_async(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.params_values_from_category_get_async( - category, - security_limit, - app, - extra, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.params_values_from_category_get_async(category, security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def presence_set( - self, - to_jid="", - show="", - statuses={}, - profile_key="@DEFAULT@", - callback=None, - errback=None, - ): + def presence_set(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler - return self.db_core_iface.presence_set( - to_jid, show, statuses, profile_key, **kwargs - ) + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return self.db_core_iface.presence_set(to_jid, show, statuses, profile_key, **kwargs) def presence_statuses_get(self, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: @@ -1158,12 +774,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.presence_statuses_get(profile_key, **kwargs) def private_data_delete(self, namespace, key, arg_2, callback=None, errback=None): @@ -1172,15 +788,8 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.private_data_delete( - namespace, - key, - arg_2, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.private_data_delete(namespace, key, arg_2, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def private_data_get(self, namespace, key, profile_key, callback=None, errback=None): if callback is None: @@ -1188,54 +797,26 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return str( - self.db_core_iface.private_data_get( - namespace, - key, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return str(self.db_core_iface.private_data_get(namespace, key, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) - def private_data_set( - self, namespace, key, data, profile_key, callback=None, errback=None - ): + def private_data_set(self, namespace, key, data, profile_key, callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.private_data_set( - namespace, - key, - data, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.private_data_set(namespace, key, data, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def profile_create( - self, profile, password="", component="", callback=None, errback=None - ): + def profile_create(self, profile, password='', component='', callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.profile_create( - profile, - password, - component, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.profile_create(profile, password, component, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def profile_delete_async(self, profile, callback=None, errback=None): if callback is None: @@ -1243,28 +824,21 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.profile_delete_async( - profile, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.profile_delete_async(profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def profile_is_session_started( - self, profile_key="@DEFAULT@", callback=None, errback=None - ): + def profile_is_session_started(self, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.profile_is_session_started(profile_key, **kwargs) def profile_name_get(self, profile_key="@DEFAULT@", callback=None, errback=None): @@ -1273,12 +847,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return str(self.db_core_iface.profile_name_get(profile_key, **kwargs)) def profile_set_default(self, profile, callback=None, errback=None): @@ -1287,45 +861,35 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.profile_set_default(profile, **kwargs) - def profile_start_session( - self, password="", profile_key="@DEFAULT@", callback=None, errback=None - ): + def profile_start_session(self, password='', profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.profile_start_session( - password, - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.profile_start_session(password, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) - def profiles_list_get( - self, clients=True, components=False, callback=None, errback=None - ): + def profiles_list_get(self, clients=True, components=False, callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.profiles_list_get(clients, components, **kwargs) def progress_get(self, id, profile, callback=None, errback=None): @@ -1334,12 +898,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.progress_get(id, profile, **kwargs) def progress_get_all(self, profile, callback=None, errback=None): @@ -1348,12 +912,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.progress_get_all(profile, **kwargs) def progress_get_all_metadata(self, profile, callback=None, errback=None): @@ -1362,12 +926,12 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.progress_get_all_metadata(profile, **kwargs) def ready_get(self, callback=None, errback=None): @@ -1376,10 +940,8 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.ready_get( - timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.ready_get(timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def roster_resync(self, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: @@ -1387,13 +949,8 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.roster_resync( - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.roster_resync(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def session_infos_get(self, profile_key, callback=None, errback=None): if callback is None: @@ -1401,13 +958,8 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - return self.db_core_iface.session_infos_get( - profile_key, - timeout=const_TIMEOUT, - reply_handler=callback, - error_handler=error_handler, - ) + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + return self.db_core_iface.session_infos_get(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) def sub_waiting_get(self, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: @@ -1415,28 +967,26 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.sub_waiting_get(profile_key, **kwargs) - def subscription( - self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None - ): + def subscription(self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None): if callback is None: error_handler = None else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return self.db_core_iface.subscription(sub_type, entity, profile_key, **kwargs) def version_get(self, callback=None, errback=None): @@ -1445,15 +995,16 @@ else: if errback is None: errback = log.error - error_handler = lambda err: errback(dbus_to_bridge_exception(err)) - kwargs = {} + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} if callback is not None: - kwargs["timeout"] = const_TIMEOUT - kwargs["reply_handler"] = callback - kwargs["error_handler"] = error_handler + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler return str(self.db_core_iface.version_get(**kwargs)) + class AIOBridge(bridge): def register_signal(self, functionName, handler, iface="core"): @@ -1518,1216 +1069,571 @@ ) return fut + def action_launch(self, callback_id, data, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.action_launch( - callback_id, - data, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.action_launch(callback_id, data, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def actions_get(self, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.actions_get( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.actions_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def config_get(self, section, name): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.config_get( - section, - name, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.config_get(section, name, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def connect(self, profile_key="@DEFAULT@", password="", options={}): + def connect(self, profile_key="@DEFAULT@", password='', options={}): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.connect( - profile_key, - password, - options, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.connect(profile_key, password, options, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def contact_add(self, entity_jid, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.contact_add( - entity_jid, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.contact_add(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def contact_del(self, entity_jid, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.contact_del( - entity_jid, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.contact_del(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def contact_get(self, arg_0, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.contact_get( - arg_0, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.contact_get(arg_0, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def contact_update(self, entity_jid, name, groups, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.contact_update( - entity_jid, - name, - groups, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.contact_update(entity_jid, name, groups, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def contacts_get(self, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.contacts_get( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.contacts_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def contacts_get_from_group(self, group, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.contacts_get_from_group( - group, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.contacts_get_from_group(group, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def devices_infos_get(self, bare_jid, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.devices_infos_get( - bare_jid, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.devices_infos_get(bare_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def disco_find_by_features( - self, - namespaces, - identities, - bare_jid=False, - service=True, - roster=True, - own_jid=True, - local_device=False, - profile_key="@DEFAULT@", - ): + def disco_find_by_features(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.disco_find_by_features( - namespaces, - identities, - bare_jid, - service, - roster, - own_jid, - local_device, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.disco_find_by_features(namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def disco_infos(self, entity_jid, node="", use_cache=True, profile_key="@DEFAULT@"): + def disco_infos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.disco_infos( - entity_jid, - node, - use_cache, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.disco_infos(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def disco_items(self, entity_jid, node="", use_cache=True, profile_key="@DEFAULT@"): + def disco_items(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.disco_items( - entity_jid, - node, - use_cache, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.disco_items(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def disconnect(self, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.disconnect( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.disconnect(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def encryption_namespace_get(self, arg_0): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.encryption_namespace_get( - arg_0, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.encryption_namespace_get(arg_0, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def encryption_plugins_get(self): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.encryption_plugins_get( - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.encryption_plugins_get(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def encryption_trust_ui_get(self, to_jid, namespace, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.encryption_trust_ui_get( - to_jid, - namespace, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.encryption_trust_ui_get(to_jid, namespace, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def entities_data_get(self, jids, keys, profile): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.entities_data_get( - jids, - keys, - profile, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.entities_data_get(jids, keys, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def entity_data_get(self, jid, keys, profile): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.entity_data_get( - jid, - keys, - profile, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.entity_data_get(jid, keys, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def features_get(self, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.features_get( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.features_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def history_get( - self, from_jid, to_jid, limit, between=True, filters="", profile="@NONE@" - ): + def history_get(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.history_get( - from_jid, - to_jid, - limit, - between, - filters, - profile, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.history_get(from_jid, to_jid, limit, between, filters, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def image_check(self, arg_0): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.image_check( - arg_0, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.image_check(arg_0, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def image_convert(self, source, dest, arg_2, extra): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.image_convert( - source, - dest, - arg_2, - extra, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.image_convert(source, dest, arg_2, extra, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def image_generate_preview(self, image_path, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.image_generate_preview( - image_path, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.image_generate_preview(image_path, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def image_resize(self, image_path, width, height): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.image_resize( - image_path, - width, - height, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.image_resize(image_path, width, height, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def init_pre_script(self): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.init_pre_script( - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.init_pre_script(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def is_connected(self, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.is_connected( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.is_connected(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def main_resource_get(self, contact_jid, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.main_resource_get( - contact_jid, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.main_resource_get(contact_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def menu_help_get(self, menu_id, language): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.menu_help_get( - menu_id, - language, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.menu_help_get(menu_id, language, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def menu_launch(self, menu_type, path, data, security_limit, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.menu_launch( - menu_type, - path, - data, - security_limit, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.menu_launch(menu_type, path, data, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def menus_get(self, language, security_limit): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.menus_get( - language, - security_limit, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.menus_get(language, security_limit, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def message_encryption_get(self, to_jid, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.message_encryption_get( - to_jid, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.message_encryption_get(to_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def message_encryption_start( - self, to_jid, namespace="", replace=False, profile_key="@NONE@" - ): + def message_encryption_start(self, to_jid, namespace='', replace=False, profile_key="@NONE@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.message_encryption_start( - to_jid, - namespace, - replace, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.message_encryption_start(to_jid, namespace, replace, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def message_encryption_stop(self, to_jid, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.message_encryption_stop( - to_jid, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.message_encryption_stop(to_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def message_send( - self, - to_jid, - message, - subject={}, - mess_type="auto", - extra={}, - profile_key="@NONE@", - ): + def message_send(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.message_send( - to_jid, - message, - subject, - mess_type, - extra, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.message_send(to_jid, message, subject, mess_type, extra, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def namespaces_get(self): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.namespaces_get( - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.namespaces_get(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def notification_add( - self, - type_, - body_plain, - body_rich, - title, - is_global, - requires_action, - arg_6, - priority, - expire_at, - extra, - ): + def notification_add(self, type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.notification_add( - type_, - body_plain, - body_rich, - title, - is_global, - requires_action, - arg_6, - priority, - expire_at, - extra, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.notification_add(type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def notification_delete(self, id_, is_global, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.notification_delete( - id_, - is_global, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.notification_delete(id_, is_global, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def notifications_expired_clean(self, limit_timestamp, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.notifications_expired_clean( - limit_timestamp, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.notifications_expired_clean(limit_timestamp, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def notifications_get(self, filters, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.notifications_get( - filters, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.notifications_get(filters, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.param_get_a( - name, - category, - attribute, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.param_get_a(name, category, attribute, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def param_get_a_async( - self, - name, - category, - attribute="value", - security_limit=-1, - profile_key="@DEFAULT@", - ): + def param_get_a_async(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.param_get_a_async( - name, - category, - attribute, - security_limit, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.param_get_a_async(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def param_set( - self, name, value, category, security_limit=-1, profile_key="@DEFAULT@" - ): + def param_set(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.param_set( - name, - value, - category, - security_limit, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.param_set(name, value, category, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def param_ui_get(self, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"): + def param_ui_get(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.param_ui_get( - security_limit, - app, - extra, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.param_ui_get(security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def params_categories_get(self): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.params_categories_get( - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.params_categories_get(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def params_register_app(self, xml, security_limit=-1, app=""): + def params_register_app(self, xml, security_limit=-1, app=''): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.params_register_app( - xml, - security_limit, - app, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.params_register_app(xml, security_limit, app, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def params_template_load(self, filename): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.params_template_load( - filename, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.params_template_load(filename, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def params_template_save(self, filename): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.params_template_save( - filename, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.params_template_save(filename, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def params_values_from_category_get_async( - self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@" - ): + def params_values_from_category_get_async(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.params_values_from_category_get_async( - category, - security_limit, - app, - extra, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.params_values_from_category_get_async(category, security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def presence_set(self, to_jid="", show="", statuses={}, profile_key="@DEFAULT@"): + def presence_set(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.presence_set( - to_jid, - show, - statuses, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.presence_set(to_jid, show, statuses, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def presence_statuses_get(self, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.presence_statuses_get( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.presence_statuses_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def private_data_delete(self, namespace, key, arg_2): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.private_data_delete( - namespace, - key, - arg_2, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.private_data_delete(namespace, key, arg_2, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def private_data_get(self, namespace, key, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.private_data_get( - namespace, - key, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.private_data_get(namespace, key, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def private_data_set(self, namespace, key, data, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.private_data_set( - namespace, - key, - data, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.private_data_set(namespace, key, data, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def profile_create(self, profile, password="", component=""): + def profile_create(self, profile, password='', component=''): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.profile_create( - profile, - password, - component, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.profile_create(profile, password, component, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def profile_delete_async(self, profile): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.profile_delete_async( - profile, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.profile_delete_async(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def profile_is_session_started(self, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.profile_is_session_started( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.profile_is_session_started(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def profile_name_get(self, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.profile_name_get( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.profile_name_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def profile_set_default(self, profile): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.profile_set_default( - profile, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.profile_set_default(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut - def profile_start_session(self, password="", profile_key="@DEFAULT@"): + def profile_start_session(self, password='', profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.profile_start_session( - password, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.profile_start_session(password, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def profiles_list_get(self, clients=True, components=False): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.profiles_list_get( - clients, - components, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.profiles_list_get(clients, components, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def progress_get(self, id, profile): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.progress_get( - id, - profile, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.progress_get(id, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def progress_get_all(self, profile): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.progress_get_all( - profile, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.progress_get_all(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def progress_get_all_metadata(self, profile): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.progress_get_all_metadata( - profile, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.progress_get_all_metadata(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def ready_get(self): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.ready_get( - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.ready_get(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def roster_resync(self, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.roster_resync( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.roster_resync(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def session_infos_get(self, profile_key): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.session_infos_get( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.session_infos_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def sub_waiting_get(self, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.sub_waiting_get( - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.sub_waiting_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.subscription( - sub_type, - entity, - profile_key, - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.subscription(sub_type, entity, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut def version_get(self): loop = asyncio.get_running_loop() fut = loop.create_future() reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) - error_handler = lambda err: loop.call_soon_threadsafe( - fut.set_exception, dbus_to_bridge_exception(err) - ) - self.db_core_iface.version_get( - timeout=const_TIMEOUT, - reply_handler=reply_handler, - error_handler=error_handler, - ) + error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err)) + self.db_core_iface.version_get(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler) return fut