Browse Source

Automatic formatting commit: 2020-04-07T20:13:33.317653

Getty Ritter 4 years ago
parent
commit
dd21ce72aa
3 changed files with 12 additions and 5 deletions
  1. 7 1
      lc/app.py
  2. 4 0
      lc/error.py
  3. 1 4
      scripts/populate.py

+ 7 - 1
lc/app.py

@@ -25,15 +25,21 @@ def handle_errors(func):
         try:
             return func(*args, **kwargs)
         except e.LCException as exn:
-            return render("main", title="error", content=f"shit's fucked yo: {exn}"), 500
+            return (
+                render("main", title="error", content=f"shit's fucked yo: {exn}"),
+                500,
+            )
+
     __wrapped__.__name__ = func.__name__
     return __wrapped__
 
+
 @app.route("/")
 @handle_errors
 def index():
     return render("main", title="main", content="whoo")
 
+
 @app.route("/auth", methods=["POST"])
 @handle_errors
 def auth():

+ 4 - 0
lc/error.py

@@ -1,9 +1,11 @@
 from dataclasses import dataclass
 
+
 class LCException(Exception):
     def to_json(self) -> dict:
         return {"error": str(self)}
 
+
 @dataclass
 class UserExists(LCException):
     name: str
@@ -11,6 +13,7 @@ class UserExists(LCException):
     def __str__(self):
         return f"A user named {self.name} already exists."
 
+
 @dataclass
 class NoSuchUser(LCException):
     name: str
@@ -18,6 +21,7 @@ class NoSuchUser(LCException):
     def __str__(self):
         return f"No user named {self.name} exists."
 
+
 @dataclass
 class BadPassword(LCException):
     name: str

+ 1 - 4
scripts/populate.py

@@ -13,10 +13,7 @@ def main():
 
     u = m.User.get_or_none(name="gdritter")
     if not u:
-        u = m.User.from_request(r.User(
-            name="gdritter",
-            password="behest",
-        ))
+        u = m.User.from_request(r.User(name="gdritter", password="behest",))
 
     with open("scripts/aisamanra.json") as f:
         links = json.load(f)