From c903266ec40d910f930213b9206ada3bcf05c9b5 Mon Sep 17 00:00:00 2001 From: creyD <15138480+creyD@users.noreply.github.com> Date: Thu, 3 Apr 2025 07:45:38 +0000 Subject: [PATCH] Adjusted files for isort & autopep --- creyPY/fastapi/crud.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/creyPY/fastapi/crud.py b/creyPY/fastapi/crud.py index 57a8bff..7ee3a2a 100644 --- a/creyPY/fastapi/crud.py +++ b/creyPY/fastapi/crud.py @@ -53,24 +53,22 @@ def get_object_or_404( query = select(*selected_columns).where(getattr(db_class, lookup_column) == id) result = await db.execute(query) row = result.first() - + if row is None: raise HTTPException(status_code=404, detail="The object does not exist.") if hasattr(row, "_mapping"): obj_dict = dict(row._mapping) else: - obj_dict = {column.key: getattr(row, column.key) - for column in selected_columns} + obj_dict = {column.key: getattr(row, column.key) for column in selected_columns} else: query = select(db_class).where(getattr(db_class, lookup_column) == id) result = await db.execute(query) row = result.scalar_one_or_none() - + if row is None: raise HTTPException(status_code=404, detail="The object does not exist.") - - obj_dict = {k: v for k, v in row.__dict__.items() - if not k.startswith('_')} + + obj_dict = {k: v for k, v in row.__dict__.items() if not k.startswith("_")} if expunge: await db.expunge(obj_dict) return obj_dict