mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2026-03-06 10:00:39 +03:00
style: clean up code formatting and add missing newline in profiler.py
This commit is contained in:
@@ -15,7 +15,7 @@ router = APIRouter()
|
|||||||
@router.get("/redis", status_code=status.HTTP_200_OK)
|
@router.get("/redis", status_code=status.HTTP_200_OK)
|
||||||
async def redis_check(
|
async def redis_check(
|
||||||
request: Request,
|
request: Request,
|
||||||
pyprofile: Annotated[
|
pyprofile: Annotated[ # noqa: ARG001
|
||||||
bool, Query(description="Enable profiler for this request")
|
bool, Query(description="Enable profiler for this request")
|
||||||
] = False,
|
] = False,
|
||||||
):
|
):
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ async def lifespan(app: FastAPI):
|
|||||||
|
|
||||||
|
|
||||||
middleware = [
|
middleware = [
|
||||||
Middleware(GZipMiddleware),
|
Middleware(GZipMiddleware),
|
||||||
Middleware(ProfilingMiddleware),
|
Middleware(ProfilingMiddleware),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def create_app() -> FastAPI:
|
def create_app() -> FastAPI:
|
||||||
@@ -78,8 +78,6 @@ def create_app() -> FastAPI:
|
|||||||
# Register exception handlers
|
# Register exception handlers
|
||||||
register_exception_handlers(app)
|
register_exception_handlers(app)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/index", response_class=HTMLResponse)
|
@app.get("/index", response_class=HTMLResponse)
|
||||||
def get_index(request: Request):
|
def get_index(request: Request):
|
||||||
return templates.TemplateResponse("index.html", {"request": request})
|
return templates.TemplateResponse("index.html", {"request": request})
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ class ProfilingMiddleware(BaseHTTPMiddleware):
|
|||||||
headers={"Content-Disposition": "attachment; filename=profile.html"},
|
headers={"Content-Disposition": "attachment; filename=profile.html"},
|
||||||
)
|
)
|
||||||
|
|
||||||
return await call_next(request)
|
return await call_next(request)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ from app.redis import get_redis
|
|||||||
def anyio_backend(request):
|
def anyio_backend(request):
|
||||||
return request.param
|
return request.param
|
||||||
|
|
||||||
|
|
||||||
def _create_db(conn) -> None:
|
def _create_db(conn) -> None:
|
||||||
"""Create the test database if it doesn't exist."""
|
"""Create the test database if it doesn't exist."""
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user