format and lint

This commit is contained in:
grillazz 2025-08-23 20:04:45 +02:00
parent e2f01f89c5
commit 700a2d49a6
3 changed files with 8 additions and 8 deletions

View File

@ -1,9 +1,9 @@
from collections.abc import AsyncGenerator from collections.abc import AsyncGenerator
from fastapi.exceptions import ResponseValidationError
from rotoger import AppStructLogger from rotoger import AppStructLogger
from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from fastapi.exceptions import ResponseValidationError
from app.config import settings as global_settings from app.config import settings as global_settings

View File

@ -1,12 +1,13 @@
import orjson import orjson
from fastapi import FastAPI, Request from fastapi import FastAPI, Request
from fastapi.exceptions import ResponseValidationError
from fastapi.responses import JSONResponse from fastapi.responses import JSONResponse
from rotoger import AppStructLogger from rotoger import AppStructLogger
from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.exc import SQLAlchemyError
from fastapi.exceptions import ResponseValidationError
logger = AppStructLogger().get_logger() logger = AppStructLogger().get_logger()
# TODO: add reasoning for this in readme plus higligh using re-raise in db session # TODO: add reasoning for this in readme plus higligh using re-raise in db session
async def sqlalchemy_exception_handler( async def sqlalchemy_exception_handler(
request: Request, exc: SQLAlchemyError request: Request, exc: SQLAlchemyError
@ -76,4 +77,6 @@ async def response_validation_exception_handler(
def register_exception_handlers(app: FastAPI) -> None: def register_exception_handlers(app: FastAPI) -> None:
"""Register all exception handlers with the FastAPI app.""" """Register all exception handlers with the FastAPI app."""
app.add_exception_handler(SQLAlchemyError, sqlalchemy_exception_handler) app.add_exception_handler(SQLAlchemyError, sqlalchemy_exception_handler)
app.add_exception_handler(ResponseValidationError, response_validation_exception_handler) app.add_exception_handler(
ResponseValidationError, response_validation_exception_handler
)

View File

@ -1,6 +1,5 @@
import uuid import uuid
from fastapi import HTTPException, status
from sqlalchemy import String, select from sqlalchemy import String, select
from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.ext.asyncio import AsyncSession
@ -25,5 +24,3 @@ class Nonsense(Base):
result = await db_session.execute(stmt) result = await db_session.execute(stmt)
instance = result.scalars().first() instance = result.scalars().first()
return instance return instance