mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-08 22:21:35 +00:00
fixed linting
This commit is contained in:
parent
7020b0a64b
commit
733ccd6e09
1 changed files with 4 additions and 4 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue