diff libervia/frontends/quick_frontend/quick_contact_list.py @ 4270:0d7bb4df2343

Reformatted code base using black.
author Goffi <goffi@goffi.org>
date Wed, 19 Jun 2024 18:44:57 +0200
parents b47f21f2b8fa
children
line wrap: on
line diff
--- a/libervia/frontends/quick_frontend/quick_contact_list.py	Tue Jun 18 12:06:45 2024 +0200
+++ b/libervia/frontends/quick_frontend/quick_contact_list.py	Wed Jun 19 18:44:57 2024 +0200
@@ -232,8 +232,10 @@
                 # we use entity's bare jid to cache data, so a resource here
                 # will cause troubles
                 log.warning(
-                    "Roster entities with resources are not managed, ignoring {entity}"
-                    .format(entity=entity))
+                    "Roster entities with resources are not managed, ignoring {entity}".format(
+                        entity=entity
+                    )
+                )
                 continue
             self.host.contact_new_handler(*contact, profile=self.profile)
         handler._contacts_filled(self.profile)
@@ -250,8 +252,13 @@
         handler.fill(self.profile)
 
     def getCache(
-        self, entity, name=None, bare_default=True, create_if_not_found=False,
-        default=Exception):
+        self,
+        entity,
+        name=None,
+        bare_default=True,
+        create_if_not_found=False,
+        default=Exception,
+    ):
         """Return a cache value for a contact
 
         @param entity(jid.JID): entity of the contact from who we want data
@@ -515,8 +522,8 @@
             else:
                 self._specials.add(entity)
                 cache[C.CONTACT_MAIN_RESOURCE] = None
-                if 'nicknames' in cache:
-                    del cache['nicknames']
+                if "nicknames" in cache:
+                    del cache["nicknames"]
 
         # now the attributes we keep in cache
         # XXX: if entity is a full jid, we store the value for the resource only
@@ -573,7 +580,8 @@
                 self.show_entities_with_notifs
                 and next(self.host.get_notifs(entity.bare, profile=self.profile), None)
             )
-            or entity.resource is None and self.is_room(entity.bare)
+            or entity.resource is None
+            and self.is_room(entity.bare)
         )
 
     def any_entity_visible(self, entities, check_resources=False):
@@ -676,7 +684,7 @@
                 priority_resource = max(
                     resources_data,
                     key=lambda res: resources_data[res].get(
-                        C.PRESENCE_PRIORITY, -2 ** 32
+                        C.PRESENCE_PRIORITY, -(2**32)
                     ),
                 )
                 cache[C.CONTACT_MAIN_RESOURCE] = priority_resource
@@ -710,7 +718,7 @@
     def unselect(self, entity):
         """Unselect an entity
 
-         @param entity(jid.JID): entity to unselect
+        @param entity(jid.JID): entity to unselect
         """
         try:
             cache = self._cache[entity.bare]
@@ -912,9 +920,9 @@
     def items_sort(self, items):
         """sort items
 
-       @param items(dict): items to sort (will be emptied !)
-       @return (OrderedDict): sorted items
-       """
+        @param items(dict): items to sort (will be emptied !)
+        @return (OrderedDict): sorted items
+        """
         ordered_items = OrderedDict()
         bare_jids = sorted(items.keys())
         for jid_ in bare_jids:
@@ -1043,9 +1051,7 @@
             what youa re doing!
         """
         log.debug(
-            "Contact lists updates are now {}".format(
-                "LOCKED" if locked else "UNLOCKED"
-            )
+            "Contact lists updates are now {}".format("LOCKED" if locked else "UNLOCKED")
         )
         self._update_locked = locked
         if not locked and do_update:
@@ -1089,11 +1095,11 @@
         return handler.items
 
     @property
-    def show_resources(self) -> bool|None:
+    def show_resources(self) -> bool | None:
         return self._show_resources
 
     @show_resources.setter
-    def show_resources(self, show: bool|None) -> None:
+    def show_resources(self, show: bool | None) -> None:
         self._show_resources = show
 
     @property