Mercurial > libervia-backend
diff libervia/backend/memory/sqla.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 5f2d496c633f |
children |
line wrap: on
line diff
--- a/libervia/backend/memory/sqla.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/backend/memory/sqla.py Wed Jun 19 18:44:57 2024 +0200 @@ -215,7 +215,7 @@ engine = create_async_engine( db_config["url"], future=True, - json_serializer=lambda obj: json.dumps(obj, ensure_ascii=False) + json_serializer=lambda obj: json.dumps(obj, ensure_ascii=False), ) new_base = not db_config["path"].exists() @@ -1778,7 +1778,7 @@ type_: Optional[NotificationType] = None, status: Optional[NotificationStatus] = None, requires_action: Optional[bool] = None, - min_priority: Optional[int] = None + min_priority: Optional[int] = None, ) -> List[Notification]: """Retrieve all notifications for a given profile with optional filters. @@ -1790,7 +1790,9 @@ @return: list of matching Notification instances. """ profile_id = self.profiles[client.profile] - filters = [or_(Notification.profile_id == profile_id, Notification.profile_id.is_(None))] + filters = [ + or_(Notification.profile_id == profile_id, Notification.profile_id.is_(None)) + ] if type_: filters.append(Notification.type == type_) @@ -1803,9 +1805,7 @@ async with self.session() as session: result = await session.execute( - select(Notification) - .where(and_(*filters)) - .order_by(Notification.id) + select(Notification).where(and_(*filters)).order_by(Notification.id) ) return result.scalars().all()