Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

style(spend): satisfy ruff format on key metadata recovery

Cursor Agentfd520e53abba
diff --git a/litellm/proxy/spend_tracking/key_metadata_recovery.py b/litellm/proxy/spend_tracking/key_metadata_recovery.py
index 7ad1c77ff57..33339f16d52 100644
--- a/litellm/proxy/spend_tracking/key_metadata_recovery.py
+++ b/litellm/proxy/spend_tracking/key_metadata_recovery.py
@@ -1,4 +1,5 @@
-from collections.abc import Mapping, Sequence, Set as AbstractSet
+from collections.abc import Mapping, Sequence
+from collections.abc import Set as AbstractSet
from typing import Final, Protocol
from typing_extensions import TypedDict
@@ -149,9 +150,7 @@ async def _spend_logs_key_metadata(
"user_email": row.get("user_email"),
}
for row in spend_log_rows
- if isinstance(row, dict)
- and isinstance(row.get("api_key"), str)
- and row["api_key"] in wanted
+ if isinstance(row, dict) and isinstance(row.get("api_key"), str) and row["api_key"] in wanted
}
@@ -162,9 +161,7 @@ async def _emails_for_user_ids(
if not user_ids:
return {}
try:
- users: Final = await UserRepository(prisma_client).table.find_many(
- where={"user_id": {"in": list(user_ids)}}
- )
+ users: Final = await UserRepository(prisma_client).table.find_many(where={"user_id": {"in": list(user_ids)}})
except Exception as e:
verbose_proxy_logger.warning(
"Failed user_email recovery for %d user ids: %s",