diff libervia/backend/plugins/plugin_xep_0264.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_0264.py	Tue Jun 18 12:06:45 2024 +0200
+++ b/libervia/backend/plugins/plugin_xep_0264.py	Wed Jun 19 18:44:57 2024 +0200
@@ -124,7 +124,7 @@
 
         if thumbnails:
             # we want thumbnails ordered from smallest to biggest
-            thumbnails.sort(key=lambda t: t.get('size', (0, 0)))
+            thumbnails.sort(key=lambda t: t.get("size", (0, 0)))
             file_data.setdefault("extra", {})[C.KEY_THUMBNAILS] = thumbnails
         return True
 
@@ -141,8 +141,8 @@
         return hashlib.sha256(repr((image_uid, size)).encode()).hexdigest()
 
     def _blocking_gen_thumb(
-            self, source_path, size=None, max_age=None, image_uid=None,
-            fix_orientation=True):
+        self, source_path, size=None, max_age=None, image_uid=None, fix_orientation=True
+    ):
         """Generate a thumbnail for image
 
         This is a blocking method and must be executed in a thread
@@ -171,7 +171,8 @@
         return img.size, uid
 
     def generate_thumbnail(
-        self, source_path, size=None, max_age=None, image_uid=None, fix_orientation=True):
+        self, source_path, size=None, max_age=None, image_uid=None, fix_orientation=True
+    ):
         """Generate a thumbnail of image
 
         @param source_path(unicode): absolute path to source image
@@ -188,8 +189,12 @@
             - unique Id of the thumbnail
         """
         d = threads.deferToThread(
-            self._blocking_gen_thumb, source_path, size, max_age, image_uid=image_uid,
-            fix_orientation=fix_orientation
+            self._blocking_gen_thumb,
+            source_path,
+            size,
+            max_age,
+            image_uid=image_uid,
+            fix_orientation=fix_orientation,
         )
         d.addErrback(
             lambda failure_: log.error("thumbnail generation error: {}".format(failure_))