You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that the type annotations I suggested for apps are causing mypy to raise errors because app can be either an ASGI application (awaitable) or a WSGI application (non-awaitable). This leads to type inconsistencies when attempting to await app(scope, receive, send).
To address this, we can adjust the type annotations to accurately reflect the possible types of app and modify the code to handle both cases explicitly. Here's a revised approach:
This way, we explicitly check if app is an awaitable ASGI application or a regular WSGI application and handle each case accordingly. This should resolve the mypy errors by ensuring type consistency.
Let me know if this helps or if you have further questions.
@coderabbitai mentioned at #560 (comment):
It appears that the type annotations I suggested for
apps
are causing mypy to raise errors becauseapp
can be either an ASGI application (awaitable) or a WSGI application (non-awaitable). This leads to type inconsistencies when attempting toawait app(scope, receive, send)
.To address this, we can adjust the type annotations to accurately reflect the possible types of
app
and modify the code to handle both cases explicitly. Here's a revised approach:Update the type annotations:
Modify the
__call__
method to handle both ASGI and WSGI apps:This way, we explicitly check if
app
is an awaitable ASGI application or a regular WSGI application and handle each case accordingly. This should resolve the mypy errors by ensuring type consistency.Let me know if this helps or if you have further questions.
Originally posted by @coderabbitai[bot] in #560 (comment)
The text was updated successfully, but these errors were encountered: