format code

This commit is contained in:
grillazz
2025-07-29 17:27:56 +02:00
parent 7aace85eeb
commit 060bdb65fe
3 changed files with 13 additions and 5 deletions

View File

@@ -20,6 +20,7 @@ from app.services.auth import AuthBearer
logger = AppStructLogger().get_logger()
templates = Jinja2Templates(directory=Path(__file__).parent.parent / "templates")
@asynccontextmanager
async def lifespan(app: FastAPI):
app.redis = await get_redis()
@@ -30,12 +31,15 @@ async def lifespan(app: FastAPI):
min_size=5,
max_size=20,
)
await logger.ainfo("Postgres pool created", idle_size=app.postgres_pool.get_idle_size())
await logger.ainfo(
"Postgres pool created", idle_size=app.postgres_pool.get_idle_size()
)
yield
finally:
await app.redis.close()
await app.postgres_pool.close()
def create_app() -> FastAPI:
app = FastAPI(
title="Stuff And Nonsense API",
@@ -47,7 +51,9 @@ def create_app() -> FastAPI:
app.include_router(shakespeare_router)
app.include_router(user_router)
app.include_router(ml_router, prefix="/v1/ml", tags=["ML"])
app.include_router(health_router, prefix="/v1/public/health", tags=["Health, Public"])
app.include_router(
health_router, prefix="/v1/public/health", tags=["Health, Public"]
)
app.include_router(
health_router,
prefix="/v1/health",
@@ -61,6 +67,7 @@ def create_app() -> FastAPI:
return app
app = create_app()
# --- Unused/experimental code and TODOs ---