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]

fix lint review feedback

HUAHAODIAb71eff40f8f3
diff --git a/litellm/litellm_core_utils/coroutine_checker.py b/litellm/litellm_core_utils/coroutine_checker.py
index 9e15b4e870d..7b9a650c66b 100644
--- a/litellm/litellm_core_utils/coroutine_checker.py
+++ b/litellm/litellm_core_utils/coroutine_checker.py
@@ -36,9 +36,7 @@ class CoroutineChecker:
target = callback
if not inspect.isfunction(target) and not inspect.ismethod(target):
try:
- # Value unwrap so iscoroutinefunction can see through functors;
- # B004's callable() advice does not apply here.
- call_attr: Final = getattr(target, "__call__", None) # noqa: B004
+ call_attr: Final = getattr(target, "__call__", None) # noqa: B004 # value unwrap so iscoroutinefunction sees through functors
if call_attr is not None:
target = call_attr
except Exception:
diff --git a/litellm/proxy/management_helpers/team_metadata_validation.py b/litellm/proxy/management_helpers/team_metadata_validation.py
index 31960442b24..98edb4fb692 100644
--- a/litellm/proxy/management_helpers/team_metadata_validation.py
+++ b/litellm/proxy/management_helpers/team_metadata_validation.py
@@ -115,16 +115,16 @@ async def run_team_metadata_validation(
"error": f"custom_team_metadata_validate is an Enterprise feature. {CommonProxyErrors.not_premium_user.value}"
},
)
- # Value unwrap so iscoroutinefunction can see through functors;
- # B004's callable() advice does not apply here.
- validator_call = getattr(validator, "__call__", None) # noqa: B004
- if not (inspect.iscoroutinefunction(validator) or inspect.iscoroutinefunction(validator_call)):
- raise HTTPException(
- status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
- detail={ # mutable-ok: HTTPException.detail has no immutable form
- "error": "custom_team_metadata_validate must be an async function"
- },
- )
+ if not inspect.iscoroutinefunction(validator):
+ # Value unwrap so iscoroutinefunction can see through functors; not a callability test
+ validator_call = getattr(validator, "__call__", None) # noqa: B004 # value unwrap for functor check
+ if not inspect.iscoroutinefunction(validator_call):
+ raise HTTPException(
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
+ detail={ # mutable-ok: HTTPException.detail has no immutable form
+ "error": "custom_team_metadata_validate must be an async function"
+ },
+ )
try:
raw_result: Final = await asyncio.wait_for(validator(payload), timeout=timeout_seconds)