diff libervia/backend/plugins/plugin_xep_0465.py @ 4270:0d7bb4df2343

Reformatted code base using black.
author Goffi <goffi@goffi.org>
date Wed, 19 Jun 2024 18:44:57 +0200
parents 4b842c1fb686
children
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0465.py	Tue Jun 18 12:06:45 2024 +0200
+++ b/libervia/backend/plugins/plugin_xep_0465.py	Wed Jun 19 18:44:57 2024 +0200
@@ -120,10 +120,7 @@
 
     @utils.ensure_deferred
     async def _subscriptions(
-        self,
-        service="",
-        nodeIdentifier="",
-        profile_key=C.PROF_KEY_NONE
+        self, service="", nodeIdentifier="", profile_key=C.PROF_KEY_NONE
     ) -> str:
         client = self.host.get_client(profile_key)
         service = None if not service else jid.JID(service)
@@ -134,7 +131,7 @@
         self,
         client: SatXMPPEntity,
         service: Optional[jid.JID] = None,
-        node: Optional[str] = None
+        node: Optional[str] = None,
     ) -> List[Dict[str, Union[str, bool]]]:
         """Retrieve public subscriptions from a service
 
@@ -170,9 +167,7 @@
                     "state": subscription_elt.getAttribute("subscription", "subscribed"),
                 }
             except KeyError:
-                log.warning(
-                    f"invalid <subscription> element: {subscription_elt.toXml()}"
-                )
+                log.warning(f"invalid <subscription> element: {subscription_elt.toXml()}")
                 continue
             if node is not None and sub_dict["node"] != node:
                 # if not is specified, we filter out any other node
@@ -183,10 +178,7 @@
 
     @utils.ensure_deferred
     async def _get_public_node_subscriptions(
-        self,
-        service: str,
-        node: str,
-        profile_key: str
+        self, service: str, node: str, profile_key: str
     ) -> Dict[str, str]:
         client = self.host.get_client(profile_key)
         subs = await self.get_public_node_subscriptions(
@@ -199,10 +191,7 @@
         return f"{NS_PPS_SUBSCRIBERS}/{node}"
 
     async def get_public_node_subscriptions(
-        self,
-        client: SatXMPPEntity,
-        service: Optional[jid.JID],
-        nodeIdentifier: str
+        self, client: SatXMPPEntity, service: Optional[jid.JID], nodeIdentifier: str
     ) -> Dict[jid.JID, str]:
         """Retrieve public subscriptions to a node
 
@@ -237,9 +226,7 @@
             try:
                 ret[jid.JID(subscriber_elt["jid"])] = "subscribed"
             except (KeyError, RuntimeError):
-                log.warning(
-                    f"invalid <subscriber> element: {subscriber_elt.toXml()}"
-                )
+                log.warning(f"invalid <subscriber> element: {subscriber_elt.toXml()}")
                 continue
         return ret
 
@@ -253,7 +240,7 @@
         """
         if options is None:
             options = {}
-        options[f'{{{NS_PPS}}}public'] = True
+        options[f"{{{NS_PPS}}}public"] = True
         return options