diff libervia/backend/plugins/plugin_xep_0300.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_0300.py	Tue Jun 18 12:06:45 2024 +0200
+++ b/libervia/backend/plugins/plugin_xep_0300.py	Wed Jun 19 18:44:57 2024 +0200
@@ -50,7 +50,7 @@
 
 NS_HASHES = "urn:xmpp:hashes:2"
 NS_HASHES_FUNCTIONS = "urn:xmpp:hash-function-text-names:{}"
-BUFFER_SIZE = 2 ** 12
+BUFFER_SIZE = 2**12
 ALGO_DEFAULT = "sha-256"
 
 
@@ -90,10 +90,10 @@
     def get_best_peer_algo(self, to_jid, profile):
         """Return the best available hashing algorith of other peer
 
-         @param to_jid(jid.JID): peer jid
-         @parm profile: %(doc_profile)s
-         @return (D(unicode, None)): best available algorithm,
-            or None if hashing is not possible
+        @param to_jid(jid.JID): peer jid
+        @parm profile: %(doc_profile)s
+        @return (D(unicode, None)): best available algorithm,
+           or None if hashing is not possible
         """
         client = self.host.get_client(profile)
         for algo in reversed(XEP_0300.ALGOS):
@@ -175,7 +175,7 @@
         assert algo
         hash_elt = domish.Element((NS_HASHES, "hash"))
         if hash_ is not None:
-            b64_hash = base64.b64encode(hash_.encode('utf-8')).decode('utf-8')
+            b64_hash = base64.b64encode(hash_.encode("utf-8")).decode("utf-8")
             hash_elt.addContent(b64_hash)
         hash_elt["algo"] = algo
         return hash_elt
@@ -205,7 +205,7 @@
 
             if best_algo is None or algos.index(best_algo) < idx:
                 best_algo = algo
-                best_value = base64.b64decode(str(hash_elt)).decode('utf-8')
+                best_value = base64.b64decode(str(hash_elt)).decode("utf-8")
 
         if not hash_elt:
             raise exceptions.NotFound