From 13f889555d12cbdebf03194ddcb6f9a76585ed5f Mon Sep 17 00:00:00 2001 From: lior-k Date: Sun, 5 Jul 2026 16:29:41 +0300 Subject: [PATCH] chore(guardrails): satisfy new base BLE001 and LIT004/LIT009 gates The base added BLE001 (blind-except) to the strict ruleset and LIT004/LIT009 to the type-discipline checker. Suppress the intentional best-effort get_llm_provider catch with a reasoned noqa (BLE001 is in ruff external so RUF100 keeps it), and drop the inert type: ignore from the optional wonderfence_sdk imports (dead under enableTypeIgnoreComments=false; LIT009) in favor of pyright: ignore with a reason (LIT004). --- .../guardrail_hooks/alice_wonderfence/alice_wonderfence.py | 2 +- .../guardrail_hooks/alice_wonderfence/client_cache.py | 6 +++--- .../guardrail_hooks/alice_wonderfence/processing.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/alice_wonderfence.py b/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/alice_wonderfence.py index 10ae49ccc51..acdb5a0253d 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/alice_wonderfence.py +++ b/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/alice_wonderfence.py @@ -38,7 +38,7 @@ from .processing import ( ) if TYPE_CHECKING: - from wonderfence_sdk.client import ( # type: ignore[import-untyped] # pyright: ignore[reportMissingTypeStubs] + from wonderfence_sdk.client import ( # pyright: ignore[reportMissingTypeStubs] # wonderfence_sdk ships no type stubs WonderFenceV2Client as _WonderFenceV2Client, ) diff --git a/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/client_cache.py b/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/client_cache.py index a81d00c9216..bfcd423992e 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/client_cache.py +++ b/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/client_cache.py @@ -5,7 +5,7 @@ from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Callable if TYPE_CHECKING: - from wonderfence_sdk.client import ( # type: ignore[import-untyped] # pyright: ignore[reportMissingTypeStubs] + from wonderfence_sdk.client import ( # pyright: ignore[reportMissingTypeStubs] # wonderfence_sdk ships no type stubs WonderFenceV2Client as _WonderFenceV2Client, ) @@ -30,10 +30,10 @@ def load_sdk() -> tuple[Any, Any]: on the instance so per-call hot paths don't re-trigger the import machinery. """ try: - from wonderfence_sdk.client import ( # type: ignore[import-untyped] # pyright: ignore[reportMissingTypeStubs] + from wonderfence_sdk.client import ( # pyright: ignore[reportMissingTypeStubs] # wonderfence_sdk ships no type stubs WonderFenceV2Client, ) - from wonderfence_sdk.models import ( # type: ignore[import-untyped] # pyright: ignore[reportMissingTypeStubs] + from wonderfence_sdk.models import ( # pyright: ignore[reportMissingTypeStubs] # wonderfence_sdk ships no type stubs AnalysisContext, ) except ImportError as e: diff --git a/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/processing.py b/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/processing.py index a44da75c463..c63945b5bac 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/processing.py +++ b/litellm/proxy/guardrails/guardrail_hooks/alice_wonderfence/processing.py @@ -27,7 +27,7 @@ def build_analysis_context( if model_str: try: model_name, provider, _, _ = litellm.get_llm_provider(model=model_str) - except Exception: + except Exception: # noqa: BLE001 # best-effort provider parse for telemetry; any failure falls back to manual split and must never break the guardrail if "/" in model_str: provider, model_name = model_str.split("/", 1)