From 82e2c6efaca520d1f08e0ed43605ca7a58f105b9 Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 9 Mar 2026 09:22:04 +0100 Subject: [PATCH] apply `black` to the whole codebase. --- doc/conf.py | 1 - .../bridge/bridge_constructor/constants.py | 4 +- .../constructors/dbus/constructor.py | 4 +- .../constructors/dbus/dbus_core_template.py | 1 - .../dbus/dbus_frontend_template.py | 1 - .../constructors/embedded/constructor.py | 16 +--- .../constructors/mediawiki/constructor.py | 14 +-- .../constructors/pb/constructor.py | 6 +- libervia/backend/bridge/dbus_bridge.py | 1 - libervia/backend/core/core_types.py | 1 - libervia/backend/core/exceptions.py | 2 + libervia/backend/core/log.py | 1 + libervia/backend/core/log_config.py | 1 + libervia/backend/core/main.py | 1 - libervia/backend/memory/cache.py | 1 - libervia/backend/memory/crypto.py | 1 - libervia/backend/memory/disco.py | 1 - libervia/backend/memory/encryption.py | 1 - libervia/backend/memory/memory.py | 1 - ...7e4_create_virtual_table_for_full_text_.py | 1 - ...6b6d4_use_json_type_in_history_and_for_.py | 1 - ...1aa1f686_create_table_for_notifications.py | 1 - ...92_add_origin_id_column_to_history_and_.py | 1 - ...8_drop_message_types_table_fix_nullable.py | 1 - .../610345f77e75_add_version_id_to_history.py | 1 - ...6_add_is_retroactive_to_thread_and_fix_.py | 1 - ...4_create_table_for_pubsub_subscriptions.py | 1 - ...c51d22_create_tables_for_pubsub_caching.py | 1 - ...b973_add_affiliations_access_model_and_.py | 1 - ..._add_parent_node_id_and_linked_mode_id_.py | 1 - libervia/backend/memory/persistent.py | 1 - libervia/backend/memory/sqla.py | 1 - libervia/backend/memory/sqla_mapping.py | 1 - .../backend/plugins/plugin_blog_import.py | 1 - .../plugins/plugin_blog_import_dokuwiki.py | 6 +- .../plugins/plugin_blog_import_dotclear.py | 7 +- .../plugins/plugin_comp_ap_gateway/ad_hoc.py | 1 - .../plugins/plugin_comp_ap_gateway/events.py | 1 - .../plugin_comp_ap_gateway/pubsub_service.py | 1 - .../backend/plugins/plugin_exp_lang_detect.py | 4 +- .../plugins/plugin_exp_pubsub_admin.py | 6 +- .../backend/plugins/plugin_misc_account.py | 7 +- .../backend/plugins/plugin_misc_android.py | 2 - .../plugin_misc_app_manager/__init__.py | 14 +-- .../backend/plugins/plugin_misc_attach.py | 1 - libervia/backend/plugins/plugin_misc_debug.py | 1 - .../plugins/plugin_misc_email_invitation.py | 6 +- .../backend/plugins/plugin_misc_extra_pep.py | 1 - libervia/backend/plugins/plugin_misc_file.py | 7 +- libervia/backend/plugins/plugin_misc_ip.py | 10 +-- .../plugins/plugin_misc_merge_requests.py | 1 - .../backend/plugins/plugin_misc_nat_port.py | 1 - libervia/backend/plugins/plugin_misc_quiz.py | 1 - .../plugins/plugin_misc_register_account.py | 1 - .../backend/plugins/plugin_misc_room_game.py | 8 +- libervia/backend/plugins/plugin_misc_tarot.py | 1 - .../plugins/plugin_misc_text_commands.py | 1 - .../backend/plugins/plugin_misc_uri_finder.py | 8 +- .../plugins/plugin_misc_url_preview.py | 8 +- .../backend/plugins/plugin_misc_watched.py | 1 - .../backend/plugins/plugin_misc_welcome.py | 7 +- .../backend/plugins/plugin_misc_xmllog.py | 4 +- .../backend/plugins/plugin_pubsub_cache.py | 1 - libervia/backend/plugins/plugin_sec_aesgcm.py | 8 +- .../backend/plugins/plugin_tickets_import.py | 1 - .../plugins/plugin_tickets_import_bugzilla.py | 7 +- libervia/backend/plugins/plugin_xep_0045.py | 1 - libervia/backend/plugins/plugin_xep_0049.py | 1 - libervia/backend/plugins/plugin_xep_0055.py | 1 - libervia/backend/plugins/plugin_xep_0059.py | 1 - libervia/backend/plugins/plugin_xep_0065.py | 1 - libervia/backend/plugins/plugin_xep_0082.py | 1 - libervia/backend/plugins/plugin_xep_0084.py | 1 - libervia/backend/plugins/plugin_xep_0095.py | 1 - libervia/backend/plugins/plugin_xep_0163.py | 1 - .../plugins/plugin_xep_0166/__init__.py | 1 - .../plugins/plugin_xep_0167/__init__.py | 1 - .../plugins/plugin_xep_0167/constants.py | 1 - libervia/backend/plugins/plugin_xep_0199.py | 1 - libervia/backend/plugins/plugin_xep_0203.py | 1 - libervia/backend/plugins/plugin_xep_0234.py | 1 - libervia/backend/plugins/plugin_xep_0292.py | 1 - libervia/backend/plugins/plugin_xep_0297.py | 1 - libervia/backend/plugins/plugin_xep_0313.py | 1 - libervia/backend/plugins/plugin_xep_0320.py | 1 - libervia/backend/plugins/plugin_xep_0329.py | 9 +- libervia/backend/plugins/plugin_xep_0334.py | 1 - libervia/backend/plugins/plugin_xep_0363.py | 1 - libervia/backend/plugins/plugin_xep_0372.py | 9 +- libervia/backend/plugins/plugin_xep_0374.py | 1 - libervia/backend/plugins/plugin_xep_0384.py | 6 +- libervia/backend/plugins/plugin_xep_0420.py | 1 - libervia/backend/plugins/plugin_xep_0424.py | 4 +- libervia/backend/plugins/plugin_xep_0448.py | 8 +- libervia/backend/plugins/plugin_xep_0470.py | 1 - libervia/backend/plugins/plugin_xep_0475.py | 1 - libervia/backend/plugins/plugin_xep_0477.py | 1 - libervia/backend/stdui/ui_profile_manager.py | 1 - .../test/test_plugin_misc_groupblog.py | 5 +- .../backend/test/test_plugin_misc_radiocol.py | 1 - libervia/backend/test/test_plugin_xep_0203.py | 7 +- libervia/backend/test/test_plugin_xep_0277.py | 14 +-- libervia/backend/test/test_plugin_xep_0297.py | 9 +- .../backend/tools/common/async_process.py | 4 +- libervia/backend/tools/common/async_utils.py | 1 - libervia/backend/tools/common/data_format.py | 1 + libervia/backend/tools/common/data_objects.py | 1 - .../backend/tools/common/dynamic_import.py | 1 - libervia/backend/tools/common/email.py | 1 - libervia/backend/tools/common/files_utils.py | 2 +- libervia/backend/tools/common/template.py | 4 +- libervia/backend/tools/common/tls.py | 1 - libervia/backend/tools/config.py | 2 +- libervia/backend/tools/utils.py | 6 +- libervia/backend/tools/video.py | 2 +- libervia/backend/tools/web.py | 1 - libervia/backend/tools/xml_tools.py | 1 - libervia/backend/tools/xmpp_datetime.py | 1 - libervia/cli/base.py | 7 +- libervia/cli/call_gui.py | 1 - libervia/cli/call_simple.py | 1 - libervia/cli/call_tui.py | 1 - libervia/cli/cmd_account.py | 1 - libervia/cli/cmd_avatar.py | 1 - libervia/cli/cmd_contacts.py | 3 +- libervia/cli/cmd_message.py | 1 - libervia/cli/cmd_shell.py | 6 +- libervia/cli/output_std.py | 11 ++- libervia/cli/output_template.py | 1 - libervia/cli/output_xml.py | 1 - libervia/cli/output_xmlui.py | 1 - libervia/frontends/bridge/dbus_bridge.py | 1 - .../frontends/quick_frontend/quick_app.py | 1 - .../frontends/quick_frontend/quick_chat.py | 1 - .../frontends/quick_frontend/quick_menus.py | 1 - .../frontends/quick_frontend/quick_utils.py | 8 +- .../frontends/quick_frontend/quick_widgets.py | 1 - libervia/frontends/tools/host_listener.py | 1 - libervia/frontends/tools/portal_desktop.py | 1 - libervia/frontends/tools/webrtc.py | 6 +- libervia/frontends/tools/webrtc_file.py | 1 - libervia/frontends/tools/xmlui.py | 1 - libervia/tui/chat.py | 1 - libervia/tui/keys.py | 1 - libervia/tui/xmlui.py | 2 +- tests/e2e/libervia-cli/conftest.py | 6 +- tests/e2e/libervia-cli/test_libervia-cli.py | 1 - tests/e2e/libervia-web/conftest.py | 1 - tests/e2e/libervia-web/test_libervia-web.py | 1 - tests/e2e/run_e2e.py | 12 +-- tests/unit/__init__.py | 1 - tests/unit/frontends/test_webrtc.py | 4 +- tests/unit/test_ap-gateway.py | 19 ++--- .../unit/test_plugin_misc_pubsub_contacts.py | 1 + tests/unit/test_plugin_xep_0082.py | 1 - tests/unit/test_plugin_xep_0167.py | 24 ++---- tests/unit/test_plugin_xep_0176.py | 6 +- tests/unit/test_plugin_xep_0215.py | 24 ++---- tests/unit/test_plugin_xep_0234.py | 24 ++---- tests/unit/test_plugin_xep_0293.py | 12 +-- tests/unit/test_plugin_xep_0373.py | 1 - tests/unit/test_plugin_xep_0420.py | 85 ++++++------------- twisted/plugins/libervia_backend_plugin.py | 1 - 163 files changed, 175 insertions(+), 448 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 408fd203..c472a706 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -17,7 +17,6 @@ import os.path import re from libervia.backend import __version__ - sys.path.insert(0, os.path.abspath("./_ext")) diff --git a/libervia/backend/bridge/bridge_constructor/constants.py b/libervia/backend/bridge/bridge_constructor/constants.py index af8a1c72..f71c1517 100644 --- a/libervia/backend/bridge/bridge_constructor/constants.py +++ b/libervia/backend/bridge/bridge_constructor/constants.py @@ -31,9 +31,7 @@ class Const(constants.Const): This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions. - """.format( - name=NAME, version=constants.Const.APP_VERSION - ) + """.format(name=NAME, version=constants.Const.APP_VERSION) #  TODO: move protocoles in separate files (plugins?) DEFAULT_PROTOCOLE = "dbus" diff --git a/libervia/backend/bridge/bridge_constructor/constructors/dbus/constructor.py b/libervia/backend/bridge/bridge_constructor/constructors/dbus/constructor.py index 02941eb7..7c3014a9 100644 --- a/libervia/backend/bridge/bridge_constructor/constructors/dbus/constructor.py +++ b/libervia/backend/bridge/bridge_constructor/constructors/dbus/constructor.py @@ -100,9 +100,7 @@ class DbusConstructor(base_constructor.Constructor): ) else: # XXX: To have a blocking call, we must have not reply_handler, so we test if callback exists, and add reply_handler only in this case - completion[ - "blocking_call" - ] = """kwargs={} + completion["blocking_call"] = """kwargs={} if callback is not None: kwargs['timeout'] = const_TIMEOUT kwargs['reply_handler'] = callback diff --git a/libervia/backend/bridge/bridge_constructor/constructors/dbus/dbus_core_template.py b/libervia/backend/bridge/bridge_constructor/constructors/dbus/dbus_core_template.py index 973305dc..7cda7442 100644 --- a/libervia/backend/bridge/bridge_constructor/constructors/dbus/dbus_core_template.py +++ b/libervia/backend/bridge/bridge_constructor/constructors/dbus/dbus_core_template.py @@ -26,7 +26,6 @@ from libervia.backend.tools import config from txdbus import client, objects, error from txdbus.interface import DBusInterface, Method, Signal - log = getLogger(__name__) # Interface prefix diff --git a/libervia/backend/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py b/libervia/backend/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py index 39aeb544..fc73a4c7 100644 --- a/libervia/backend/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py +++ b/libervia/backend/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py @@ -26,7 +26,6 @@ from libervia.backend.core.exceptions import BridgeExceptionNoService, BridgeIni from dbus.mainloop.glib import DBusGMainLoop from .bridge_frontend import BridgeException - DBusGMainLoop(set_as_default=True) log = getLogger(__name__) diff --git a/libervia/backend/bridge/bridge_constructor/constructors/embedded/constructor.py b/libervia/backend/bridge/bridge_constructor/constructors/embedded/constructor.py index dfacd27d..16daa7c6 100644 --- a/libervia/backend/bridge/bridge_constructor/constructors/embedded/constructor.py +++ b/libervia/backend/bridge/bridge_constructor/constructors/embedded/constructor.py @@ -62,8 +62,7 @@ class EmbeddedConstructor(base_constructor.Constructor): completion["cb_or_lambda"] = ( "callback" if function["sig_out"] else "lambda __: callback()" ) - completion["ret_routine"] = ( - """\ + completion["ret_routine"] = """\ d = self._methods_cbs["{name}"]({args_result}) if callback is not None: d.addCallback({cb_or_lambda}) @@ -72,14 +71,10 @@ class EmbeddedConstructor(base_constructor.Constructor): else: d.addErrback(errback) return d - """.format( - **completion - ) - ) + """.format(**completion) else: completion["ret_or_nothing"] = "ret" if function["sig_out"] else "" - completion["ret_routine"] = ( - """\ + completion["ret_routine"] = """\ try: ret = self._methods_cbs["{name}"]({args_result}) except Exception as e: @@ -91,10 +86,7 @@ class EmbeddedConstructor(base_constructor.Constructor): if callback is None: return ret else: - callback({ret_or_nothing})""".format( - **completion - ) - ) + callback({ret_or_nothing})""".format(**completion) def core_completion_signal(self, completion, function, default, arg_doc, async_): completion.update( diff --git a/libervia/backend/bridge/bridge_constructor/constructors/mediawiki/constructor.py b/libervia/backend/bridge/bridge_constructor/constructors/mediawiki/constructor.py index 2c88f812..8b24f6d6 100644 --- a/libervia/backend/bridge/bridge_constructor/constructors/mediawiki/constructor.py +++ b/libervia/backend/bridge/bridge_constructor/constructors/mediawiki/constructor.py @@ -88,14 +88,11 @@ class MediawikiConstructor(base_constructor.Constructor): print(("Adding %s %s" % (section, function["type"]))) async_msg = """
'''This method is asynchronous'''""" deprecated_msg = """
'''/!\ WARNING /!\ : This method is deprecated, please don't use it !'''""" - signature_signal = ( - """\ + signature_signal = """\ ! scope=row | signature | %s |-\ -""" - % function["sig_in"] - ) +""" % function["sig_in"] signature_method = """\ ! scope=row | signature in | %s @@ -126,8 +123,7 @@ class MediawikiConstructor(base_constructor.Constructor): } dest = signals_part if function["type"] == "signal" else methods_part - dest.append( - """\ + dest.append("""\ == %(name)s == ''%(doc)s'' %(deprecated)s @@ -141,9 +137,7 @@ class MediawikiConstructor(base_constructor.Constructor): | %(parameters)s%(return)s |} -""" - % completion - ) +""" % completion) # at this point, signals_part, and methods_part should be filled, # we just have to place them in the right part of the template diff --git a/libervia/backend/bridge/bridge_constructor/constructors/pb/constructor.py b/libervia/backend/bridge/bridge_constructor/constructors/pb/constructor.py index 444a11b4..4eb5126a 100644 --- a/libervia/backend/bridge/bridge_constructor/constructors/pb/constructor.py +++ b/libervia/backend/bridge/bridge_constructor/constructors/pb/constructor.py @@ -23,11 +23,9 @@ class pbConstructor(base_constructor.Constructor): NAME = "pb" CORE_TEMPLATE = "pb_core_template.py" CORE_DEST = "pb.py" - CORE_FORMATS = { - "signals": """\ + CORE_FORMATS = {"signals": """\ def {name}(self, {args}): - {debug}self.send_signal("{name}", {args_no_def})\n""" - } + {debug}self.send_signal("{name}", {args_no_def})\n"""} FRONTEND_TEMPLATE = "pb_frontend_template.py" FRONTEND_DEST = CORE_DEST diff --git a/libervia/backend/bridge/dbus_bridge.py b/libervia/backend/bridge/dbus_bridge.py index e3d057a0..13bb6ed4 100644 --- a/libervia/backend/bridge/dbus_bridge.py +++ b/libervia/backend/bridge/dbus_bridge.py @@ -26,7 +26,6 @@ from libervia.backend.tools import config from txdbus import client, objects, error from txdbus.interface import DBusInterface, Method, Signal - log = getLogger(__name__) # Interface prefix diff --git a/libervia/backend/core/core_types.py b/libervia/backend/core/core_types.py index 006e3c4d..2e4b5816 100644 --- a/libervia/backend/core/core_types.py +++ b/libervia/backend/core/core_types.py @@ -124,7 +124,6 @@ class SatXMPPEntity(ABC): raise exceptions.ConfigError("Plugin data already stored in {import_name!r}") self.plugin_data[import_name] = plugin_data - @property @abstractmethod def treq(self) -> "HTTPClient": diff --git a/libervia/backend/core/exceptions.py b/libervia/backend/core/exceptions.py index 274918fb..9d817182 100644 --- a/libervia/backend/core/exceptions.py +++ b/libervia/backend/core/exceptions.py @@ -107,9 +107,11 @@ class FeatureNotFound( ): # a disco feature/identity which is needed is not present pass + class FeatureBlocked(Exception): """Feature is implemented but blocked.""" + class BridgeInitError(Exception): pass diff --git a/libervia/backend/core/log.py b/libervia/backend/core/log.py index 777d770f..be08f911 100644 --- a/libervia/backend/core/log.py +++ b/libervia/backend/core/log.py @@ -18,6 +18,7 @@ # along with this program. If not, see . """High level logging functions""" + # XXX: this module use standard logging module when possible, but as SàT can work in different cases where logging is not the best choice (twisted, pyjamas, etc), it is necessary to have a dedicated module. Additional feature like environment variables and colors are also managed. # TODO: change formatting from "%s" style to "{}" when moved to Python 3 diff --git a/libervia/backend/core/log_config.py b/libervia/backend/core/log_config.py index 18a1c619..19606d89 100644 --- a/libervia/backend/core/log_config.py +++ b/libervia/backend/core/log_config.py @@ -18,6 +18,7 @@ # along with this program. If not, see . """High level logging functions""" + # XXX: this module use standard logging module when possible, but as SàT can work in different cases where logging is not the best choice (twisted, pyjamas, etc), it is necessary to have a dedicated module. Additional feature like environment variables and colors are also managed. from libervia.backend import G diff --git a/libervia/backend/core/main.py b/libervia/backend/core/main.py index c8cf7221..8c2782f6 100644 --- a/libervia/backend/core/main.py +++ b/libervia/backend/core/main.py @@ -56,7 +56,6 @@ from libervia.backend.tools.common import async_process from libervia.backend.stdui import ui_contact_list, ui_profile_manager import libervia.backend.plugins - log = getLogger(__name__) diff --git a/libervia/backend/memory/cache.py b/libervia/backend/memory/cache.py index dff56ae1..01f1b5b3 100644 --- a/libervia/backend/memory/cache.py +++ b/libervia/backend/memory/cache.py @@ -31,7 +31,6 @@ from libervia.backend.core.i18n import _ from libervia.backend.core.log import getLogger from libervia.backend.tools.common import regex - log = getLogger(__name__) CACHE_METADATA_EXT = ".cache.json" diff --git a/libervia/backend/memory/crypto.py b/libervia/backend/memory/crypto.py index a69bde68..e1e55b29 100644 --- a/libervia/backend/memory/crypto.py +++ b/libervia/backend/memory/crypto.py @@ -24,7 +24,6 @@ from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.backends import default_backend - crypto_backend = default_backend() diff --git a/libervia/backend/memory/disco.py b/libervia/backend/memory/disco.py index bbc1e5f1..8c06f9ae 100755 --- a/libervia/backend/memory/disco.py +++ b/libervia/backend/memory/disco.py @@ -37,7 +37,6 @@ from wokkel import disco from base64 import b64encode from hashlib import sha1 - log = getLogger(__name__) diff --git a/libervia/backend/memory/encryption.py b/libervia/backend/memory/encryption.py index 37bb15f4..0c7ffb3a 100644 --- a/libervia/backend/memory/encryption.py +++ b/libervia/backend/memory/encryption.py @@ -36,7 +36,6 @@ from libervia.backend.tools.common import data_format from libervia.backend.tools import utils from libervia.backend.memory import persistent - log = getLogger(__name__) diff --git a/libervia/backend/memory/memory.py b/libervia/backend/memory/memory.py index 0be71c48..d9d564ab 100644 --- a/libervia/backend/memory/memory.py +++ b/libervia/backend/memory/memory.py @@ -54,7 +54,6 @@ from libervia.backend.tools import config as tools_config from libervia.backend.tools.common import data_format from libervia.backend.tools.common import regex - log = getLogger(__name__) diff --git a/libervia/backend/memory/migration/versions/129ac51807e4_create_virtual_table_for_full_text_.py b/libervia/backend/memory/migration/versions/129ac51807e4_create_virtual_table_for_full_text_.py index d054c1fb..c566fa43 100644 --- a/libervia/backend/memory/migration/versions/129ac51807e4_create_virtual_table_for_full_text_.py +++ b/libervia/backend/memory/migration/versions/129ac51807e4_create_virtual_table_for_full_text_.py @@ -9,7 +9,6 @@ Create Date: 2021-08-13 19:13:54.112538 from alembic import op import sqlalchemy as sa - # revision identifiers, used by Alembic. revision = "129ac51807e4" down_revision = "8974efc51d22" diff --git a/libervia/backend/memory/migration/versions/29f85e56b6d4_use_json_type_in_history_and_for_.py b/libervia/backend/memory/migration/versions/29f85e56b6d4_use_json_type_in_history_and_for_.py index adcfcba1..0c5be3f4 100644 --- a/libervia/backend/memory/migration/versions/29f85e56b6d4_use_json_type_in_history_and_for_.py +++ b/libervia/backend/memory/migration/versions/29f85e56b6d4_use_json_type_in_history_and_for_.py @@ -9,7 +9,6 @@ Create Date: 2025-05-02 11:20:11.555189 from alembic import op import sqlalchemy as sa - # revision identifiers, used by Alembic. revision = "29f85e56b6d4" down_revision = "fe3a02cb4bec" diff --git a/libervia/backend/memory/migration/versions/2ab01aa1f686_create_table_for_notifications.py b/libervia/backend/memory/migration/versions/2ab01aa1f686_create_table_for_notifications.py index 01140fbe..98647820 100644 --- a/libervia/backend/memory/migration/versions/2ab01aa1f686_create_table_for_notifications.py +++ b/libervia/backend/memory/migration/versions/2ab01aa1f686_create_table_for_notifications.py @@ -9,7 +9,6 @@ Create Date: 2023-10-16 12:11:43.507295 from alembic import op import sqlalchemy as sa - # revision identifiers, used by Alembic. revision = "2ab01aa1f686" down_revision = "4b002773cf92" diff --git a/libervia/backend/memory/migration/versions/4b002773cf92_add_origin_id_column_to_history_and_.py b/libervia/backend/memory/migration/versions/4b002773cf92_add_origin_id_column_to_history_and_.py index e0cbe171..44fb383d 100644 --- a/libervia/backend/memory/migration/versions/4b002773cf92_add_origin_id_column_to_history_and_.py +++ b/libervia/backend/memory/migration/versions/4b002773cf92_add_origin_id_column_to_history_and_.py @@ -9,7 +9,6 @@ Create Date: 2022-06-13 16:10:39.711634 from alembic import op import sqlalchemy as sa - # revision identifiers, used by Alembic. revision = "4b002773cf92" down_revision = "79e5f3313fa4" diff --git a/libervia/backend/memory/migration/versions/602caf848068_drop_message_types_table_fix_nullable.py b/libervia/backend/memory/migration/versions/602caf848068_drop_message_types_table_fix_nullable.py index 5e39ff27..1f5362f7 100644 --- a/libervia/backend/memory/migration/versions/602caf848068_drop_message_types_table_fix_nullable.py +++ b/libervia/backend/memory/migration/versions/602caf848068_drop_message_types_table_fix_nullable.py @@ -23,7 +23,6 @@ from sqlalchemy import ( ) from sqlalchemy.sql import table, column - # revision identifiers, used by Alembic. revision = "602caf848068" down_revision = None diff --git a/libervia/backend/memory/migration/versions/610345f77e75_add_version_id_to_history.py b/libervia/backend/memory/migration/versions/610345f77e75_add_version_id_to_history.py index 00a2656e..ec12786a 100644 --- a/libervia/backend/memory/migration/versions/610345f77e75_add_version_id_to_history.py +++ b/libervia/backend/memory/migration/versions/610345f77e75_add_version_id_to_history.py @@ -9,7 +9,6 @@ Create Date: 2023-11-20 17:33:53.544032 from alembic import op import sqlalchemy as sa - # revision identifiers, used by Alembic. revision = "610345f77e75" down_revision = "2ab01aa1f686" diff --git a/libervia/backend/memory/migration/versions/6af2d8f6be76_add_is_retroactive_to_thread_and_fix_.py b/libervia/backend/memory/migration/versions/6af2d8f6be76_add_is_retroactive_to_thread_and_fix_.py index dc3c938f..05d30dc4 100644 --- a/libervia/backend/memory/migration/versions/6af2d8f6be76_add_is_retroactive_to_thread_and_fix_.py +++ b/libervia/backend/memory/migration/versions/6af2d8f6be76_add_is_retroactive_to_thread_and_fix_.py @@ -10,7 +10,6 @@ from alembic import op import sqlalchemy as sa from sqlalchemy.sql import false - # revision identifiers, used by Alembic. revision = "6af2d8f6be76" down_revision = "29f85e56b6d4" diff --git a/libervia/backend/memory/migration/versions/79e5f3313fa4_create_table_for_pubsub_subscriptions.py b/libervia/backend/memory/migration/versions/79e5f3313fa4_create_table_for_pubsub_subscriptions.py index 9321e6df..d4e91ca2 100644 --- a/libervia/backend/memory/migration/versions/79e5f3313fa4_create_table_for_pubsub_subscriptions.py +++ b/libervia/backend/memory/migration/versions/79e5f3313fa4_create_table_for_pubsub_subscriptions.py @@ -10,7 +10,6 @@ from alembic import op import sqlalchemy as sa from libervia.backend.memory.sqla_mapping import JID - # revision identifiers, used by Alembic. revision = "79e5f3313fa4" down_revision = "129ac51807e4" diff --git a/libervia/backend/memory/migration/versions/8974efc51d22_create_tables_for_pubsub_caching.py b/libervia/backend/memory/migration/versions/8974efc51d22_create_tables_for_pubsub_caching.py index 68863bc3..ae99d94d 100644 --- a/libervia/backend/memory/migration/versions/8974efc51d22_create_tables_for_pubsub_caching.py +++ b/libervia/backend/memory/migration/versions/8974efc51d22_create_tables_for_pubsub_caching.py @@ -10,7 +10,6 @@ from alembic import op import sqlalchemy as sa from libervia.backend.memory.sqla_mapping import JID, Xml - # revision identifiers, used by Alembic. revision = "8974efc51d22" down_revision = "602caf848068" diff --git a/libervia/backend/memory/migration/versions/8db042adb973_add_affiliations_access_model_and_.py b/libervia/backend/memory/migration/versions/8db042adb973_add_affiliations_access_model_and_.py index f2b61072..5d14017a 100644 --- a/libervia/backend/memory/migration/versions/8db042adb973_add_affiliations_access_model_and_.py +++ b/libervia/backend/memory/migration/versions/8db042adb973_add_affiliations_access_model_and_.py @@ -10,7 +10,6 @@ from alembic import op import sqlalchemy as sa from libervia.backend.memory.sqla_mapping import JID - # revision identifiers, used by Alembic. revision = "8db042adb973" down_revision = "6af2d8f6be76" diff --git a/libervia/backend/memory/migration/versions/ece2a6d7e4bb_add_parent_node_id_and_linked_mode_id_.py b/libervia/backend/memory/migration/versions/ece2a6d7e4bb_add_parent_node_id_and_linked_mode_id_.py index f6dfca64..b99f56fb 100644 --- a/libervia/backend/memory/migration/versions/ece2a6d7e4bb_add_parent_node_id_and_linked_mode_id_.py +++ b/libervia/backend/memory/migration/versions/ece2a6d7e4bb_add_parent_node_id_and_linked_mode_id_.py @@ -9,7 +9,6 @@ Create Date: 2025-08-16 16:47:48.242973 from alembic import op import sqlalchemy as sa - # revision identifiers, used by Alembic. revision = "ece2a6d7e4bb" down_revision = "8db042adb973" diff --git a/libervia/backend/memory/persistent.py b/libervia/backend/memory/persistent.py index 07d473bb..1a3fcce9 100644 --- a/libervia/backend/memory/persistent.py +++ b/libervia/backend/memory/persistent.py @@ -22,7 +22,6 @@ from twisted.python import failure from libervia.backend.core.i18n import _ from libervia.backend.core.log import getLogger - log = getLogger(__name__) diff --git a/libervia/backend/memory/sqla.py b/libervia/backend/memory/sqla.py index cb123b4b..1259a41f 100644 --- a/libervia/backend/memory/sqla.py +++ b/libervia/backend/memory/sqla.py @@ -89,7 +89,6 @@ from libervia.backend.memory.sqla_mapping import ( from libervia.backend.tools.common import uri from libervia.backend.tools.utils import aio, as_future - log = getLogger(__name__) migration_path = Path(migration.__file__).parent #: mapping of Libervia search query operators to SQLAlchemy method name diff --git a/libervia/backend/memory/sqla_mapping.py b/libervia/backend/memory/sqla_mapping.py index e8dd682f..8e9ab9ed 100644 --- a/libervia/backend/memory/sqla_mapping.py +++ b/libervia/backend/memory/sqla_mapping.py @@ -48,7 +48,6 @@ from wokkel import generic from libervia.backend.core.constants import Const as C - Base = declarative_base( metadata=MetaData( naming_convention={ diff --git a/libervia/backend/plugins/plugin_blog_import.py b/libervia/backend/plugins/plugin_blog_import.py index 69080b3f..948d73f2 100644 --- a/libervia/backend/plugins/plugin_blog_import.py +++ b/libervia/backend/plugins/plugin_blog_import.py @@ -34,7 +34,6 @@ import tempfile import urllib.parse import shortuuid - PLUGIN_INFO = { C.PI_NAME: "blog import", C.PI_IMPORT_NAME: "BLOG_IMPORT", diff --git a/libervia/backend/plugins/plugin_blog_import_dokuwiki.py b/libervia/backend/plugins/plugin_blog_import_dokuwiki.py index 3d3e99b2..cda93446 100644 --- a/libervia/backend/plugins/plugin_blog_import_dokuwiki.py +++ b/libervia/backend/plugins/plugin_blog_import_dokuwiki.py @@ -60,8 +60,7 @@ PLUGIN_INFO = { SHORT_DESC = D_("import posts from Dokuwiki blog engine") -LONG_DESC = D_( - """This importer handle Dokuwiki blog engine. +LONG_DESC = D_("""This importer handle Dokuwiki blog engine. To use it, you need an admin access to a running Dokuwiki website (local or on the Internet). The importer retrieves the data using @@ -98,8 +97,7 @@ are inside the namespace "public:2015:10" using the Dokuwiki user "souliane", and it imports them to sat profile dave's microblog node. Internal Dokuwiki media that were hosted on http://127.0.1.1 are now pointing to http://media.diekulturvermittlung.at. -""" -) +""") DEFAULT_MEDIA_REPO = "" DEFAULT_NAMESPACE = "/" DEFAULT_LIMIT = 100 # you might get a DBUS timeout (no reply) if it lasts too long diff --git a/libervia/backend/plugins/plugin_blog_import_dotclear.py b/libervia/backend/plugins/plugin_blog_import_dotclear.py index 6ae192d1..62609887 100644 --- a/libervia/backend/plugins/plugin_blog_import_dotclear.py +++ b/libervia/backend/plugins/plugin_blog_import_dotclear.py @@ -31,7 +31,6 @@ import time import html import os.path - PLUGIN_INFO = { C.PI_NAME: "Dotclear import", C.PI_IMPORT_NAME: "IMPORT_DOTCLEAR", @@ -44,8 +43,7 @@ PLUGIN_INFO = { SHORT_DESC = D_("import posts from Dotclear blog engine") -LONG_DESC = D_( - """This importer handle Dotclear blog engine. +LONG_DESC = D_("""This importer handle Dotclear blog engine. To use it, you'll need to export your blog to a flat file. You must go in your admin interface and select Plugins/Maintenance then Backup. @@ -53,8 +51,7 @@ Export only one blog if you have many, i.e. select "Download database of current Depending on your configuration, your may need to use import/Export plugin and export as a flat file. location: you must use the absolute path to your backup for the location parameter -""" -) +""") POST_ID_PREFIX = "sat_dc_" KNOWN_DATA_TYPES = ( "link", diff --git a/libervia/backend/plugins/plugin_comp_ap_gateway/ad_hoc.py b/libervia/backend/plugins/plugin_comp_ap_gateway/ad_hoc.py index a2c51f6c..50f21fa0 100644 --- a/libervia/backend/plugins/plugin_comp_ap_gateway/ad_hoc.py +++ b/libervia/backend/plugins/plugin_comp_ap_gateway/ad_hoc.py @@ -37,7 +37,6 @@ from libervia.backend.plugins.plugin_xep_0050 import ( Status, ) - log = getLogger(__name__) NS_XMPP_JID_NODE_2_AP = "https://libervia.org/ap_gateway/xmpp_jid_node_2_ap_actor" diff --git a/libervia/backend/plugins/plugin_comp_ap_gateway/events.py b/libervia/backend/plugins/plugin_comp_ap_gateway/events.py index 46ff2ecd..c429558c 100644 --- a/libervia/backend/plugins/plugin_comp_ap_gateway/events.py +++ b/libervia/backend/plugins/plugin_comp_ap_gateway/events.py @@ -32,7 +32,6 @@ from libervia.backend.tools.common import date_utils, uri from .constants import NS_AP_PUBLIC, TYPE_ACTOR, TYPE_EVENT, TYPE_ITEM - log = getLogger(__name__) # direct copy of what Mobilizon uses diff --git a/libervia/backend/plugins/plugin_comp_ap_gateway/pubsub_service.py b/libervia/backend/plugins/plugin_comp_ap_gateway/pubsub_service.py index d2357d03..d3d49490 100644 --- a/libervia/backend/plugins/plugin_comp_ap_gateway/pubsub_service.py +++ b/libervia/backend/plugins/plugin_comp_ap_gateway/pubsub_service.py @@ -39,7 +39,6 @@ from libervia.backend.memory.sqla_mapping import PubsubSub, SubscriptionState from .constants import TYPE_ACTOR, ST_AVATAR, MAX_AVATAR_SIZE - log = getLogger(__name__) # all nodes have the same config diff --git a/libervia/backend/plugins/plugin_exp_lang_detect.py b/libervia/backend/plugins/plugin_exp_lang_detect.py index 30001ae0..ec0a7c2e 100644 --- a/libervia/backend/plugins/plugin_exp_lang_detect.py +++ b/libervia/backend/plugins/plugin_exp_lang_detect.py @@ -56,9 +56,7 @@ PARAMS = """ - """.format( - category_name=CATEGORY, name=NAME, label=_(LABEL) -) + """.format(category_name=CATEGORY, name=NAME, label=_(LABEL)) class LangDetect(object): diff --git a/libervia/backend/plugins/plugin_exp_pubsub_admin.py b/libervia/backend/plugins/plugin_exp_pubsub_admin.py index 08c2e8bb..932d2701 100644 --- a/libervia/backend/plugins/plugin_exp_pubsub_admin.py +++ b/libervia/backend/plugins/plugin_exp_pubsub_admin.py @@ -37,11 +37,9 @@ PLUGIN_INFO = { C.PI_RECOMMENDATIONS: [], C.PI_MAIN: "PubsubAdmin", C.PI_HANDLER: "no", - C.PI_DESCRIPTION: _( - """\Implementation of Pubsub Administrator + C.PI_DESCRIPTION: _("""\Implementation of Pubsub Administrator This allows a pubsub administrator to overwrite completly items, including publisher. -Specially useful when importing a node.""" - ), +Specially useful when importing a node."""), } NS_PUBSUB_ADMIN = "https://salut-a-toi.org/spec/pubsub_admin:0" diff --git a/libervia/backend/plugins/plugin_misc_account.py b/libervia/backend/plugins/plugin_misc_account.py index 0504ebe9..5fddb7c1 100644 --- a/libervia/backend/plugins/plugin_misc_account.py +++ b/libervia/backend/plugins/plugin_misc_account.py @@ -33,7 +33,6 @@ from twisted.words.protocols.jabber import jid from libervia.backend.tools.common import email as sat_email from libervia.backend.tools.config import EmailSettings, PluginSettings - log = getLogger(__name__) @@ -78,8 +77,7 @@ default_conf = { RESERVED_LIST: list[str] = ["libervia"] -WELCOME_MSG = D_( - """Welcome to Libervia. +WELCOME_MSG = D_("""Welcome to Libervia. Your account on {domain} has been successfully created. This is a demonstration version to show you the current status of the project. @@ -99,8 +97,7 @@ Any feedback welcome. Thank you! The Libervia team. https://www.libervia.org -""" -) +""") class PluginsAccountSettings(PluginSettings, plugin_info=PLUGIN_INFO): diff --git a/libervia/backend/plugins/plugin_misc_android.py b/libervia/backend/plugins/plugin_misc_android.py index 3f90723f..f6c19e89 100644 --- a/libervia/backend/plugins/plugin_misc_android.py +++ b/libervia/backend/plugins/plugin_misc_android.py @@ -34,7 +34,6 @@ from libervia.backend.core.log import getLogger from libervia.backend.tools.common import async_process from libervia.backend.memory import params - log = getLogger(__name__) PLUGIN_INFO = { @@ -64,7 +63,6 @@ from android.broadcast import BroadcastReceiver from android import python_act from libervia import media - Context = autoclass("android.content.Context") ConnectivityManager = autoclass("android.net.ConnectivityManager") MediaPlayer = autoclass("android.media.MediaPlayer") diff --git a/libervia/backend/plugins/plugin_misc_app_manager/__init__.py b/libervia/backend/plugins/plugin_misc_app_manager/__init__.py index 191fd49f..e35d3081 100644 --- a/libervia/backend/plugins/plugin_misc_app_manager/__init__.py +++ b/libervia/backend/plugins/plugin_misc_app_manager/__init__.py @@ -67,13 +67,11 @@ PLUGIN_INFO = { C.PI_MODES: C.PLUG_MODE_BOTH, C.PI_MAIN: "AppManager", C.PI_HANDLER: "no", - C.PI_DESCRIPTION: _( - """Applications Manager + C.PI_DESCRIPTION: _("""Applications Manager Manage external applications using packagers, OS virtualization/containers or other software management tools. -""" - ), +"""), } APP_FILE_PREFIX = "libervia_app_" @@ -150,7 +148,7 @@ class AppManager: ) data["_instance_dir_obj"].cleanup() - def _libervia_conf_constr(self, loader, node) -> str|None: + def _libervia_conf_constr(self, loader, node) -> str | None: """Get a value from Libervia configuration A list is expected with either "name" of a config parameter, a one or more of @@ -180,14 +178,16 @@ class AppManager: try: if section.startswith("application."): - key = section[12:].strip() + key = section[12:].strip() if not key: raise ValueError("Invalid configuration section: {section!r}}") value = G.config.application.get(key, {}).get(name, default) else: value = getattr(getattr(G.config, section), name) or default except (AttributeError, KeyError): - from pudb import set_trace; set_trace() + from pudb import set_trace + + set_trace() raise ValueError( f"Invalid configuration request: {section=}, {name=}, {default=}, " f"{filter=}" diff --git a/libervia/backend/plugins/plugin_misc_attach.py b/libervia/backend/plugins/plugin_misc_attach.py index e3cb9e24..32f869dc 100644 --- a/libervia/backend/plugins/plugin_misc_attach.py +++ b/libervia/backend/plugins/plugin_misc_attach.py @@ -33,7 +33,6 @@ from libervia.backend.core.log import getLogger from libervia.backend.tools import utils from libervia.backend.tools import image - log = getLogger(__name__) diff --git a/libervia/backend/plugins/plugin_misc_debug.py b/libervia/backend/plugins/plugin_misc_debug.py index d5c83b35..bc9dd154 100644 --- a/libervia/backend/plugins/plugin_misc_debug.py +++ b/libervia/backend/plugins/plugin_misc_debug.py @@ -21,7 +21,6 @@ from libervia.backend.core.i18n import _ from libervia.backend.core.log import getLogger from libervia.backend.core.constants import Const as C - log = getLogger(__name__) PLUGIN_INFO = { diff --git a/libervia/backend/plugins/plugin_misc_email_invitation.py b/libervia/backend/plugins/plugin_misc_email_invitation.py index e6fd49db..96563e3c 100644 --- a/libervia/backend/plugins/plugin_misc_email_invitation.py +++ b/libervia/backend/plugins/plugin_misc_email_invitation.py @@ -68,8 +68,7 @@ EXTRA_RESERVED = { KEY_EMAILS_EXTRA, } DEFAULT_SUBJECT = D_("You have been invited by {host_name} to {app_name}") -DEFAULT_BODY = D_( - """Hello {name}! +DEFAULT_BODY = D_("""Hello {name}! You have received an invitation from {host_name} to participate to "{app_name}". To join, you just have to click on the following URL: @@ -79,8 +78,7 @@ Please note that this URL should not be shared with anybody! If you want more details on {app_name}, you can check {app_url}. Welcome! -""" -) +""") class InvitationsPlugin(object): diff --git a/libervia/backend/plugins/plugin_misc_extra_pep.py b/libervia/backend/plugins/plugin_misc_extra_pep.py index 65505a51..8196a1a9 100644 --- a/libervia/backend/plugins/plugin_misc_extra_pep.py +++ b/libervia/backend/plugins/plugin_misc_extra_pep.py @@ -25,7 +25,6 @@ log = getLogger(__name__) from libervia.backend.memory import params from twisted.words.protocols.jabber import jid - PLUGIN_INFO = { C.PI_NAME: "Extra PEP", C.PI_IMPORT_NAME: "EXTRA-PEP", diff --git a/libervia/backend/plugins/plugin_misc_file.py b/libervia/backend/plugins/plugin_misc_file.py index bca05ca5..7d7c0a74 100644 --- a/libervia/backend/plugins/plugin_misc_file.py +++ b/libervia/backend/plugins/plugin_misc_file.py @@ -35,7 +35,6 @@ from libervia.backend.tools import stream from libervia.backend.tools import utils from libervia.backend.tools.common import data_format, utils as common_utils - log = getLogger(__name__) @@ -46,10 +45,8 @@ PLUGIN_INFO = { C.PI_MODES: C.PLUG_MODE_BOTH, C.PI_MAIN: "FilePlugin", C.PI_HANDLER: "no", - C.PI_DESCRIPTION: _( - """File Tansfer Management: -This plugin manage the various ways of sending a file, and choose the best one.""" - ), + C.PI_DESCRIPTION: _("""File Tansfer Management: +This plugin manage the various ways of sending a file, and choose the best one."""), } diff --git a/libervia/backend/plugins/plugin_misc_ip.py b/libervia/backend/plugins/plugin_misc_ip.py index c1d51c6b..c835cc31 100644 --- a/libervia/backend/plugins/plugin_misc_ip.py +++ b/libervia/backend/plugins/plugin_misc_ip.py @@ -63,16 +63,14 @@ GET_IP_LABEL = D_("Allow external get IP") GET_IP_CATEGORY = "General" GET_IP_NAME = "allow_get_ip" GET_IP_CONFIRM_TITLE = D_("Confirm external site request") -GET_IP_CONFIRM = D_( - """To facilitate data transfer, we need to contact a website. +GET_IP_CONFIRM = D_("""To facilitate data transfer, we need to contact a website. A request will be done on {page} That means that administrators of {domain} can know that you use "{app_name}" and your IP Address. IP address is an identifier to locate you on Internet (similar to a phone number). Do you agree to do this request ? -""" -).format( +""").format( page=GET_IP_PAGE, domain=urllib.parse.urlparse(GET_IP_PAGE).netloc, app_name=C.APP_NAME, @@ -87,9 +85,7 @@ PARAMS = """ - """.format( - category=GET_IP_CATEGORY, name=GET_IP_NAME, label=GET_IP_LABEL -) + """.format(category=GET_IP_CATEGORY, name=GET_IP_NAME, label=GET_IP_LABEL) class IPPlugin(object): diff --git a/libervia/backend/plugins/plugin_misc_merge_requests.py b/libervia/backend/plugins/plugin_misc_merge_requests.py index 0712bb67..ff36295b 100644 --- a/libervia/backend/plugins/plugin_misc_merge_requests.py +++ b/libervia/backend/plugins/plugin_misc_merge_requests.py @@ -26,7 +26,6 @@ from libervia.backend.core import exceptions from libervia.backend.tools.common import data_format from libervia.backend.core.log import getLogger - log = getLogger(__name__) APP_NS_MERGE_REQUESTS = "org.salut-a-toi.merge_requests:0" diff --git a/libervia/backend/plugins/plugin_misc_nat_port.py b/libervia/backend/plugins/plugin_misc_nat_port.py index e3a5f79a..b7665e66 100644 --- a/libervia/backend/plugins/plugin_misc_nat_port.py +++ b/libervia/backend/plugins/plugin_misc_nat_port.py @@ -29,7 +29,6 @@ from twisted.internet import defer from twisted.python import failure import threading - if "pytest" in sys.modules: # We skip this module during tests to avoid waiting for UPnP-IGD. raise exceptions.CancelError("This module is not run during tests.") diff --git a/libervia/backend/plugins/plugin_misc_quiz.py b/libervia/backend/plugins/plugin_misc_quiz.py index 841833fa..ed418f74 100644 --- a/libervia/backend/plugins/plugin_misc_quiz.py +++ b/libervia/backend/plugins/plugin_misc_quiz.py @@ -27,7 +27,6 @@ from twisted.internet import reactor from twisted.words.protocols.jabber import client as jabber_client, jid from time import time - NS_QG = "http://www.goffi.org/protocol/quiz" QG_TAG = "quiz" diff --git a/libervia/backend/plugins/plugin_misc_register_account.py b/libervia/backend/plugins/plugin_misc_register_account.py index 00731cc3..29d5210e 100644 --- a/libervia/backend/plugins/plugin_misc_register_account.py +++ b/libervia/backend/plugins/plugin_misc_register_account.py @@ -28,7 +28,6 @@ from libervia.backend.memory.memory import Sessions from libervia.backend.tools import xml_tools from libervia.backend.tools.xml_tools import SAT_FORM_PREFIX, SAT_PARAM_SEPARATOR - PLUGIN_INFO = { C.PI_NAME: "Register Account Plugin", C.PI_IMPORT_NAME: "REGISTER-ACCOUNT", diff --git a/libervia/backend/plugins/plugin_misc_room_game.py b/libervia/backend/plugins/plugin_misc_room_game.py index f3da30bd..de3a5b2b 100644 --- a/libervia/backend/plugins/plugin_misc_room_game.py +++ b/libervia/backend/plugins/plugin_misc_room_game.py @@ -153,7 +153,7 @@ class RoomGame(object): self._update_players(room_jid, nicks, True, profile) else: self._init_game(room_jid, nick) - (auth, waiting, missing) = self._check_wait_auth(room_jid, other_players) + auth, waiting, missing = self._check_wait_auth(room_jid, other_players) nicks.extend(waiting) nicks.extend(self._invite_players(room_jid, missing, nick, profile)) if auth: @@ -426,7 +426,7 @@ class RoomGame(object): result = (False, [], other_players) else: # TODO: find a way to make it secure - (nicks, missing) = self.host.plugins["XEP-0045"].getRoomNicksOfUsers( + nicks, missing = self.host.plugins["XEP-0045"].getRoomNicksOfUsers( room, other_players, secure=False ) result = (len(nicks) == len(other_players), nicks, missing) @@ -524,7 +524,7 @@ class RoomGame(object): ) return True other_players = self.invitations[room_jid][batch][1] - (auth, nicks, __) = self._check_wait_auth(room, other_players) + auth, nicks, __ = self._check_wait_auth(room, other_players) if auth: del self.invitations[room_jid][batch] nicks.insert(0, profile_nick) # add the referee @@ -618,7 +618,7 @@ class RoomGame(object): if not profile: log.error(_("profile %s is unknown") % profile_key) return - (create, sync) = self._check_create_game_and_init(room_jid, profile) + create, sync = self._check_create_game_and_init(room_jid, profile) if nicks is None: nicks = [] if not create: diff --git a/libervia/backend/plugins/plugin_misc_tarot.py b/libervia/backend/plugins/plugin_misc_tarot.py index e38349f2..c28444c7 100644 --- a/libervia/backend/plugins/plugin_misc_tarot.py +++ b/libervia/backend/plugins/plugin_misc_tarot.py @@ -32,7 +32,6 @@ from libervia.backend.tools import xml_tools from libervia.frontends.tools.games import TarotCard import random - NS_CG = "http://www.goffi.org/protocol/card_game" CG_TAG = "card_game" diff --git a/libervia/backend/plugins/plugin_misc_text_commands.py b/libervia/backend/plugins/plugin_misc_text_commands.py index 09829092..c419cadf 100644 --- a/libervia/backend/plugins/plugin_misc_text_commands.py +++ b/libervia/backend/plugins/plugin_misc_text_commands.py @@ -26,7 +26,6 @@ from libervia.backend.core import exceptions from libervia.backend.core.log import getLogger from libervia.backend.tools import utils - log = getLogger(__name__) PLUGIN_INFO = { diff --git a/libervia/backend/plugins/plugin_misc_uri_finder.py b/libervia/backend/plugins/plugin_misc_uri_finder.py index d42cf0a1..01ddf1d4 100644 --- a/libervia/backend/plugins/plugin_misc_uri_finder.py +++ b/libervia/backend/plugins/plugin_misc_uri_finder.py @@ -37,14 +37,10 @@ PLUGIN_INFO = { C.PI_DEPENDENCIES: [], C.PI_MAIN: "URIFinder", C.PI_HANDLER: "no", - C.PI_DESCRIPTION: textwrap.dedent( - _( - """\ + C.PI_DESCRIPTION: textwrap.dedent(_("""\ Plugin to find URIs in well know location. This allows to retrieve settings to work with a project (e.g. pubsub node used for merge-requests). - """ - ) - ), + """)), } diff --git a/libervia/backend/plugins/plugin_misc_url_preview.py b/libervia/backend/plugins/plugin_misc_url_preview.py index 5dbc23dd..fadc7444 100644 --- a/libervia/backend/plugins/plugin_misc_url_preview.py +++ b/libervia/backend/plugins/plugin_misc_url_preview.py @@ -46,15 +46,11 @@ PLUGIN_INFO = { C.PI_DEPENDENCIES: ["TEXT_SYNTAXES"], C.PI_MAIN: "Preview", C.PI_HANDLER: "no", - C.PI_DESCRIPTION: dedent( - _( - """\ + C.PI_DESCRIPTION: dedent(_("""\ Retrieves and provides a preview of URLs using various protocols. Initially, it uses the Open Graph protocol for most web pages. Specialized handlers are implemented for YouTube using the oEmbed protocol. - """ - ) - ), + """)), } OG_TAGS = [ diff --git a/libervia/backend/plugins/plugin_misc_watched.py b/libervia/backend/plugins/plugin_misc_watched.py index 996dd901..86507de3 100644 --- a/libervia/backend/plugins/plugin_misc_watched.py +++ b/libervia/backend/plugins/plugin_misc_watched.py @@ -25,7 +25,6 @@ log = getLogger(__name__) from libervia.backend.core import exceptions from libervia.backend.tools import xml_tools - PLUGIN_INFO = { C.PI_NAME: "Watched", C.PI_IMPORT_NAME: "WATCHED", diff --git a/libervia/backend/plugins/plugin_misc_welcome.py b/libervia/backend/plugins/plugin_misc_welcome.py index 1ea37d54..0fb24d8d 100644 --- a/libervia/backend/plugins/plugin_misc_welcome.py +++ b/libervia/backend/plugins/plugin_misc_welcome.py @@ -24,7 +24,6 @@ from libervia.backend.core.log import getLogger log = getLogger(__name__) from libervia.backend.tools import xml_tools - PLUGIN_INFO = { C.PI_NAME: "Welcome", C.PI_IMPORT_NAME: "WELCOME", @@ -43,8 +42,7 @@ WELCOME_PARAM_LABEL = D_("Display welcome message") WELCOME_MSG_TITLE = D_("Welcome to Libervia/Salut à Toi") # XXX: this message is mainly targetting libervia new users for now # (i.e.: it may look weird on other frontends) -WELCOME_MSG = D_( - """Welcome to a free (as in freedom) network! +WELCOME_MSG = D_("""Welcome to a free (as in freedom) network! If you have any trouble, or you want to help us for the bug hunting, you can contact us in real time chat by using the “Help / Official chat room” menu. @@ -53,8 +51,7 @@ To use Libervia, you'll need to add contacts, either people you know, or people We hope that you'll enjoy using this project. The Libervia/Salut à Toi Team -""" -) +""") PARAMS = """ diff --git a/libervia/backend/plugins/plugin_misc_xmllog.py b/libervia/backend/plugins/plugin_misc_xmllog.py index ffbd6d42..4c1cf07d 100644 --- a/libervia/backend/plugins/plugin_misc_xmllog.py +++ b/libervia/backend/plugins/plugin_misc_xmllog.py @@ -47,9 +47,7 @@ class XmlLog(object): - """ % { - "label_xmllog": _("Activate XML log") - } + """ % {"label_xmllog": _("Activate XML log")} def __init__(self, host): log.info(_("Plugin XML Log initialization")) diff --git a/libervia/backend/plugins/plugin_pubsub_cache.py b/libervia/backend/plugins/plugin_pubsub_cache.py index c765158b..71483069 100644 --- a/libervia/backend/plugins/plugin_pubsub_cache.py +++ b/libervia/backend/plugins/plugin_pubsub_cache.py @@ -34,7 +34,6 @@ from libervia.backend.tools import xml_tools, utils from libervia.backend.tools.common import data_format from libervia.backend.memory.sqla import PubsubNode, PubsubItem, SyncState, IntegrityError - log = getLogger(__name__) PLUGIN_INFO = { diff --git a/libervia/backend/plugins/plugin_sec_aesgcm.py b/libervia/backend/plugins/plugin_sec_aesgcm.py index 85ddee7b..c7e04724 100644 --- a/libervia/backend/plugins/plugin_sec_aesgcm.py +++ b/libervia/backend/plugins/plugin_sec_aesgcm.py @@ -44,14 +44,10 @@ PLUGIN_INFO = { C.PI_DEPENDENCIES: ["XEP-0363", "XEP-0384", "DOWNLOAD", "ATTACH"], C.PI_MAIN: "AESGCM", C.PI_HANDLER: "no", - C.PI_DESCRIPTION: dedent( - _( - """\ + C.PI_DESCRIPTION: dedent(_("""\ Implementation of AES-GCM scheme, a way to encrypt files (not official XMPP standard). See https://xmpp.org/extensions/inbox/omemo-media-sharing.html for details - """ - ) - ), + """)), } AESGCM_RE = re.compile( diff --git a/libervia/backend/plugins/plugin_tickets_import.py b/libervia/backend/plugins/plugin_tickets_import.py index 45d7826f..c41b8af3 100644 --- a/libervia/backend/plugins/plugin_tickets_import.py +++ b/libervia/backend/plugins/plugin_tickets_import.py @@ -27,7 +27,6 @@ from twisted.internet import defer from libervia.backend.tools.common import uri from libervia.backend.tools import utils - PLUGIN_INFO = { C.PI_NAME: "tickets import", C.PI_IMPORT_NAME: "TICKETS_IMPORT", diff --git a/libervia/backend/plugins/plugin_tickets_import_bugzilla.py b/libervia/backend/plugins/plugin_tickets_import_bugzilla.py index 6a695414..aafc1f35 100644 --- a/libervia/backend/plugins/plugin_tickets_import_bugzilla.py +++ b/libervia/backend/plugins/plugin_tickets_import_bugzilla.py @@ -30,7 +30,6 @@ import os.path from lxml import etree from libervia.backend.tools.common import date_utils - PLUGIN_INFO = { C.PI_NAME: "Bugzilla import", C.PI_IMPORT_NAME: "IMPORT_BUGZILLA", @@ -43,15 +42,13 @@ PLUGIN_INFO = { SHORT_DESC = D_("import tickets from Bugzilla xml export file") -LONG_DESC = D_( - """This importer handle Bugzilla xml export file. +LONG_DESC = D_("""This importer handle Bugzilla xml export file. To use it, you'll need to export tickets using XML. Tickets will be uploaded with the same ID as for Bugzilla, any existing ticket with this ID will be replaced. location: you must use the absolute path to your .xml file -""" -) +""") STATUS_MAP = { "NEW": "queued", diff --git a/libervia/backend/plugins/plugin_xep_0045.py b/libervia/backend/plugins/plugin_xep_0045.py index 416a9fa4..9d9e7721 100644 --- a/libervia/backend/plugins/plugin_xep_0045.py +++ b/libervia/backend/plugins/plugin_xep_0045.py @@ -44,7 +44,6 @@ from libervia.backend.plugins import plugin_misc_jid_search from libervia.backend.tools import xml_tools, utils from libervia.backend.tools.config import PluginSettings - log = getLogger(__name__) diff --git a/libervia/backend/plugins/plugin_xep_0049.py b/libervia/backend/plugins/plugin_xep_0049.py index c1f62512..ee9f3588 100644 --- a/libervia/backend/plugins/plugin_xep_0049.py +++ b/libervia/backend/plugins/plugin_xep_0049.py @@ -25,7 +25,6 @@ log = getLogger(__name__) from wokkel import compat from twisted.words.xish import domish - PLUGIN_INFO = { C.PI_NAME: "XEP-0049 Plugin", C.PI_IMPORT_NAME: "XEP-0049", diff --git a/libervia/backend/plugins/plugin_xep_0055.py b/libervia/backend/plugins/plugin_xep_0055.py index d1f83ce8..dc7fa808 100644 --- a/libervia/backend/plugins/plugin_xep_0055.py +++ b/libervia/backend/plugins/plugin_xep_0055.py @@ -38,7 +38,6 @@ from wokkel import disco, iwokkel from zope.interface import implementer - NS_SEARCH = "jabber:iq:search" PLUGIN_INFO = { diff --git a/libervia/backend/plugins/plugin_xep_0059.py b/libervia/backend/plugins/plugin_xep_0059.py index 1afcf40d..cf6c0a3d 100644 --- a/libervia/backend/plugins/plugin_xep_0059.py +++ b/libervia/backend/plugins/plugin_xep_0059.py @@ -27,7 +27,6 @@ from libervia.backend.core.i18n import _ from libervia.backend.core.constants import Const as C from libervia.backend.core.log import getLogger - log = getLogger(__name__) diff --git a/libervia/backend/plugins/plugin_xep_0065.py b/libervia/backend/plugins/plugin_xep_0065.py index cf385a21..8567a42c 100644 --- a/libervia/backend/plugins/plugin_xep_0065.py +++ b/libervia/backend/plugins/plugin_xep_0065.py @@ -73,7 +73,6 @@ from libervia.backend.core.constants import Const as C from libervia.backend.core import exceptions from libervia.backend.tools import sat_defer - log = getLogger(__name__) diff --git a/libervia/backend/plugins/plugin_xep_0082.py b/libervia/backend/plugins/plugin_xep_0082.py index 1b52514a..20316324 100644 --- a/libervia/backend/plugins/plugin_xep_0082.py +++ b/libervia/backend/plugins/plugin_xep_0082.py @@ -22,7 +22,6 @@ from libervia.backend.core.i18n import D_ from libervia.backend.core.main import LiberviaBackend from libervia.backend.tools import xmpp_datetime - __all__ = ["PLUGIN_INFO", "XEP_0082"] # pylint: disable=unused-variable diff --git a/libervia/backend/plugins/plugin_xep_0084.py b/libervia/backend/plugins/plugin_xep_0084.py index 1d83a81b..29fb2d65 100644 --- a/libervia/backend/plugins/plugin_xep_0084.py +++ b/libervia/backend/plugins/plugin_xep_0084.py @@ -33,7 +33,6 @@ from libervia.backend.core.log import getLogger from libervia.backend.core.core_types import SatXMPPEntity from libervia.backend.core import exceptions - log = getLogger(__name__) IMPORT_NAME = "XEP-0084" diff --git a/libervia/backend/plugins/plugin_xep_0095.py b/libervia/backend/plugins/plugin_xep_0095.py index 4ac227b1..f4a31140 100644 --- a/libervia/backend/plugins/plugin_xep_0095.py +++ b/libervia/backend/plugins/plugin_xep_0095.py @@ -30,7 +30,6 @@ from wokkel import disco from wokkel import iwokkel import uuid - PLUGIN_INFO = { C.PI_NAME: "XEP 0095 Plugin", C.PI_IMPORT_NAME: "XEP-0095", diff --git a/libervia/backend/plugins/plugin_xep_0163.py b/libervia/backend/plugins/plugin_xep_0163.py index 56d5c46c..9d866fdd 100644 --- a/libervia/backend/plugins/plugin_xep_0163.py +++ b/libervia/backend/plugins/plugin_xep_0163.py @@ -33,7 +33,6 @@ from wokkel.formats import Mood from libervia.backend.tools.common import data_format from libervia.backend.tools import utils - log = getLogger(__name__) NS_USER_MOOD = "http://jabber.org/protocol/mood" diff --git a/libervia/backend/plugins/plugin_xep_0166/__init__.py b/libervia/backend/plugins/plugin_xep_0166/__init__.py index 1dff2e0f..412f6914 100644 --- a/libervia/backend/plugins/plugin_xep_0166/__init__.py +++ b/libervia/backend/plugins/plugin_xep_0166/__init__.py @@ -47,7 +47,6 @@ from .models import ( TransportData, ) - log = getLogger(__name__) diff --git a/libervia/backend/plugins/plugin_xep_0167/__init__.py b/libervia/backend/plugins/plugin_xep_0167/__init__.py index 3fc9260f..cd3fe844 100644 --- a/libervia/backend/plugins/plugin_xep_0167/__init__.py +++ b/libervia/backend/plugins/plugin_xep_0167/__init__.py @@ -45,7 +45,6 @@ from .constants import ( NS_JINGLE_RTP_VIDEO, ) - log = getLogger(__name__) diff --git a/libervia/backend/plugins/plugin_xep_0167/constants.py b/libervia/backend/plugins/plugin_xep_0167/constants.py index 753b4a61..d3fad8ef 100644 --- a/libervia/backend/plugins/plugin_xep_0167/constants.py +++ b/libervia/backend/plugins/plugin_xep_0167/constants.py @@ -18,7 +18,6 @@ from typing import Final - NS_JINGLE_RTP_BASE: Final = "urn:xmpp:jingle:apps:rtp" NS_JINGLE_RTP: Final = f"{NS_JINGLE_RTP_BASE}:1" NS_JINGLE_RTP_AUDIO: Final = f"{NS_JINGLE_RTP_BASE}:audio" diff --git a/libervia/backend/plugins/plugin_xep_0199.py b/libervia/backend/plugins/plugin_xep_0199.py index 1444775b..8c3a4e3f 100644 --- a/libervia/backend/plugins/plugin_xep_0199.py +++ b/libervia/backend/plugins/plugin_xep_0199.py @@ -28,7 +28,6 @@ from twisted.words.protocols.jabber import xmlstream, jid from zope.interface import implementer import time - PLUGIN_INFO = { C.PI_NAME: "XMPP PING", C.PI_IMPORT_NAME: "XEP-0199", diff --git a/libervia/backend/plugins/plugin_xep_0203.py b/libervia/backend/plugins/plugin_xep_0203.py index 7902e77b..dc14036e 100644 --- a/libervia/backend/plugins/plugin_xep_0203.py +++ b/libervia/backend/plugins/plugin_xep_0203.py @@ -32,7 +32,6 @@ except ImportError: from wokkel.subprotocols import XMPPHandler from zope.interface import implementer - NS_DD = "urn:xmpp:delay" PLUGIN_INFO = { diff --git a/libervia/backend/plugins/plugin_xep_0234.py b/libervia/backend/plugins/plugin_xep_0234.py index 95835321..a9087ffe 100644 --- a/libervia/backend/plugins/plugin_xep_0234.py +++ b/libervia/backend/plugins/plugin_xep_0234.py @@ -45,7 +45,6 @@ from libervia.backend.tools.common.utils import get_human_size from .plugin_xep_0166 import BaseApplicationHandler - log = getLogger(__name__) NS_JINGLE_FT = "urn:xmpp:jingle:apps:file-transfer:5" diff --git a/libervia/backend/plugins/plugin_xep_0292.py b/libervia/backend/plugins/plugin_xep_0292.py index a5dc006e..9aaa8c28 100644 --- a/libervia/backend/plugins/plugin_xep_0292.py +++ b/libervia/backend/plugins/plugin_xep_0292.py @@ -32,7 +32,6 @@ from libervia.backend.core.core_types import SatXMPPEntity from libervia.backend.core import exceptions from libervia.backend.tools.common.async_utils import async_lru - log = getLogger(__name__) IMPORT_NAME = "XEP-0292" diff --git a/libervia/backend/plugins/plugin_xep_0297.py b/libervia/backend/plugins/plugin_xep_0297.py index 93b8a839..678307e7 100644 --- a/libervia/backend/plugins/plugin_xep_0297.py +++ b/libervia/backend/plugins/plugin_xep_0297.py @@ -40,7 +40,6 @@ from libervia.backend.memory.sqla_mapping import History from libervia.backend.plugins.plugin_xep_0428 import XEP_0428 from libervia.backend.tools.common.date_utils import date_fmt - log = getLogger(__name__) diff --git a/libervia/backend/plugins/plugin_xep_0313.py b/libervia/backend/plugins/plugin_xep_0313.py index 2281abb6..ab5d02f1 100644 --- a/libervia/backend/plugins/plugin_xep_0313.py +++ b/libervia/backend/plugins/plugin_xep_0313.py @@ -38,7 +38,6 @@ from libervia.backend.core.log import getLogger from libervia.backend.tools import xml_tools from libervia.backend.tools.common import data_format - log = getLogger(__name__) PLUGIN_INFO = { diff --git a/libervia/backend/plugins/plugin_xep_0320.py b/libervia/backend/plugins/plugin_xep_0320.py index a663a5da..3dd55d24 100644 --- a/libervia/backend/plugins/plugin_xep_0320.py +++ b/libervia/backend/plugins/plugin_xep_0320.py @@ -25,7 +25,6 @@ from libervia.backend.core.constants import Const as C from libervia.backend.core.i18n import _ from libervia.backend.core.log import getLogger - log = getLogger(__name__) NS_JINGLE_DTLS = "urn:xmpp:jingle:apps:dtls:0" diff --git a/libervia/backend/plugins/plugin_xep_0329.py b/libervia/backend/plugins/plugin_xep_0329.py index e7d5364e..dab04fab 100644 --- a/libervia/backend/plugins/plugin_xep_0329.py +++ b/libervia/backend/plugins/plugin_xep_0329.py @@ -39,7 +39,6 @@ from libervia.backend.tools import stream from libervia.backend.tools import utils from libervia.backend.tools.common import regex - log = getLogger(__name__) PLUGIN_INFO = { @@ -841,7 +840,7 @@ class XEP_0329(object): async def on_component_affiliations_get(self, client, iq_elt): try: - (from_jid, affiliations_elt, path, namespace, file_data) = ( + from_jid, affiliations_elt, path, namespace, file_data = ( await self._parse_element( client, iq_elt, "affiliations", NS_FIS_AFFILIATION ) @@ -880,7 +879,7 @@ class XEP_0329(object): async def on_component_affiliations_set(self, client, iq_elt): try: - (from_jid, affiliations_elt, path, namespace, file_data) = ( + from_jid, affiliations_elt, path, namespace, file_data = ( await self._parse_element( client, iq_elt, "affiliations", NS_FIS_AFFILIATION ) @@ -998,7 +997,7 @@ class XEP_0329(object): async def on_component_configuration_get(self, client, iq_elt): try: - (from_jid, configuration_elt, path, namespace, file_data) = ( + from_jid, configuration_elt, path, namespace, file_data = ( await self._parse_element( client, iq_elt, "configuration", NS_FIS_CONFIGURATION ) @@ -1041,7 +1040,7 @@ class XEP_0329(object): async def on_component_configuration_set(self, client, iq_elt): try: - (from_jid, configuration_elt, path, namespace, file_data) = ( + from_jid, configuration_elt, path, namespace, file_data = ( await self._parse_element( client, iq_elt, "configuration", NS_FIS_CONFIGURATION ) diff --git a/libervia/backend/plugins/plugin_xep_0334.py b/libervia/backend/plugins/plugin_xep_0334.py index f826164d..9b565b0d 100644 --- a/libervia/backend/plugins/plugin_xep_0334.py +++ b/libervia/backend/plugins/plugin_xep_0334.py @@ -34,7 +34,6 @@ from twisted.words.xish import domish from zope.interface import implementer from textwrap import dedent - PLUGIN_INFO = { C.PI_NAME: "Message Processing Hints", C.PI_IMPORT_NAME: "XEP-0334", diff --git a/libervia/backend/plugins/plugin_xep_0363.py b/libervia/backend/plugins/plugin_xep_0363.py index 0db89dce..7ac0c5e3 100644 --- a/libervia/backend/plugins/plugin_xep_0363.py +++ b/libervia/backend/plugins/plugin_xep_0363.py @@ -40,7 +40,6 @@ from libervia.backend.core.log import getLogger from libervia.backend.core.xmpp import SatXMPPComponent from libervia.backend.tools import utils, web as sat_web - log = getLogger(__name__) PLUGIN_INFO = { diff --git a/libervia/backend/plugins/plugin_xep_0372.py b/libervia/backend/plugins/plugin_xep_0372.py index 5dbd491d..35d25a0d 100644 --- a/libervia/backend/plugins/plugin_xep_0372.py +++ b/libervia/backend/plugins/plugin_xep_0372.py @@ -34,7 +34,6 @@ from libervia.backend.core.log import getLogger from libervia.backend.core.core_types import SatXMPPEntity from libervia.backend.tools.common import data_format - log = getLogger(__name__) PLUGIN_INFO = { @@ -46,15 +45,11 @@ PLUGIN_INFO = { C.PI_DEPENDENCIES: ["XEP-0334"], C.PI_MAIN: "XEP_0372", C.PI_HANDLER: "yes", - C.PI_DESCRIPTION: _( - dedent( - """\ + C.PI_DESCRIPTION: _(dedent("""\ XEP-0372 (References) implementation This plugin implement generic references and mentions. - """ - ) - ), + """)), } NS_REFS = "urn:xmpp:reference:0" diff --git a/libervia/backend/plugins/plugin_xep_0374.py b/libervia/backend/plugins/plugin_xep_0374.py index 01eb676d..9d576192 100644 --- a/libervia/backend/plugins/plugin_xep_0374.py +++ b/libervia/backend/plugins/plugin_xep_0374.py @@ -36,7 +36,6 @@ from twisted.internet import defer from twisted.words.protocols.jabber import jid from twisted.words.xish import domish - __all__ = ["PLUGIN_INFO", "XEP_0374", "NS_OXIM"] # pylint: disable=unused-variable diff --git a/libervia/backend/plugins/plugin_xep_0384.py b/libervia/backend/plugins/plugin_xep_0384.py index 795f3e29..6fa73910 100644 --- a/libervia/backend/plugins/plugin_xep_0384.py +++ b/libervia/backend/plugins/plugin_xep_0384.py @@ -383,8 +383,7 @@ NS_TM: Final = "urn:xmpp:tm:1" NS_ATM: Final = "urn:xmpp:atm:1" -TRUST_MESSAGE_SCHEMA = xmlschema.XMLSchema( - """ +TRUST_MESSAGE_SCHEMA = xmlschema.XMLSchema(""" -""" -) +""") # This is compatible with omemo:2's SCE profile diff --git a/libervia/backend/plugins/plugin_xep_0420.py b/libervia/backend/plugins/plugin_xep_0420.py index e340e69a..70cb26e0 100644 --- a/libervia/backend/plugins/plugin_xep_0420.py +++ b/libervia/backend/plugins/plugin_xep_0420.py @@ -40,7 +40,6 @@ from libervia.backend.plugins.plugin_xep_0380 import NS_EME from twisted.words.protocols.jabber import jid from twisted.words.xish import domish - __all__ = [ # pylint: disable=unused-variable "PLUGIN_INFO", "NS_SCE", diff --git a/libervia/backend/plugins/plugin_xep_0424.py b/libervia/backend/plugins/plugin_xep_0424.py index 6d362fb0..7ef9ca96 100644 --- a/libervia/backend/plugins/plugin_xep_0424.py +++ b/libervia/backend/plugins/plugin_xep_0424.py @@ -63,9 +63,7 @@ PARAMS = """ - """.format( - category_name=CATEGORY, name=NAME, label=_(LABEL) -) + """.format(category_name=CATEGORY, name=NAME, label=_(LABEL)) class XEP_0424: diff --git a/libervia/backend/plugins/plugin_xep_0448.py b/libervia/backend/plugins/plugin_xep_0448.py index 7ddaf300..0aa29ba4 100644 --- a/libervia/backend/plugins/plugin_xep_0448.py +++ b/libervia/backend/plugins/plugin_xep_0448.py @@ -67,13 +67,9 @@ PLUGIN_INFO = { ], C.PI_MAIN: "XEP_0448", C.PI_HANDLER: "yes", - C.PI_DESCRIPTION: dedent( - _( - """\ + C.PI_DESCRIPTION: dedent(_("""\ Implementation of e2e encryption for media sharing - """ - ) - ), + """)), } NS_ESFS = "urn:xmpp:esfs:0" diff --git a/libervia/backend/plugins/plugin_xep_0470.py b/libervia/backend/plugins/plugin_xep_0470.py index 3dd135e5..096db1ae 100644 --- a/libervia/backend/plugins/plugin_xep_0470.py +++ b/libervia/backend/plugins/plugin_xep_0470.py @@ -33,7 +33,6 @@ from libervia.backend.plugins.plugin_xep_0277 import MbData from libervia.backend.tools.common import uri, data_format, date_utils from libervia.backend.tools.utils import as_deferred, xmpp_date - log = getLogger(__name__) IMPORT_NAME = "XEP-0470" diff --git a/libervia/backend/plugins/plugin_xep_0475.py b/libervia/backend/plugins/plugin_xep_0475.py index c50d2bb8..6a79927d 100644 --- a/libervia/backend/plugins/plugin_xep_0475.py +++ b/libervia/backend/plugins/plugin_xep_0475.py @@ -39,7 +39,6 @@ from libervia.backend.tools.common import data_format from .plugin_xep_0373.exceptions import VerificationFailed - log = getLogger(__name__) IMPORT_NAME = "XEP-0475" diff --git a/libervia/backend/plugins/plugin_xep_0477.py b/libervia/backend/plugins/plugin_xep_0477.py index 2ba774c0..fb092e47 100644 --- a/libervia/backend/plugins/plugin_xep_0477.py +++ b/libervia/backend/plugins/plugin_xep_0477.py @@ -31,7 +31,6 @@ from libervia.backend.core.core_types import SatXMPPEntity from libervia.backend.core.i18n import _ from libervia.backend.core.log import getLogger - log = getLogger(__name__) IMPORT_NAME = "XEP-0477" diff --git a/libervia/backend/stdui/ui_profile_manager.py b/libervia/backend/stdui/ui_profile_manager.py index 91e0551b..3edbaa77 100644 --- a/libervia/backend/stdui/ui_profile_manager.py +++ b/libervia/backend/stdui/ui_profile_manager.py @@ -27,7 +27,6 @@ from libervia.backend.memory.memory import ProfileSessions from twisted.internet import defer from twisted.words.protocols.jabber import jid - log = getLogger(__name__) diff --git a/libervia/backend/test/test_plugin_misc_groupblog.py b/libervia/backend/test/test_plugin_misc_groupblog.py index 89d73fcc..7fa90227 100644 --- a/libervia/backend/test/test_plugin_misc_groupblog.py +++ b/libervia/backend/test/test_plugin_misc_groupblog.py @@ -31,7 +31,6 @@ from twisted.internet import defer from twisted.words.protocols.jabber import jid import importlib - NS_PUBSUB = "http://jabber.org/protocol/pubsub" DO_NOT_COUNT_COMMENTS = -1 @@ -95,9 +94,7 @@ def COMMENT(id_=COMMENT_ID_1): - """.format( - ns=NS_PUBSUB, id=id_, publisher=PUBLISHER - ) + """.format(ns=NS_PUBSUB, id=id_, publisher=PUBLISHER) def ITEM_DATA(id_=ITEM_ID_1, count=0): diff --git a/libervia/backend/test/test_plugin_misc_radiocol.py b/libervia/backend/test/test_plugin_misc_radiocol.py index 12c79b13..f24a7f97 100644 --- a/libervia/backend/test/test_plugin_misc_radiocol.py +++ b/libervia/backend/test/test_plugin_misc_radiocol.py @@ -49,7 +49,6 @@ import os import copy import shutil - ROOM_JID = JID(Const.MUC_STR[0]) PROFILE = Const.PROFILE[0] REFEREE_FULL = JID(ROOM_JID.userhost() + "/" + Const.JID[0].user) diff --git a/libervia/backend/test/test_plugin_xep_0203.py b/libervia/backend/test/test_plugin_xep_0203.py index 6b5cd3bb..343430a3 100644 --- a/libervia/backend/test/test_plugin_xep_0203.py +++ b/libervia/backend/test/test_plugin_xep_0203.py @@ -43,8 +43,7 @@ class XEP_0203Test(helpers.SatTestCase): Offline Storage """ - message_xml = ( - """ + message_xml = """ text %s - """ - % delay_xml - ) + """ % delay_xml parent = domish.Element((None, "message")) parent["from"] = "romeo@montague.net/orchard" diff --git a/libervia/backend/test/test_plugin_xep_0277.py b/libervia/backend/test/test_plugin_xep_0277.py index 730dcc4b..2f2abb9c 100644 --- a/libervia/backend/test/test_plugin_xep_0277.py +++ b/libervia/backend/test/test_plugin_xep_0277.py @@ -30,8 +30,7 @@ import importlib class XEP_0277Test(helpers.SatTestCase): - PUBSUB_ENTRY_1 = ( - """ + PUBSUB_ENTRY_1 = """ <span>titre</span> @@ -45,12 +44,9 @@ class XEP_0277Test(helpers.SatTestCase): - """ - % plugin_xep_0277.NS_ATOM - ) + """ % plugin_xep_0277.NS_ATOM - PUBSUB_ENTRY_2 = ( - """ + PUBSUB_ENTRY_2 = """ <div>titre</div> @@ -66,9 +62,7 @@ class XEP_0277Test(helpers.SatTestCase): - """ - % plugin_xep_0277.NS_ATOM - ) + """ % plugin_xep_0277.NS_ATOM def setUp(self): self.host = helpers.FakeSAT() diff --git a/libervia/backend/test/test_plugin_xep_0297.py b/libervia/backend/test/test_plugin_xep_0297.py index c54cd8bb..53d3d974 100644 --- a/libervia/backend/test/test_plugin_xep_0297.py +++ b/libervia/backend/test/test_plugin_xep_0297.py @@ -29,7 +29,6 @@ from dateutil.tz import tzutc import datetime from wokkel.generic import parseXml - NS_PUBSUB = "http://jabber.org/protocol/pubsub" @@ -40,8 +39,7 @@ class XEP_0297Test(helpers.SatTestCase): self.host.plugins["XEP-0203"] = XEP_0203(self.host) def test_delay(self): - stanza = parseXml( - """ + stanza = parseXml(""" - """.encode( - "utf-8" - ) - ) + """.encode("utf-8")) output = """ A most courteous exposition! diff --git a/libervia/backend/tools/common/async_process.py b/libervia/backend/tools/common/async_process.py index 80e0ae31..f68d1a22 100644 --- a/libervia/backend/tools/common/async_process.py +++ b/libervia/backend/tools/common/async_process.py @@ -35,9 +35,9 @@ class CommandProtocol(protocol.ProcessProtocol): """handle an external command""" # name of the command - name: str|None = None + name: str | None = None # full path to the command - command: bytes|None = None + command: bytes | None = None # True to activate logging of command outputs log: bool = False diff --git a/libervia/backend/tools/common/async_utils.py b/libervia/backend/tools/common/async_utils.py index 8fd4d4f0..baea948f 100644 --- a/libervia/backend/tools/common/async_utils.py +++ b/libervia/backend/tools/common/async_utils.py @@ -23,7 +23,6 @@ from collections import OrderedDict from typing import Optional, Callable, Awaitable from libervia.backend.core.log import getLogger - log = getLogger(__name__) diff --git a/libervia/backend/tools/common/data_format.py b/libervia/backend/tools/common/data_format.py index 19b16a01..71be84f6 100644 --- a/libervia/backend/tools/common/data_format.py +++ b/libervia/backend/tools/common/data_format.py @@ -18,6 +18,7 @@ # along with this program. If not, see . """tools common to backend and frontends""" + #  FIXME: json may be more appropriate than manual serialising like done here from typing import Any diff --git a/libervia/backend/tools/common/data_objects.py b/libervia/backend/tools/common/data_objects.py index dfea1ca8..06bb06bb 100644 --- a/libervia/backend/tools/common/data_objects.py +++ b/libervia/backend/tools/common/data_objects.py @@ -31,7 +31,6 @@ except ImportError: from libervia.backend.tools.common import uri as xmpp_uri import urllib.request, urllib.parse, urllib.error - log = getLogger(__name__) diff --git a/libervia/backend/tools/common/dynamic_import.py b/libervia/backend/tools/common/dynamic_import.py index 45a85b59..13687efe 100644 --- a/libervia/backend/tools/common/dynamic_import.py +++ b/libervia/backend/tools/common/dynamic_import.py @@ -21,7 +21,6 @@ from importlib import import_module from libervia.backend.core.log import getLogger - log = getLogger(__name__) diff --git a/libervia/backend/tools/common/email.py b/libervia/backend/tools/common/email.py index bd71cf94..733ebfa4 100644 --- a/libervia/backend/tools/common/email.py +++ b/libervia/backend/tools/common/email.py @@ -19,7 +19,6 @@ """email sending facilities""" - from email.mime.text import MIMEText from twisted.internet import defer from twisted.mail import smtp diff --git a/libervia/backend/tools/common/files_utils.py b/libervia/backend/tools/common/files_utils.py index e683abac..f58dc1ac 100644 --- a/libervia/backend/tools/common/files_utils.py +++ b/libervia/backend/tools/common/files_utils.py @@ -17,13 +17,13 @@ # along with this program. If not, see . """tools to help manipulating files""" + import os.path from pathlib import Path from libervia.backend.core.constants import xdg_config_home from libervia.backend.core.log import getLogger - log = getLogger(__name__) diff --git a/libervia/backend/tools/common/template.py b/libervia/backend/tools/common/template.py index 0b724a4f..8a7c3ee9 100644 --- a/libervia/backend/tools/common/template.py +++ b/libervia/backend/tools/common/template.py @@ -558,7 +558,9 @@ class Renderer: try: translations = self.translations[locale] except KeyError: - self.translations[locale] = support.Translations(f, "libervia") + self.translations[locale] = support.Translations( + f, "libervia" + ) else: translations.merge(support.Translations(f, "libervia")) except EnvironmentError: diff --git a/libervia/backend/tools/common/tls.py b/libervia/backend/tools/common/tls.py index cf39f1d6..fbb1c470 100644 --- a/libervia/backend/tools/common/tls.py +++ b/libervia/backend/tools/common/tls.py @@ -22,7 +22,6 @@ from libervia.backend.core.log import getLogger from libervia.backend.core import exceptions from libervia.backend.tools import config as tools_config - try: import OpenSSL from twisted.internet import ssl diff --git a/libervia/backend/tools/config.py b/libervia/backend/tools/config.py index 24d5a739..3677b9f6 100644 --- a/libervia/backend/tools/config.py +++ b/libervia/backend/tools/config.py @@ -386,7 +386,7 @@ class Settings(BaseSettings): tor: TorSettings = Field(default_factory=TorSettings) application: dict[str, dict[str, str]] = Field( default_factory=dict, - description="Application specific settings, used by app manager." + description="Application specific settings, used by app manager.", ) plugin: dict = Field(default_factory=dict, description="Plugin specific settings.") component: dict = Field( diff --git a/libervia/backend/tools/utils.py b/libervia/backend/tools/utils.py index 761d5294..71b14e59 100644 --- a/libervia/backend/tools/utils.py +++ b/libervia/backend/tools/utils.py @@ -79,12 +79,10 @@ def partial(func, *fixed_args, **fixed_kwargs): ori_args.remove(kw) exec( - textwrap.dedent( - """\ + textwrap.dedent("""\ def method({args}): return func({kw_args}) - """ - ).format( + """).format( args=", ".join(ori_args), kw_args=", ".join([a + "=" + a for a in ori_args]) ), locals(), diff --git a/libervia/backend/tools/video.py b/libervia/backend/tools/video.py index f2c75dde..7766f7fa 100644 --- a/libervia/backend/tools/video.py +++ b/libervia/backend/tools/video.py @@ -17,6 +17,7 @@ # along with this program. If not, see . """Methods to manipulate videos""" + from typing import Union from pathlib import Path from twisted.python.procutils import which @@ -25,7 +26,6 @@ from libervia.backend.core import exceptions from libervia.backend.core.log import getLogger from .common import async_process - log = getLogger(__name__) diff --git a/libervia/backend/tools/web.py b/libervia/backend/tools/web.py index a2468baa..77fe3df5 100644 --- a/libervia/backend/tools/web.py +++ b/libervia/backend/tools/web.py @@ -32,7 +32,6 @@ from zope.interface import implementer from libervia.backend.core import exceptions from libervia.backend.core.log import getLogger - log = getLogger(__name__) diff --git a/libervia/backend/tools/xml_tools.py b/libervia/backend/tools/xml_tools.py index 43343055..1377b304 100644 --- a/libervia/backend/tools/xml_tools.py +++ b/libervia/backend/tools/xml_tools.py @@ -35,7 +35,6 @@ from libervia.backend.core.constants import Const as C from libervia.backend.core.i18n import _ from libervia.backend.core.log import getLogger - log = getLogger(__name__) """This library help manage XML used in SàT (parameters, registration, etc)""" diff --git a/libervia/backend/tools/xmpp_datetime.py b/libervia/backend/tools/xmpp_datetime.py index 0e35c18c..455b3dab 100644 --- a/libervia/backend/tools/xmpp_datetime.py +++ b/libervia/backend/tools/xmpp_datetime.py @@ -22,7 +22,6 @@ from typing import Optional, Tuple from libervia.backend.core import exceptions - __all__ = [ # pylint: disable=unused-variable "format_date", "parse_date", diff --git a/libervia/cli/base.py b/libervia/cli/base.py index f42f4063..92dcb4c7 100644 --- a/libervia/cli/base.py +++ b/libervia/cli/base.py @@ -92,11 +92,8 @@ except ImportError: progressbar = None # consts -DESCRIPTION = ( - """This software is a command line tool for XMPP. -Get the latest version at """ - + C.APP_URL -) +DESCRIPTION = """This software is a command line tool for XMPP. +Get the latest version at """ + C.APP_URL COPYLEFT = """Copyright (C) 2009-2024 Jérôme Poisson, Adrien Cossa This program comes with ABSOLUTELY NO WARRANTY; diff --git a/libervia/cli/call_gui.py b/libervia/cli/call_gui.py index 49c4ff54..abd7506c 100644 --- a/libervia/cli/call_gui.py +++ b/libervia/cli/call_gui.py @@ -56,7 +56,6 @@ from libervia.frontends.tools import aio, display_servers, webrtc gi.require_versions({"Gst": "1.0", "GstWebRTC": "1.0"}) from gi.repository import Gst - ICON_SIZE = QSize(45, 45) BUTTON_SIZE = QSize(50, 50) running = False diff --git a/libervia/cli/call_simple.py b/libervia/cli/call_simple.py index 4d43eaa0..a5ba4680 100644 --- a/libervia/cli/call_simple.py +++ b/libervia/cli/call_simple.py @@ -32,7 +32,6 @@ from rich.text import Text from libervia.frontends.tools import aio from libervia.frontends.tools.webrtc import CallData, WebRTCCall - aio.install_glib_asyncio_iteration() diff --git a/libervia/cli/call_tui.py b/libervia/cli/call_tui.py index a8866c9c..bf495782 100644 --- a/libervia/cli/call_tui.py +++ b/libervia/cli/call_tui.py @@ -36,7 +36,6 @@ gi.require_versions({"Gst": "1.0", "GstWebRTC": "1.0"}) from gi.repository import Gst - aio.install_glib_asyncio_iteration() diff --git a/libervia/cli/cmd_account.py b/libervia/cli/cmd_account.py index bcf406bb..54ca3a9e 100644 --- a/libervia/cli/cmd_account.py +++ b/libervia/cli/cmd_account.py @@ -26,7 +26,6 @@ from libervia.backend.core.i18n import _ from libervia.cli import base from libervia.frontends.tools import jid - log = getLogger(__name__) __commands__ = ["Account"] diff --git a/libervia/cli/cmd_avatar.py b/libervia/cli/cmd_avatar.py index 08f18793..7cb652ec 100644 --- a/libervia/cli/cmd_avatar.py +++ b/libervia/cli/cmd_avatar.py @@ -27,7 +27,6 @@ from libervia.cli.constants import Const as C from libervia.backend.tools import config from libervia.backend.tools.common import data_format - __commands__ = ["Avatar"] DISPLAY_CMD = ["xdg-open", "xv", "display", "gwenview", "showtell"] diff --git a/libervia/cli/cmd_contacts.py b/libervia/cli/cmd_contacts.py index 8decfbd6..e0e5d795 100644 --- a/libervia/cli/cmd_contacts.py +++ b/libervia/cli/cmd_contacts.py @@ -68,7 +68,7 @@ class Get(base.CommandBase): Text(group.name or "", style="bold"), Text(group.id or "", style="italic"), group.description, - "🔒" if group.encrypted else "" + "🔒" if group.encrypted else "", ) if idx: self.console.print() @@ -77,7 +77,6 @@ class Get(base.CommandBase): self.console.print(table) - async def start(self): try: contacts_s = await self.host.bridge.ps_contacts_get( diff --git a/libervia/cli/cmd_message.py b/libervia/cli/cmd_message.py index 57637b24..0ddbfc33 100644 --- a/libervia/cli/cmd_message.py +++ b/libervia/cli/cmd_message.py @@ -30,7 +30,6 @@ from libervia.cli import base from libervia.cli.constants import Const as C from libervia.frontends.tools import jid - __commands__ = ["Message"] RECIPIENTS_ARGS = ["to", "cc", "bcc"] diff --git a/libervia/cli/cmd_shell.py b/libervia/cli/cmd_shell.py index d8837eb9..a842112c 100644 --- a/libervia/cli/cmd_shell.py +++ b/libervia/cli/cmd_shell.py @@ -30,15 +30,13 @@ from libervia.cli import arg_tools from libervia.backend.tools.common.ansi import ANSI as A __commands__ = ["Shell"] -INTRO = _( - """Welcome to {app_name} shell, the Salut à Toi shell ! +INTRO = _("""Welcome to {app_name} shell, the Salut à Toi shell ! This enrironment helps you using several {app_name} commands with similar parameters. To quit, just enter "quit" or press C-d. Enter "help" or "?" to know what to do -""" -).format(app_name=C.APP_NAME) +""").format(app_name=C.APP_NAME) class Shell(base.CommandBase, cmd.Cmd): diff --git a/libervia/cli/output_std.py b/libervia/cli/output_std.py index a663f7bf..9c812964 100644 --- a/libervia/cli/output_std.py +++ b/libervia/cli/output_std.py @@ -18,7 +18,6 @@ # along with this program. If not, see . """Standard outputs""" - from libervia.cli.constants import Const as C from libervia.frontends.tools import jid from libervia.backend.tools.common.ansi import ANSI as A @@ -79,7 +78,7 @@ class Simple(object): def messages(self, data): # TODO: handle lang, and non chat message (normal, headline) for mess_data in data: - (uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra) = ( + uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra = ( mess_data ) time_str = date_utils.date_fmt( @@ -143,9 +142,13 @@ class Json: def dump(self, data): if isinstance(data, str): - self.host.console.print_json(json=data, indent=None, highlight=False, default=str) + self.host.console.print_json( + json=data, indent=None, highlight=False, default=str + ) else: - self.host.console.print_json(data=data, indent=None, highlight=False, default=str) + self.host.console.print_json( + data=data, indent=None, highlight=False, default=str + ) def dump_pretty(self, data): if isinstance(data, str): diff --git a/libervia/cli/output_template.py b/libervia/cli/output_template.py index 0acbbebc..4548dfed 100644 --- a/libervia/cli/output_template.py +++ b/libervia/cli/output_template.py @@ -18,7 +18,6 @@ # along with this program. If not, see . """Standard outputs""" - from libervia.cli.constants import Const as C from libervia.backend.core.i18n import _ from libervia.backend.core import log diff --git a/libervia/cli/output_xml.py b/libervia/cli/output_xml.py index 42d53350..a4a5e4ec 100644 --- a/libervia/cli/output_xml.py +++ b/libervia/cli/output_xml.py @@ -17,7 +17,6 @@ # along with this program. If not, see . """Standard outputs""" - from libervia.cli.constants import Const as C from libervia.backend.core.i18n import _ from lxml import etree diff --git a/libervia/cli/output_xmlui.py b/libervia/cli/output_xmlui.py index 06eb5780..b40e13df 100644 --- a/libervia/cli/output_xmlui.py +++ b/libervia/cli/output_xmlui.py @@ -18,7 +18,6 @@ # along with this program. If not, see . """Standard outputs""" - from libervia.cli.constants import Const as C from libervia.cli import xmlui_manager from libervia.backend.core.log import getLogger diff --git a/libervia/frontends/bridge/dbus_bridge.py b/libervia/frontends/bridge/dbus_bridge.py index 00f83729..d7ce6f39 100644 --- a/libervia/frontends/bridge/dbus_bridge.py +++ b/libervia/frontends/bridge/dbus_bridge.py @@ -26,7 +26,6 @@ from libervia.backend.core.exceptions import BridgeExceptionNoService, BridgeIni from dbus.mainloop.glib import DBusGMainLoop from .bridge_frontend import BridgeException - DBusGMainLoop(set_as_default=True) log = getLogger(__name__) diff --git a/libervia/frontends/quick_frontend/quick_app.py b/libervia/frontends/quick_frontend/quick_app.py index 52c237c6..4dc813ba 100644 --- a/libervia/frontends/quick_frontend/quick_app.py +++ b/libervia/frontends/quick_frontend/quick_app.py @@ -33,7 +33,6 @@ from libervia.frontends.quick_frontend import quick_contact_list from libervia.frontends.quick_frontend.constants import Const as C from libervia.frontends.tools import jid - log = getLogger(__name__) diff --git a/libervia/frontends/quick_frontend/quick_chat.py b/libervia/frontends/quick_frontend/quick_chat.py index cffa3e84..556540be 100644 --- a/libervia/frontends/quick_frontend/quick_chat.py +++ b/libervia/frontends/quick_frontend/quick_chat.py @@ -26,7 +26,6 @@ from collections import OrderedDict from libervia.frontends.tools import jid import time - log = getLogger(__name__) diff --git a/libervia/frontends/quick_frontend/quick_menus.py b/libervia/frontends/quick_frontend/quick_menus.py index 27bb4c8b..7ccdda63 100644 --- a/libervia/frontends/quick_frontend/quick_menus.py +++ b/libervia/frontends/quick_frontend/quick_menus.py @@ -33,7 +33,6 @@ log = getLogger(__name__) from libervia.frontends.quick_frontend.constants import Const as C from collections import OrderedDict - ## items ## diff --git a/libervia/frontends/quick_frontend/quick_utils.py b/libervia/frontends/quick_frontend/quick_utils.py index cdce5dcf..aadde6dd 100644 --- a/libervia/frontends/quick_frontend/quick_utils.py +++ b/libervia/frontends/quick_frontend/quick_utils.py @@ -37,18 +37,16 @@ def get_new_path(path): def check_options(): """Check command line options""" - usage = _( - """ + usage = _(""" %prog [options] %prog --help for options list - """ - ) + """) parser = OptionParser(usage=usage) # TODO: use argparse parser.add_option("-p", "--profile", help=_("Select the profile to use")) - (options, args) = parser.parse_args() + options, args = parser.parse_args() if options.profile: options.profile = options.profile return options diff --git a/libervia/frontends/quick_frontend/quick_widgets.py b/libervia/frontends/quick_frontend/quick_widgets.py index 6677ba4a..3e0c6e5e 100644 --- a/libervia/frontends/quick_frontend/quick_widgets.py +++ b/libervia/frontends/quick_frontend/quick_widgets.py @@ -23,7 +23,6 @@ log = getLogger(__name__) from libervia.backend.core import exceptions from libervia.frontends.quick_frontend.constants import Const as C - classes_map = {} diff --git a/libervia/frontends/tools/host_listener.py b/libervia/frontends/tools/host_listener.py index 8ec9051c..decdc073 100644 --- a/libervia/frontends/tools/host_listener.py +++ b/libervia/frontends/tools/host_listener.py @@ -19,7 +19,6 @@ """This module is only used launch callbacks when host is ready, used for early initialisation stuffs""" - listeners = [] diff --git a/libervia/frontends/tools/portal_desktop.py b/libervia/frontends/tools/portal_desktop.py index c31e5470..a81218c7 100644 --- a/libervia/frontends/tools/portal_desktop.py +++ b/libervia/frontends/tools/portal_desktop.py @@ -25,7 +25,6 @@ from random import randint import dbus from dbus.mainloop.glib import DBusGMainLoop - log = logging.getLogger(__name__) diff --git a/libervia/frontends/tools/webrtc.py b/libervia/frontends/tools/webrtc.py index 9aac9710..9e227415 100644 --- a/libervia/frontends/tools/webrtc.py +++ b/libervia/frontends/tools/webrtc.py @@ -693,14 +693,12 @@ class WebRTC: video_source_elt or isinstance(self.sources_data, SourcesStdin) ): # Local video feedback. - gst_pipe_elements.append( - f""" + gst_pipe_elements.append(f""" t. ! queue max-size-buffers=3 leaky=downstream ! videoconvert ! {local_video_sink_elt} - """ - ) + """) if audio_source_elt or isinstance(self.sources_data, SourcesStdin): # Audio with a valve for muting. diff --git a/libervia/frontends/tools/webrtc_file.py b/libervia/frontends/tools/webrtc_file.py index e64c6410..25bd14db 100644 --- a/libervia/frontends/tools/webrtc_file.py +++ b/libervia/frontends/tools/webrtc_file.py @@ -35,7 +35,6 @@ from libervia.backend.tools.common import data_format, utils from libervia.frontends.tools import aio, jid, webrtc from libervia.frontends.tools.webrtc_models import CallData - log = logging.getLogger(__name__) WEBRTC_CHUNK_SIZE = 64 * 1024 diff --git a/libervia/frontends/tools/xmlui.py b/libervia/frontends/tools/xmlui.py index a1423a0b..68328294 100644 --- a/libervia/frontends/tools/xmlui.py +++ b/libervia/frontends/tools/xmlui.py @@ -24,7 +24,6 @@ log = getLogger(__name__) from libervia.frontends.quick_frontend.constants import Const as C from libervia.backend.core import exceptions - _class_map = {} CLASS_PANEL = "panel" CLASS_DIALOG = "dialog" diff --git a/libervia/tui/chat.py b/libervia/tui/chat.py index a75c6e8f..e7ec7d2f 100644 --- a/libervia/tui/chat.py +++ b/libervia/tui/chat.py @@ -33,7 +33,6 @@ from libervia.tui.keys import action_key_map as a_key from libervia.tui.widget import LiberviaTUIWidget from libervia.tui.contact_list import ContactList - log = logging.getLogger(__name__) diff --git a/libervia/tui/keys.py b/libervia/tui/keys.py index 8af42c9e..ac94ad38 100644 --- a/libervia/tui/keys.py +++ b/libervia/tui/keys.py @@ -21,7 +21,6 @@ from urwid_satext.keys import action_key_map - action_key_map.update( { # Edit bar diff --git a/libervia/tui/xmlui.py b/libervia/tui/xmlui.py index db720448..6eebe89b 100644 --- a/libervia/tui/xmlui.py +++ b/libervia/tui/xmlui.py @@ -315,7 +315,7 @@ class LiberviaTUIVerticalContainer(xmlui.VerticalContainer, urwid.ListBox): def render(self, size, focus=False): if size != self._last_size: - (maxcol, maxrow) = size + maxcol, maxrow = size if self.body: widget = self.body[0] if isinstance(widget, urwid.BoxAdapter): diff --git a/tests/e2e/libervia-cli/conftest.py b/tests/e2e/libervia-cli/conftest.py index e4f9b360..6b3e9215 100644 --- a/tests/e2e/libervia-cli/conftest.py +++ b/tests/e2e/libervia-cli/conftest.py @@ -80,8 +80,7 @@ class Editor: self.editor_path = self.tmp_dir_path / "editor.py" self.ori_content_path = self.tmp_dir_path / "original_content" self.new_content_path = self.tmp_dir_path / "new_content" - self.base_script = dedent( - f"""\ + self.base_script = dedent(f"""\ #!{sys.executable} import sys @@ -100,8 +99,7 @@ class Editor: with open("{self.new_content_path}", "w") as f: f.write(new_content) - """ - ) + """) self._env = os.environ.copy() self._env["EDITOR"] = str(self.editor_path) diff --git a/tests/e2e/libervia-cli/test_libervia-cli.py b/tests/e2e/libervia-cli/test_libervia-cli.py index 6144729a..a5498ac9 100644 --- a/tests/e2e/libervia-cli/test_libervia-cli.py +++ b/tests/e2e/libervia-cli/test_libervia-cli.py @@ -30,7 +30,6 @@ from libervia.backend.plugins.plugin_sec_pte import NS_PTE from libervia.backend.plugins.plugin_xep_0277 import NS_ATOM from libervia.backend.tools.common import uri - if os.getenv("LIBERVIA_TEST_ENV_E2E") is None: pytest.skip( "skipping end-to-end tests, we are not in a test environment", diff --git a/tests/e2e/libervia-web/conftest.py b/tests/e2e/libervia-web/conftest.py index 2f88ba27..5025acc6 100644 --- a/tests/e2e/libervia-web/conftest.py +++ b/tests/e2e/libervia-web/conftest.py @@ -25,7 +25,6 @@ from datetime import datetime from pathlib import Path import helium - WEB_HOST = "web" WEB_PORT_HTTPS = 8443 BASE_URL = f"https://{WEB_HOST}:{WEB_PORT_HTTPS}" diff --git a/tests/e2e/libervia-web/test_libervia-web.py b/tests/e2e/libervia-web/test_libervia-web.py index 71c2e1ab..9de8f18b 100644 --- a/tests/e2e/libervia-web/test_libervia-web.py +++ b/tests/e2e/libervia-web/test_libervia-web.py @@ -40,7 +40,6 @@ from helium import ( ) from selenium.webdriver.common.by import By - if os.getenv("LIBERVIA_TEST_ENV_E2E_WEB") is None: pytest.skip( "skipping end-to-end tests, we are not in a test environment for Libervia", diff --git a/tests/e2e/run_e2e.py b/tests/e2e/run_e2e.py index 6c17a093..963becec 100755 --- a/tests/e2e/run_e2e.py +++ b/tests/e2e/run_e2e.py @@ -44,8 +44,7 @@ OPT_KEEP_BROWSER = "--keep-browser" OPT_VISUAL = "--visual" OPT_DEV_MODE = "--dev-mode" -dev_mode_inst = dedent( - """\ +dev_mode_inst = dedent("""\ Here is a short script to start working with a logged account: from helium import * @@ -54,8 +53,7 @@ dev_mode_inst = dedent( write("account1", "login") write("test", "password") click("log in") - """ -) + """) report_buffer = io.StringIO() live_out_buf = [] live_err_buf = [] @@ -186,8 +184,7 @@ def use_e2e_env(): with tempfile.TemporaryDirectory(prefix="libervia_test_e2e_") as temp_dir: override_path = Path(temp_dir) / "test_override.yml" override = yaml.load( - dedent( - f"""\ + dedent(f"""\ version: "3.6" services: backend: @@ -210,8 +207,7 @@ def use_e2e_env(): source: {libervia_templates_source} target: {libervia_templates_target} read_only: true - """ - ), + """), Loader=Loader, ) diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index b2081127..f70ba16e 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -1,4 +1,3 @@ from pytest_twisted import init_asyncio_reactor - init_asyncio_reactor() diff --git a/tests/unit/frontends/test_webrtc.py b/tests/unit/frontends/test_webrtc.py index c147bd36..5109858b 100644 --- a/tests/unit/frontends/test_webrtc.py +++ b/tests/unit/frontends/test_webrtc.py @@ -28,12 +28,12 @@ from pytest_twisted import ensureDeferred as ed from libervia.backend.core import exceptions from libervia.backend.tools.common import data_format + try: from libervia.frontends.tools import webrtc as webrtc_mod except exceptions.MissingModule as e: pytest.skip( - "Can't import webrtc due to missing modules: {e}", - allow_module_level=True + "Can't import webrtc due to missing modules: {e}", allow_module_level=True ) diff --git a/tests/unit/test_ap-gateway.py b/tests/unit/test_ap-gateway.py index 54d65190..a0135391 100644 --- a/tests/unit/test_ap-gateway.py +++ b/tests/unit/test_ap-gateway.py @@ -49,7 +49,6 @@ from libervia.backend.tools import xml_tools from libervia.backend.tools.common import uri as xmpp_uri from libervia.backend.tools.utils import xmpp_date - TEST_BASE_URL = "https://example.org" TEST_USER = "test_user" TEST_AP_ACCOUNT = f"{TEST_USER}@example.org" @@ -1360,8 +1359,7 @@ class TestActivityPubGateway: node=ap_gateway._m.namespace, item=ap_item["id"], ) - item_elt = xml_tools.parse( - f""" + item_elt = xml_tools.parse(f""" test message 1 @@ -1380,8 +1378,7 @@ class TestActivityPubGateway: - """ - ) + """) item_elt.uri = pubsub.NS_PUBSUB_EVENT with patch.object(ap_gateway, "ap_post") as ap_post: @@ -1473,15 +1470,13 @@ class TestActivityPubGateway: attachment_node = ap_gateway._pa.get_attachment_node_name( recipient_jid, ap_gateway._m.namespace, ap_item["id"] ) - item_elt = xml_tools.parse( - f""" + item_elt = xml_tools.parse(f""" - """ - ) + """) item_elt.uri = pubsub.NS_PUBSUB_EVENT items_event = pubsub.ItemsEvent( TEST_JID, recipient_jid, attachment_node, [item_elt], {} @@ -1565,8 +1560,7 @@ class TestActivityPubGateway: recipient_jid, ap_gateway._m.namespace, ap_item["id"] ) reactions = ["🦁", "🥜", "🎻"] - item_elt = xml_tools.parse( - f""" + item_elt = xml_tools.parse(f""" @@ -1576,8 +1570,7 @@ class TestActivityPubGateway: - """ - ) + """) item_elt.uri = pubsub.NS_PUBSUB_EVENT items_event = pubsub.ItemsEvent( TEST_JID, recipient_jid, attachment_node, [item_elt], {} diff --git a/tests/unit/test_plugin_misc_pubsub_contacts.py b/tests/unit/test_plugin_misc_pubsub_contacts.py index 3d378f3d..95f5d5c8 100644 --- a/tests/unit/test_plugin_misc_pubsub_contacts.py +++ b/tests/unit/test_plugin_misc_pubsub_contacts.py @@ -255,6 +255,7 @@ class TestContact: "name" ), "name attribute should not be present in group with id_only" + class TestContacts: """Tests for Contacts root model.""" diff --git a/tests/unit/test_plugin_xep_0082.py b/tests/unit/test_plugin_xep_0082.py index 628e609d..1959c0cd 100644 --- a/tests/unit/test_plugin_xep_0082.py +++ b/tests/unit/test_plugin_xep_0082.py @@ -23,7 +23,6 @@ from libervia.backend.core import exceptions from libervia.backend.plugins.plugin_xep_0082 import XEP_0082 - __all__ = [ # pylint: disable=unused-variable "test_date_formatting", "test_date_parsing", diff --git a/tests/unit/test_plugin_xep_0167.py b/tests/unit/test_plugin_xep_0167.py index 3960123b..98832df6 100644 --- a/tests/unit/test_plugin_xep_0167.py +++ b/tests/unit/test_plugin_xep_0167.py @@ -247,8 +247,7 @@ class TestXEP0167Mapping: def test_parse_description(self): """Parsing to a dict is successful""" - description_element = xml_tools.parse( - """ + description_element = xml_tools.parse(""" @@ -259,8 +258,7 @@ class TestXEP0167Mapping: - """ - ) + """) parsed_data = mapping.parse_description(description_element) @@ -296,16 +294,14 @@ class TestXEP0167: mock_call_info = MagicMock() host.bridge.call_info = mock_call_info - jingle_elt = xml_tools.parse( - """ + jingle_elt = xml_tools.parse(""" - """ - ) + """) xep_0167.jingle_session_info(client, "mute", session, "content_name", jingle_elt) @@ -323,16 +319,14 @@ class TestXEP0167: mock_call_info = MagicMock() host.bridge.call_info = mock_call_info - jingle_elt = xml_tools.parse( - """ + jingle_elt = xml_tools.parse(""" - """ - ) + """) xep_0167.jingle_session_info( client, "invalid", session, "content_name", jingle_elt @@ -345,8 +339,7 @@ class TestXEP0167: session_id = "123" extra = {"name": "test"} - iq_elt = xml_tools.parse( - """ + iq_elt = xml_tools.parse(""" - """ - ) + """) jingle_elt = iq_elt.firstChildElement() mock_send = MagicMock() iq_elt.send = mock_send diff --git a/tests/unit/test_plugin_xep_0176.py b/tests/unit/test_plugin_xep_0176.py index 80ba0a63..f1e970b0 100644 --- a/tests/unit/test_plugin_xep_0176.py +++ b/tests/unit/test_plugin_xep_0176.py @@ -144,8 +144,7 @@ class TestXEP0176: """Transport element is correctly parsed into ICE data""" xep_0176 = XEP_0176(host) - transport_elt = xml_tools.parse( - """ + transport_elt = xml_tools.parse(""" @@ -172,8 +171,7 @@ class TestXEP0176: rel-addr="10.0.0.1" rel-port="9012" /> - """ - ) + """) ice_data = xep_0176.parse_transport(transport_elt) diff --git a/tests/unit/test_plugin_xep_0215.py b/tests/unit/test_plugin_xep_0215.py index 5b9ff1b9..7a8e603b 100644 --- a/tests/unit/test_plugin_xep_0215.py +++ b/tests/unit/test_plugin_xep_0215.py @@ -31,8 +31,7 @@ class TestXEP0215: host.memory.disco.has_feature = AsyncMock() host.memory.disco.has_feature.return_value = True - services_elt = xml_tools.parse( - """ + services_elt = xml_tools.parse(""" @@ -53,8 +52,7 @@ class TestXEP0215: " - """ - ) + """) services = xep_0215.parse_services(services_elt) @@ -109,8 +107,7 @@ class TestXEP0215: client.IQ.return_value = iq_result - iq_result_elt = xml_tools.parse( - """ + iq_result_elt = xml_tools.parse(""" @@ -118,8 +115,7 @@ class TestXEP0215: restricted="true" /> - """ - ) + """) iq_result.send.return_value = defer.succeed(iq_result_elt) services = await xep_0215.get_external_services(client) @@ -149,16 +145,14 @@ class TestXEP0215: client.IQ.return_value = iq_result - iq_result_elt = xml_tools.parse( - """ + iq_result_elt = xml_tools.parse(""" - """ - ) + """) iq_result.send.return_value = defer.succeed(iq_result_elt) credentials = await xep_0215.request_credentials(client, "test.example", "stun") @@ -194,8 +188,7 @@ class TestXEP0215: ], } - iq_elt = xml_tools.parse( - """ + iq_elt = xml_tools.parse(""" @@ -204,8 +197,7 @@ class TestXEP0215: - """ - ) + """) xep_0215.on_services_push(iq_elt, client) diff --git a/tests/unit/test_plugin_xep_0234.py b/tests/unit/test_plugin_xep_0234.py index cc6cd7df..174c85c7 100644 --- a/tests/unit/test_plugin_xep_0234.py +++ b/tests/unit/test_plugin_xep_0234.py @@ -41,16 +41,14 @@ class TestXEP0234: async def test_parse_file_element(self, host, client): """``parse_file_element`` updates file_data dictionary correctly.""" xep_0234 = XEP_0234(host) - file_elt = xml_tools.parse( - """ + file_elt = xml_tools.parse(""" text/plain test.txt 2015-07-26T21:46:00+01:00 6144 - """ - ) + """) file_data = {} result = await xep_0234.parse_file_element(client, file_elt, file_data) @@ -75,13 +73,11 @@ class TestXEP0234: async def test_parse_file_element_invalid_file_element(self, host, client): """Raise DataError exception if element is invalid.""" xep_0234 = XEP_0234(host) - file_elt = xml_tools.parse( - """ + file_elt = xml_tools.parse(""" example.txt - """ - ) + """) with pytest.raises(exceptions.DataError): await xep_0234.parse_file_element(client, file_elt) @@ -111,16 +107,14 @@ class TestXEP0234: content_data = {"application_data": {}, "transport_data": {"webrtc": False}} content_name = "dummy_content" file_data = {"progress_id": "123"} - file_elt = xml_tools.parse( - """ + file_elt = xml_tools.parse(""" text/plain test.txt 2015-07-26T21:46:00+01:00 6144 - """ - ) + """) confirmed = await xep_0234._file_receiving_request_conf( client, session, content_data, content_name, file_data, file_elt @@ -157,16 +151,14 @@ class TestXEP0234: content_data = {"application_data": {}, "transport_data": {"webrtc": True}} content_name = "dummy_content" file_data = {"progress_id": "123"} - file_elt = xml_tools.parse( - """ + file_elt = xml_tools.parse(""" text/plain test.txt 2015-07-26T21:46:00+01:00 6144 - """ - ) + """) confirmed = await xep_0234._file_receiving_request_conf( client, session, content_data, content_name, file_data, file_elt diff --git a/tests/unit/test_plugin_xep_0293.py b/tests/unit/test_plugin_xep_0293.py index 98c13d0f..502595a0 100644 --- a/tests/unit/test_plugin_xep_0293.py +++ b/tests/unit/test_plugin_xep_0293.py @@ -164,14 +164,12 @@ class TestXEP0293: """Parsing of and elements from a description.""" xep_0293 = XEP_0293(host) - desc_element = xml_tools.parse( - f""" + desc_element = xml_tools.parse(f""" - """ - ) + """) media_data = {} xep_0293._parse_description_trigger(desc_element, media_data) @@ -183,16 +181,14 @@ class TestXEP0293: """Parsing of and elements from a payload type.""" xep_0293 = XEP_0293(host) - desc_element = xml_tools.parse( - f""" + desc_element = xml_tools.parse(f""" - """ - ) + """) media_data = {} payload_type_elt = desc_element.firstChildElement() diff --git a/tests/unit/test_plugin_xep_0373.py b/tests/unit/test_plugin_xep_0373.py index e2b008d8..6cb291b8 100644 --- a/tests/unit/test_plugin_xep_0373.py +++ b/tests/unit/test_plugin_xep_0373.py @@ -10,7 +10,6 @@ except exceptions.MissingModule as e: from libervia.backend.tools.xmpp_datetime import parse_datetime from twisted.words.protocols.jabber import jid - a = jid.JID("foo@example.com") b = jid.JID("bar@example.com") diff --git a/tests/unit/test_plugin_xep_0420.py b/tests/unit/test_plugin_xep_0420.py index 93e4dc07..2d1db738 100644 --- a/tests/unit/test_plugin_xep_0420.py +++ b/tests/unit/test_plugin_xep_0420.py @@ -35,7 +35,6 @@ from libervia.backend.plugins.plugin_xep_0420 import ( from libervia.backend.tools.xml_tools import ElementParser from twisted.words.xish import domish - __all__ = [ # pylint: disable=unused-variable "test_unpack_matches_original", "test_affixes_included", @@ -150,13 +149,11 @@ def test_affixes_included() -> None: # pylint: disable=missing-function-docstri custom_policies={custom_affix: SCEAffixPolicy.OPTIONAL}, ) - stanza = string_to_domish( - """ + stanza = string_to_domish(""" Make sure that both the REQUIRED and the OPTIONAL affixes are included. - """ - ) + """) affix_values = XEP_0420.unpack_stanza( profile, stanza, XEP_0420.pack_stanza(profile, stanza) @@ -186,13 +183,11 @@ def test_all_affixes_verified() -> None: # pylint: disable=missing-function-doc custom_policies={}, ) - stanza = string_to_domish( - """ + stanza = string_to_domish(""" When unpacking, all affixes are loaded, even those marked as NOT_NEEDED. - """ - ) + """) envelope_serialized = XEP_0420.pack_stanza(packing_profile, stanza) @@ -229,11 +224,9 @@ def test_incomplete_affixes() -> None: # pylint: disable=missing-function-docst custom_policies={}, ) - stanza = string_to_domish( - """ + stanza = string_to_domish(""" Check that all affixes REQUIRED by the profile are present. - """ - ) + """) with pytest.raises(ProfileRequirementsNotMet): XEP_0420.unpack_stanza( @@ -259,14 +252,12 @@ def test_incomplete_affixes() -> None: # pylint: disable=missing-function-docst custom_policies={custom_affix: SCEAffixPolicy.REQUIRED}, ) - stanza = string_to_domish( - """ + stanza = string_to_domish(""" Check that all affixes REQUIRED by the profile are present, including custom affixes. - """ - ) + """) with pytest.raises(ProfileRequirementsNotMet): XEP_0420.unpack_stanza( @@ -284,11 +275,9 @@ def test_rpad_affix() -> None: # pylint: disable=missing-function-docstring ) for _ in range(100): - stanza = string_to_domish( - """ + stanza = string_to_domish(""" OK - """ - ) + """) affix_values = XEP_0420.unpack_stanza( profile, stanza, XEP_0420.pack_stanza(profile, stanza) @@ -321,9 +310,7 @@ def test_time_affix() -> None: # pylint: disable=missing-function-docstring """) affix_values = XEP_0420.unpack_stanza( profile, stanza, XEP_0420.pack_stanza(profile, stanza) @@ -526,12 +501,10 @@ def test_non_encryptable_elements() -> None: # pylint: disable=missing-function custom_policies={}, ) - stanza = string_to_domish( - """ + stanza = string_to_domish(""" This stanza includes a store hint which must not be encrypted. - """ - ) + """) envelope_serialized = XEP_0420.pack_stanza(profile, stanza) envelope = string_to_domish(envelope_serialized.decode("utf-8")) @@ -552,9 +525,7 @@ def test_non_encryptable_elements() -> None: # pylint: disable=missing-function - """.encode( - "utf-8" - ) + """.encode("utf-8") XEP_0420.unpack_stanza(profile, stanza, envelope_serialized) @@ -582,9 +553,7 @@ def test_schema_validation() -> None: # pylint: disable=missing-function-docstr - """.encode( - "utf-8" - ) + """.encode("utf-8") with pytest.raises(exceptions.ParsingError): XEP_0420.unpack_stanza(profile, stanza, envelope_serialized) diff --git a/twisted/plugins/libervia_backend_plugin.py b/twisted/plugins/libervia_backend_plugin.py index 571086a1..b6aae162 100644 --- a/twisted/plugins/libervia_backend_plugin.py +++ b/twisted/plugins/libervia_backend_plugin.py @@ -28,7 +28,6 @@ from libervia.backend.core.i18n import _ from sat_tmp.wokkel import install as install_wokkel_patches - install_wokkel_patches()