fixed linting

This commit is contained in:
shivam 2026-04-17 16:36:34 -07:00
parent 7020b0a64b
commit 733ccd6e09
No known key found for this signature in database

View file

@ -2,7 +2,7 @@
Prometheus Auth Middleware - Pure ASGI implementation
"""
import json
from typing import List
from typing import Any, List, MutableMapping
from fastapi import Request
from starlette.types import ASGIApp, Receive, Scope, Send
@ -43,9 +43,9 @@ class PrometheusAuthMiddleware:
# user_api_key_auth reads the request body, which consumes ASGI `receive`.
# Buffer those messages and replay them for the inner app; otherwise a
# successful auth would forward an exhausted receive and /metrics hangs.
buffered_messages: List[dict] = []
buffered_messages: List[MutableMapping[str, Any]] = []
async def receive_for_auth() -> dict:
async def receive_for_auth() -> MutableMapping[str, Any]:
message = await receive()
buffered_messages.append(message)
return message
@ -81,7 +81,7 @@ class PrometheusAuthMiddleware:
replay_idx = 0
async def receive_replay() -> dict:
async def receive_replay() -> MutableMapping[str, Any]:
nonlocal replay_idx
if replay_idx < len(buffered_messages):
msg = buffered_messages[replay_idx]