app.py:388: error: Cannot assign to a method [method-assign]
app.py:388: error: Incompatible types in assignment (expression has type "OpenTelemetryMiddleware", variable has type "Callable[[HTTPScope | WebsocketScope | LifespanScope, Callable[[], Awaitable[HTTPRequestEvent | HTTPDisconnectEvent | WebsocketConnectEvent | WebsocketReceiveEvent | WebsocketDisconnectEvent | LifespanStartupEvent | LifespanShutdownEvent]], Callable[[HTTPResponseStartEvent | HTTPResponseBodyEvent | HTTPResponseTrailersEvent | HTTPServerPushEvent | HTTPEarlyHintEvent | <10 more items>], Awaitable[None]]], Coroutine[Any, Any, None]]") [assignment]
app.py:388: note: "OpenTelemetryMiddleware.__call__" has type "Callable[[Arg(dict[str, Any], 'scope'), Arg(Callable[[], Awaitable[dict[str, Any]]], 'receive'), Arg(Callable[[dict[str, Any]], Awaitable[None]], 'send')], Coroutine[Any, Any, None]]"
The documentation in
https://quart.palletsprojects.com/en/latest/how_to_guides/middleware/
and
https://quart.palletsprojects.com/en/latest/reference/source/quart.app/#quart.app.Quart.asgi_app
says to install middleware using a pattern like:
However, following that pattern in practice produces type errors with
mypy1.15.0.After adding
and
I see:
Environment: