From d0e09d2ba567f23d91ac76d1844966bafb9b063a Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sun, 7 Jul 2024 02:29:26 +0100 Subject: Apply fixable lint settings with Ruff --- backend/routes/admin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'backend/routes/admin.py') diff --git a/backend/routes/admin.py b/backend/routes/admin.py index 0fd0700..848abce 100644 --- a/backend/routes/admin.py +++ b/backend/routes/admin.py @@ -1,6 +1,5 @@ -""" -Adds new admin user. -""" +"""Adds new admin user.""" + from pydantic import BaseModel, Field from spectree import Response from starlette.authentication import requires @@ -22,7 +21,7 @@ async def grant(request: Request) -> JSONResponse: admin = AdminModel(**data) if await request.state.db.admins.find_one( - {"_id": admin.id} + {"_id": admin.id}, ): return JSONResponse({"error": "already_exists"}, status_code=400) @@ -40,7 +39,7 @@ class AdminRoute(Route): @api.validate( json=AdminModel, resp=Response(HTTP_200=OkayResponse, HTTP_400=ErrorMessage), - tags=["admin"] + tags=["admin"], ) async def post(self, request: Request) -> JSONResponse: """Grant a user administrator privileges.""" @@ -48,6 +47,7 @@ class AdminRoute(Route): if not constants.PRODUCTION: + class AdminDev(Route): """Adds new admin user with no authentication.""" @@ -57,7 +57,7 @@ if not constants.PRODUCTION: @api.validate( json=AdminModel, resp=Response(HTTP_200=OkayResponse, HTTP_400=ErrorMessage), - tags=["admin"] + tags=["admin"], ) async def post(self, request: Request) -> JSONResponse: """ -- cgit v1.2.3