apply black to the whole codebase.

This commit is contained in:
Goffi 2026-03-09 09:22:04 +01:00
commit 82e2c6efac
163 changed files with 175 additions and 448 deletions

View file

@ -17,7 +17,6 @@ import os.path
import re
from libervia.backend import __version__
sys.path.insert(0, os.path.abspath("./_ext"))

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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__)

View file

@ -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(

View file

@ -88,14 +88,11 @@ class MediawikiConstructor(base_constructor.Constructor):
print(("Adding %s %s" % (section, function["type"])))
async_msg = """<br />'''This method is asynchronous'''"""
deprecated_msg = """<br />'''<font color="#FF0000">/!\ WARNING /!\ : This method is deprecated, please don't use it !</font>'''"""
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

View file

@ -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

View file

@ -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

View file

@ -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":

View file

@ -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

View file

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""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

View file

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""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

View file

@ -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__)

View file

@ -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"

View file

@ -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()

View file

@ -37,7 +37,6 @@ from wokkel import disco
from base64 import b64encode
from hashlib import sha1
log = getLogger(__name__)

View file

@ -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__)

View file

@ -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__)

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -23,7 +23,6 @@ from sqlalchemy import (
)
from sqlalchemy.sql import table, column
# revision identifiers, used by Alembic.
revision = "602caf848068"
down_revision = None

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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__)

View file

@ -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

View file

@ -48,7 +48,6 @@ from wokkel import generic
from libervia.backend.core.constants import Const as C
Base = declarative_base(
metadata=MetaData(
naming_convention={

View file

@ -34,7 +34,6 @@ import tempfile
import urllib.parse
import shortuuid
PLUGIN_INFO = {
C.PI_NAME: "blog import",
C.PI_IMPORT_NAME: "BLOG_IMPORT",

View file

@ -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

View file

@ -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",

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -56,9 +56,7 @@ PARAMS = """
</category>
</individual>
</params>
""".format(
category_name=CATEGORY, name=NAME, label=_(LABEL)
)
""".format(category_name=CATEGORY, name=NAME, label=_(LABEL))
class LangDetect(object):

View file

@ -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"

View file

@ -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):

View file

@ -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")

View file

@ -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=}"

View file

@ -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__)

View file

@ -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 = {

View file

@ -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):

View file

@ -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",

View file

@ -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."""),
}

View file

@ -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 = """
</category>
</general>
</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):

View file

@ -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"

View file

@ -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.")

View file

@ -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"

View file

@ -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",

View file

@ -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:

View file

@ -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"

View file

@ -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 = {

View file

@ -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).
"""
)
),
""")),
}

View file

@ -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 = [

View file

@ -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",

View file

@ -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 = """

View file

@ -47,9 +47,7 @@ class XmlLog(object):
</category>
</general>
</params>
""" % {
"label_xmllog": _("Activate XML log")
}
""" % {"label_xmllog": _("Activate XML log")}
def __init__(self, host):
log.info(_("Plugin XML Log initialization"))

View file

@ -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 = {

View file

@ -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(

View file

@ -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",

View file

@ -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",

View file

@ -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__)

View file

@ -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",

View file

@ -38,7 +38,6 @@ from wokkel import disco, iwokkel
from zope.interface import implementer
NS_SEARCH = "jabber:iq:search"
PLUGIN_INFO = {

View file

@ -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__)

View file

@ -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__)

View file

@ -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

View file

@ -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"

View file

@ -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",

View file

@ -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"

View file

@ -47,7 +47,6 @@ from .models import (
TransportData,
)
log = getLogger(__name__)

View file

@ -45,7 +45,6 @@ from .constants import (
NS_JINGLE_RTP_VIDEO,
)
log = getLogger(__name__)

View file

@ -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"

View file

@ -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",

View file

@ -32,7 +32,6 @@ except ImportError:
from wokkel.subprotocols import XMPPHandler
from zope.interface import implementer
NS_DD = "urn:xmpp:delay"
PLUGIN_INFO = {

View file

@ -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"

View file

@ -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"

View file

@ -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__)

View file

@ -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 = {

View file

@ -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"

View file

@ -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
)

View file

@ -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",

View file

@ -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 = {

View file

@ -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"

View file

@ -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

View file

@ -383,8 +383,7 @@ NS_TM: Final = "urn:xmpp:tm:1"
NS_ATM: Final = "urn:xmpp:atm:1"
TRUST_MESSAGE_SCHEMA = xmlschema.XMLSchema(
"""<?xml version='1.0' encoding='UTF-8'?>
TRUST_MESSAGE_SCHEMA = xmlschema.XMLSchema("""<?xml version='1.0' encoding='UTF-8'?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:xmpp:tm:1'
xmlns='urn:xmpp:tm:1'
@ -412,8 +411,7 @@ TRUST_MESSAGE_SCHEMA = xmlschema.XMLSchema(
</xs:complexType>
</xs:element>
</xs:schema>
"""
)
""")
# This is compatible with omemo:2's SCE profile

View file

@ -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",

View file

@ -63,9 +63,7 @@ PARAMS = """
</category>
</individual>
</params>
""".format(
category_name=CATEGORY, name=NAME, label=_(LABEL)
)
""".format(category_name=CATEGORY, name=NAME, label=_(LABEL))
class XEP_0424:

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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__)

View file

@ -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):
</author>
</entry>
</item>
""".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):

View file

@ -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)

Some files were not shown because too many files have changed in this diff Show more