Skip to content

Commit 060bdb6

Browse files
committed
format code
1 parent 7aace85 commit 060bdb6

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

app/main.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
logger = AppStructLogger().get_logger()
2121
templates = Jinja2Templates(directory=Path(__file__).parent.parent / "templates")
2222

23+
2324
@asynccontextmanager
2425
async def lifespan(app: FastAPI):
2526
app.redis = await get_redis()
@@ -30,12 +31,15 @@ async def lifespan(app: FastAPI):
3031
min_size=5,
3132
max_size=20,
3233
)
33-
await logger.ainfo("Postgres pool created", idle_size=app.postgres_pool.get_idle_size())
34+
await logger.ainfo(
35+
"Postgres pool created", idle_size=app.postgres_pool.get_idle_size()
36+
)
3437
yield
3538
finally:
3639
await app.redis.close()
3740
await app.postgres_pool.close()
3841

42+
3943
def create_app() -> FastAPI:
4044
app = FastAPI(
4145
title="Stuff And Nonsense API",
@@ -47,7 +51,9 @@ def create_app() -> FastAPI:
4751
app.include_router(shakespeare_router)
4852
app.include_router(user_router)
4953
app.include_router(ml_router, prefix="/v1/ml", tags=["ML"])
50-
app.include_router(health_router, prefix="/v1/public/health", tags=["Health, Public"])
54+
app.include_router(
55+
health_router, prefix="/v1/public/health", tags=["Health, Public"]
56+
)
5157
app.include_router(
5258
health_router,
5359
prefix="/v1/health",
@@ -61,6 +67,7 @@ def get_index(request: Request):
6167

6268
return app
6369

70+
6471
app = create_app()
6572

6673
# --- Unused/experimental code and TODOs ---

app/schemas/stuff.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class RandomStuff(BaseModel):
1010
chaos: dict[str, Any] = Field(..., description="JSON data for chaos field")
1111

12+
1213
class StuffSchema(BaseModel):
1314
name: str = Field(
1415
title="",

app/utils/logging.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def msg(self, message):
3030
lineno=0,
3131
msg=message.rstrip("\n"),
3232
args=(),
33-
exc_info=None
33+
exc_info=None,
3434
)
3535

3636
# Check if rotation is needed before emitting
@@ -78,7 +78,7 @@ def __attrs_post_init__(self):
7878
filename=_log_path,
7979
maxBytes=10 * 1024 * 1024, # 10MB
8080
backupCount=5,
81-
encoding="utf-8"
81+
encoding="utf-8",
8282
)
8383
structlog.configure(
8484
cache_logger_on_first_use=True,
@@ -90,7 +90,7 @@ def __attrs_post_init__(self):
9090
structlog.processors.TimeStamper(fmt="iso", utc=True),
9191
structlog.processors.JSONRenderer(serializer=orjson.dumps),
9292
],
93-
logger_factory=RotatingBytesLoggerFactory(_handler)
93+
logger_factory=RotatingBytesLoggerFactory(_handler),
9494
)
9595
self._logger = structlog.get_logger()
9696

0 commit comments

Comments
 (0)