Skip to content

Commit 700a2d4

Browse files
committed
format and lint
1 parent e2f01f8 commit 700a2d4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

app/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from collections.abc import AsyncGenerator
22

3+
from fastapi.exceptions import ResponseValidationError
34
from rotoger import AppStructLogger
45
from sqlalchemy.exc import SQLAlchemyError
56
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
6-
from fastapi.exceptions import ResponseValidationError
77

88
from app.config import settings as global_settings
99

app/exception_handlers.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import orjson
22
from fastapi import FastAPI, Request
3+
from fastapi.exceptions import ResponseValidationError
34
from fastapi.responses import JSONResponse
45
from rotoger import AppStructLogger
56
from sqlalchemy.exc import SQLAlchemyError
6-
from fastapi.exceptions import ResponseValidationError
77

88
logger = AppStructLogger().get_logger()
99

10-
#TODO: add reasoning for this in readme plus higligh using re-raise in db session
10+
11+
# TODO: add reasoning for this in readme plus higligh using re-raise in db session
1112
async def sqlalchemy_exception_handler(
1213
request: Request, exc: SQLAlchemyError
1314
) -> JSONResponse:
@@ -32,7 +33,7 @@ async def sqlalchemy_exception_handler(
3233

3334

3435
async def response_validation_exception_handler(
35-
request: Request, exc: ResponseValidationError
36+
request: Request, exc: ResponseValidationError
3637
) -> JSONResponse:
3738
request_path = request.url.path
3839
try:
@@ -76,4 +77,6 @@ async def response_validation_exception_handler(
7677
def register_exception_handlers(app: FastAPI) -> None:
7778
"""Register all exception handlers with the FastAPI app."""
7879
app.add_exception_handler(SQLAlchemyError, sqlalchemy_exception_handler)
79-
app.add_exception_handler(ResponseValidationError, response_validation_exception_handler)
80+
app.add_exception_handler(
81+
ResponseValidationError, response_validation_exception_handler
82+
)

app/models/nonsense.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import uuid
22

3-
from fastapi import HTTPException, status
43
from sqlalchemy import String, select
54
from sqlalchemy.dialects.postgresql import UUID
65
from sqlalchemy.ext.asyncio import AsyncSession
@@ -25,5 +24,3 @@ async def get_by_name(cls, db_session: AsyncSession, name: str):
2524
result = await db_session.execute(stmt)
2625
instance = result.scalars().first()
2726
return instance
28-
29-

0 commit comments

Comments
 (0)