Browse Source

Automatic formatting commit: 2020-04-19T13:37:20.958597

Getty Ritter 4 years ago
parent
commit
9ba490e82c
1 changed files with 10 additions and 10 deletions
  1. 10 10
      lc/model.py

+ 10 - 10
lc/model.py

@@ -150,22 +150,22 @@ class User(Model):
 
     def get_tags(self) -> List[v.Tag]:
         return sorted(
-            (t.to_view() for t in self.tags), # type: ignore
+            (t.to_view() for t in self.tags),  # type: ignore
             key=lambda t: t.name,
         )
 
-    def get_related_tags(self, tag: 'Tag') -> List[v.Tag]:
+    def get_related_tags(self, tag: "Tag") -> List[v.Tag]:
         # SELECT * from has_tag t1, has_tag t2, link l WHERE t1.link_id == l.id AND t2.link_id == l.id AND t1.id != t2.id AND t1 = self
         SelfTag = HasTag.alias()
-        query = (HasTag.select(HasTag.tag)
-                 .join(Link, on=(HasTag.link == Link.id))
-                 .join(SelfTag, on=(SelfTag.link == Link.id))
-                 .where((SelfTag.tag == tag) & (SelfTag.id != HasTag.id))
-                 .group_by(HasTag.tag))
-        return sorted(
-            (t.tag.to_view() for t in query),
-            key=lambda t: t.name,
+        query = (
+            HasTag.select(HasTag.tag)
+            .join(Link, on=(HasTag.link == Link.id))
+            .join(SelfTag, on=(SelfTag.link == Link.id))
+            .where((SelfTag.tag == tag) & (SelfTag.id != HasTag.id))
+            .group_by(HasTag.tag)
         )
+        return sorted((t.tag.to_view() for t in query), key=lambda t: t.name,)
+
 
 class Link(Model):
     """