diff libervia/backend/plugins/plugin_exp_invitation_pubsub.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_exp_invitation_pubsub.py	Tue Jun 18 12:06:45 2024 +0200
+++ b/libervia/backend/plugins/plugin_exp_invitation_pubsub.py	Wed Jun 19 18:44:57 2024 +0200
@@ -57,20 +57,23 @@
             in_sign="sssssss",
             out_sign="",
             method=self._send_pubsub_invitation,
-            async_=True
+            async_=True,
         )
 
-    def register(
-        self,
-        namespace: str,
-        handler
-    ) -> None:
+    def register(self, namespace: str, handler) -> None:
         self._ns_handler[namespace] = handler
         self.host.plugins["INVITATION"].register_namespace(namespace, self.on_invitation)
 
     def _send_pubsub_invitation(
-            self, invitee_jid_s, service_s, node, item_id=None,
-            name=None, extra_s='', profile_key=C.PROF_KEY_NONE):
+        self,
+        invitee_jid_s,
+        service_s,
+        node,
+        item_id=None,
+        name=None,
+        extra_s="",
+        profile_key=C.PROF_KEY_NONE,
+    ):
         client = self.host.get_client(profile_key)
         invitee_jid = jid.JID(invitee_jid_s)
         service = jid.JID(service_s)
@@ -83,7 +86,7 @@
                 node,
                 item_id or None,
                 name=name or None,
-                extra=extra
+                extra=extra,
             )
         )
 
@@ -94,7 +97,7 @@
         service: jid.JID,
         node: str,
         item_id: Optional[str] = None,
-        name: str = '',
+        name: str = "",
         extra: Optional[dict] = None,
     ) -> None:
         if extra is None:
@@ -112,24 +115,26 @@
                 else:
                     await utils.as_deferred(
                         preflight,
-                        client, invitee_jid, service, node, item_id, name, extra
+                        client,
+                        invitee_jid,
+                        service,
+                        node,
+                        item_id,
+                        name,
+                        extra,
                     )
             if item_id is None:
                 item_id = extra.pop("default_item_id", None)
 
         # we authorize our invitee to see the nodes of interest
-        await self._p.set_node_affiliations(client, service, node, {invitee_jid: "member"})
+        await self._p.set_node_affiliations(
+            client, service, node, {invitee_jid: "member"}
+        )
         log.debug(f"affiliation set on {service}'s {node!r} node")
 
         # now we send the invitation
         self.host.plugins["INVITATION"].send_pubsub_invitation(
-            client,
-            invitee_jid,
-            service,
-            node,
-            item_id,
-            name=name or None,
-            extra=extra
+            client, invitee_jid, service, node, item_id, name=name or None, extra=extra
         )
 
     async def on_invitation(
@@ -141,7 +146,7 @@
         service: jid.JID,
         node: str,
         item_id: Optional[str],
-        item_elt: domish.Element
+        item_elt: domish.Element,
     ) -> None:
         if extra is None:
             extra = {}
@@ -155,7 +160,14 @@
         else:
             await utils.as_deferred(
                 preflight,
-                client, namespace, name, extra, service, node, item_id, item_elt
+                client,
+                namespace,
+                name,
+                extra,
+                service,
+                node,
+                item_id,
+                item_elt,
             )
             if item_id is None:
                 item_id = extra.pop("default_item_id", None)
@@ -164,6 +176,6 @@
         if not name:
             name = extra.pop("name", "")
 
-        return await self.host.plugins['LIST_INTEREST'].register_pubsub(
-            client, namespace, service, node, item_id, creator,
-            name, element, extra)
+        return await self.host.plugins["LIST_INTEREST"].register_pubsub(
+            client, namespace, service, node, item_id, creator, name, element, extra
+        )