changeset 4072:040095a5dc7f

refactoring: rename `SAT` class to `LiberviaBackend`
author Goffi <goffi@goffi.org>
date Fri, 02 Jun 2023 11:55:48 +0200
parents 4b842c1fb686
children 7c5654c54fed
files libervia/backend/core/sat_main.py libervia/backend/plugins/plugin_xep_0082.py libervia/backend/plugins/plugin_xep_0373.py libervia/backend/plugins/plugin_xep_0374.py libervia/backend/plugins/plugin_xep_0384.py libervia/backend/plugins/plugin_xep_0420.py libervia/backend/tools/stream.py tests/unit/conftest.py twisted/plugins/sat_plugin.py
diffstat 9 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/backend/core/sat_main.py	Fri Jun 02 11:49:51 2023 +0200
+++ b/libervia/backend/core/sat_main.py	Fri Jun 02 11:55:48 2023 +0200
@@ -55,7 +55,7 @@
 
 log = getLogger(__name__)
 
-class SAT(service.Service):
+class LiberviaBackend(service.Service):
 
     def _init(self):
         # we don't use __init__ to avoid doule initialisation with twistd
--- a/libervia/backend/plugins/plugin_xep_0082.py	Fri Jun 02 11:49:51 2023 +0200
+++ b/libervia/backend/plugins/plugin_xep_0082.py	Fri Jun 02 11:55:48 2023 +0200
@@ -19,7 +19,7 @@
 
 from libervia.backend.core.constants import Const as C
 from libervia.backend.core.i18n import D_
-from libervia.backend.core.sat_main import SAT
+from libervia.backend.core.sat_main import LiberviaBackend
 from libervia.backend.tools import xmpp_datetime
 
 
@@ -52,7 +52,7 @@
     actively, but offers API for other plugins to use.
     """
 
-    def __init__(self, sat: SAT) -> None:
+    def __init__(self, sat: LiberviaBackend) -> None:
         """
         @param sat: The SAT instance.
         """
--- a/libervia/backend/plugins/plugin_xep_0373.py	Fri Jun 02 11:49:51 2023 +0200
+++ b/libervia/backend/plugins/plugin_xep_0373.py	Fri Jun 02 11:55:48 2023 +0200
@@ -35,7 +35,7 @@
 from libervia.backend.core.core_types import SatXMPPEntity
 from libervia.backend.core.i18n import _, D_
 from libervia.backend.core.log import getLogger, Logger
-from libervia.backend.core.sat_main import SAT
+from libervia.backend.core.sat_main import LiberviaBackend
 from libervia.backend.core.xmpp import SatXMPPClient
 from libervia.backend.memory import persistent
 from libervia.backend.plugins.plugin_xep_0045 import XEP_0045
@@ -976,7 +976,7 @@
 """
 
 
-def get_gpg_provider(sat: SAT, client: SatXMPPClient) -> GPGProvider:
+def get_gpg_provider(sat: LiberviaBackend, client: SatXMPPClient) -> GPGProvider:
     """Get the GPG provider for a client.
 
     @param sat: The SAT instance.
@@ -1004,7 +1004,7 @@
     Implementation of XEP-0373: OpenPGP for XMPP under namespace ``urn:xmpp:openpgp:0``.
     """
 
-    def __init__(self, host: SAT) -> None:
+    def __init__(self, host: LiberviaBackend) -> None:
         """
         @param sat: The SAT instance.
         """
--- a/libervia/backend/plugins/plugin_xep_0374.py	Fri Jun 02 11:49:51 2023 +0200
+++ b/libervia/backend/plugins/plugin_xep_0374.py	Fri Jun 02 11:55:48 2023 +0200
@@ -26,7 +26,7 @@
 from libervia.backend.core.core_types import SatXMPPEntity
 from libervia.backend.core.i18n import _, D_
 from libervia.backend.core.log import getLogger, Logger
-from libervia.backend.core.sat_main import SAT
+from libervia.backend.core.sat_main import LiberviaBackend
 from libervia.backend.core.xmpp import SatXMPPClient
 from libervia.backend.plugins.plugin_xep_0045 import XEP_0045
 from libervia.backend.plugins.plugin_xep_0334 import XEP_0334
@@ -71,7 +71,7 @@
     management, the two trust models "BTBV" and "manual" are supported.
     """
 
-    def __init__(self, sat: SAT) -> None:
+    def __init__(self, sat: LiberviaBackend) -> None:
         """
         @param sat: The SAT instance.
         """
--- a/libervia/backend/plugins/plugin_xep_0384.py	Fri Jun 02 11:49:51 2023 +0200
+++ b/libervia/backend/plugins/plugin_xep_0384.py	Fri Jun 02 11:55:48 2023 +0200
@@ -36,7 +36,7 @@
 from libervia.backend.core.core_types import MessageData, SatXMPPEntity
 from libervia.backend.core.i18n import _, D_
 from libervia.backend.core.log import getLogger, Logger
-from libervia.backend.core.sat_main import SAT
+from libervia.backend.core.sat_main import LiberviaBackend
 from libervia.backend.core.xmpp import SatXMPPClient
 from libervia.backend.memory import persistent
 from libervia.backend.plugins.plugin_misc_text_commands import TextCommands
@@ -803,7 +803,7 @@
         await client.a_send(message_data["xml"])
 
 
-def make_session_manager(sat: SAT, profile: str) -> Type[omemo.SessionManager]:
+def make_session_manager(sat: LiberviaBackend, profile: str) -> Type[omemo.SessionManager]:
     """
     @param sat: The SAT instance.
     @param profile: The profile.
@@ -1389,7 +1389,7 @@
 
 
 async def prepare_for_profile(
-    sat: SAT,
+    sat: LiberviaBackend,
     profile: str,
     initial_own_label: Optional[str],
     signed_pre_key_rotation_period: int = 7 * 24 * 60 * 60,
@@ -1540,7 +1540,7 @@
         custom_policies={}
     )
 
-    def __init__(self, sat: SAT) -> None:
+    def __init__(self, sat: LiberviaBackend) -> None:
         """
         @param sat: The SAT instance.
         """
--- a/libervia/backend/plugins/plugin_xep_0420.py	Fri Jun 02 11:49:51 2023 +0200
+++ b/libervia/backend/plugins/plugin_xep_0420.py	Fri Jun 02 11:55:48 2023 +0200
@@ -30,7 +30,7 @@
 from libervia.backend.core.constants import Const as C
 from libervia.backend.core.i18n import D_
 from libervia.backend.core.log import Logger, getLogger
-from libervia.backend.core.sat_main import SAT
+from libervia.backend.core.sat_main import LiberviaBackend
 from libervia.backend.tools.xml_tools import ElementParser
 from libervia.backend.plugins.plugin_xep_0033 import NS_ADDRESS
 from libervia.backend.plugins.plugin_xep_0082 import XEP_0082
@@ -251,7 +251,7 @@
     # potential future use.
     MUST_BE_PLAINTEXT_ELEMENTS: Set[Tuple[str, str]] = set()
 
-    def __init__(self, sat: SAT) -> None:
+    def __init__(self, sat: LiberviaBackend) -> None:
         """
         @param sat: The SAT instance.
         """
--- a/libervia/backend/tools/stream.py	Fri Jun 02 11:49:51 2023 +0200
+++ b/libervia/backend/tools/stream.py	Fri Jun 02 11:55:48 2023 +0200
@@ -31,7 +31,7 @@
 from twisted.protocols import basic
 from twisted.internet import interfaces
 
-from libervia.backend.core.sat_main import SAT
+from libervia.backend.core.sat_main import LiberviaBackend
 
 log = getLogger(__name__)
 
@@ -52,7 +52,7 @@
 
     def __init__(
         self,
-        host: SAT,
+        host: LiberviaBackend,
         client: SatXMPPEntity,
         path: Union[str, Path],
         mode: str = "rb",
--- a/tests/unit/conftest.py	Fri Jun 02 11:49:51 2023 +0200
+++ b/tests/unit/conftest.py	Fri Jun 02 11:55:48 2023 +0200
@@ -21,7 +21,7 @@
 from pytest import fixture
 from twisted.internet import defer
 from twisted.words.protocols.jabber import jid
-from libervia.backend.core.sat_main import SAT
+from libervia.backend.core.sat_main import LiberviaBackend
 from libervia.backend.tools import async_trigger as trigger
 from libervia.backend.core import xmpp
 
@@ -39,7 +39,7 @@
     return AsyncMock()
 
 
-class MockSAT(SAT):
+class MockSAT(LiberviaBackend):
 
     def __init__(self, bridge, storage):
         self._cb_map = {}
--- a/twisted/plugins/sat_plugin.py	Fri Jun 02 11:49:51 2023 +0200
+++ b/twisted/plugins/sat_plugin.py	Fri Jun 02 11:55:48 2023 +0200
@@ -69,8 +69,8 @@
         # XXX: Libervia must be imported after log configuration,
         #      because it write stuff to logs
         initialise(options.parent)
-        from libervia.backend.core.sat_main import SAT
-        return SAT()
+        from libervia.backend.core.sat_main import LiberviaBackend
+        return LiberviaBackend()
 
 
 serviceMaker = SatMaker()