diff libervia/backend/memory/sqla_mapping.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_mapping.py	Tue Jun 18 12:06:45 2024 +0200
+++ b/libervia/backend/memory/sqla_mapping.py	Wed Jun 19 18:44:57 2024 +0200
@@ -89,7 +89,7 @@
 profiles = Profiles()
 
 
-def get_profile_by_id( profile_id):
+def get_profile_by_id(profile_id):
     return profiles.id_to_profile.get(profile_id)
 
 
@@ -263,23 +263,17 @@
 
     profile = relationship("Profile")
     messages = relationship(
-        "Message",
-        backref="history",
-        cascade="all, delete-orphan",
-        passive_deletes=True
+        "Message", backref="history", cascade="all, delete-orphan", passive_deletes=True
     )
     subjects = relationship(
-        "Subject",
-        backref="history",
-        cascade="all, delete-orphan",
-        passive_deletes=True
+        "Subject", backref="history", cascade="all, delete-orphan", passive_deletes=True
     )
     thread = relationship(
         "Thread",
         uselist=False,
         back_populates="history",
         cascade="all, delete-orphan",
-        passive_deletes=True
+        passive_deletes=True,
     )
     __mapper_args__ = {"version_id_col": version_id}
 
@@ -332,9 +326,9 @@
                 extra["thread_parent"] = self.thread.parent_id
 
         return {
-            "from": f"{self.source}/{self.source_res}"
-            if self.source_res
-            else self.source,
+            "from": (
+                f"{self.source}/{self.source_res}" if self.source_res else self.source
+            ),
             "to": f"{self.dest}/{self.dest_res}" if self.dest_res else self.dest,
             "uid": self.uid,
             "message": {m.language or "": m.message for m in self.messages},
@@ -456,7 +450,9 @@
     timestamp = Column(Float, nullable=False, default=time.time)
     expire_at = Column(Float, nullable=True)
 
-    profile_id = Column(ForeignKey("profiles.id", ondelete="CASCADE"), index=True, nullable=True)
+    profile_id = Column(
+        ForeignKey("profiles.id", ondelete="CASCADE"), index=True, nullable=True
+    )
     profile = relationship("Profile")
 
     type = Column(Enum(NotificationType), nullable=False)