From 4d90ac5d569636d4923475e6544dd1f1651c9e4e Mon Sep 17 00:00:00 2001 From: Mads Bisgaard Date: Tue, 19 Nov 2024 11:05:58 +0100 Subject: [PATCH] ensure type hints are correct in profiling middleware --- .../src/servicelib/fastapi/profiler_middleware.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/service-library/src/servicelib/fastapi/profiler_middleware.py b/packages/service-library/src/servicelib/fastapi/profiler_middleware.py index cdf8c77206b..43c46c7ba9d 100644 --- a/packages/service-library/src/servicelib/fastapi/profiler_middleware.py +++ b/packages/service-library/src/servicelib/fastapi/profiler_middleware.py @@ -1,9 +1,9 @@ from typing import Any, Final -from fastapi import FastAPI from servicelib.aiohttp import status from servicelib.mimetype_constants import MIMETYPE_APPLICATION_JSON from starlette.requests import Request +from starlette.types import ASGIApp, Receive, Scope, Send from ..utils_profiling_middleware import ( _is_profiling, @@ -31,11 +31,11 @@ class ProfilerMiddleware: https://fastapi.tiangolo.com/advanced/middleware/#advanced-middleware """ - def __init__(self, app: FastAPI): - self._app: FastAPI = app + def __init__(self, app: ASGIApp): + self._app = app self._profile_header_trigger: Final[str] = "x-profile" - async def __call__(self, scope, receive, send): + async def __call__(self, scope: Scope, receive: Receive, send: Send): if scope["type"] != "http": await self._app(scope, receive, send) return