From 2e1f32019277a966ba709f6557432053c3ded4da Mon Sep 17 00:00:00 2001 From: Conduct AI Date: Thu, 10 Sep 2026 20:18:52 -0500 Subject: [PATCH] style: satisfy strict-rule budget (ANN201, ANN401, TID251) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BerriAI/litellm CI's ruff strict-rule budget check flagged four new violations on the conduct shim. Fixes: - __init__.py: add return type annotation on initialize_guardrail (ANN201) - conduct.py: swap Any → object on __init__(*args, **kwargs) so the signature stays permissive without dynamically-typed Any (ANN401) - conduct.py: drop the now-unused Any import (TID251) Ruff --select ANN,TID passes locally. --- litellm/proxy/guardrails/guardrail_hooks/conduct/__init__.py | 2 +- litellm/proxy/guardrails/guardrail_hooks/conduct/conduct.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/conduct/__init__.py b/litellm/proxy/guardrails/guardrail_hooks/conduct/__init__.py index 52c2ae0db61..2a056ab5b6c 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/conduct/__init__.py +++ b/litellm/proxy/guardrails/guardrail_hooks/conduct/__init__.py @@ -16,7 +16,7 @@ _DEFAULT_TIMEOUT_SECONDS = 8.0 _DEFAULT_UNREACHABLE_FALLBACK = "fail_closed" -def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail"): +def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail") -> ConductGuardrail: """Initialize the Conduct guardrail from LiteLLM's config block. Maps LiteLLM's typed guardrail fields onto the Conduct constructor: diff --git a/litellm/proxy/guardrails/guardrail_hooks/conduct/conduct.py b/litellm/proxy/guardrails/guardrail_hooks/conduct/conduct.py index 8d010b6673e..a3a872c3035 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/conduct/conduct.py +++ b/litellm/proxy/guardrails/guardrail_hooks/conduct/conduct.py @@ -13,7 +13,7 @@ Docs: https://conductai.ai/guard from __future__ import annotations -from typing import Any, ClassVar +from typing import ClassVar from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.types.guardrails import GuardrailEventHooks @@ -75,7 +75,7 @@ class ConductGuardrail(_ParentClass): # type: ignore[valid-type,misc] # configurations — see veria-ai finding on BerriAI/litellm#38143. SUPPORTED_EVENT_HOOKS: ClassVar[tuple[GuardrailEventHooks, ...]] = (GuardrailEventHooks.pre_call,) - def __init__(self, *args: Any, **kwargs: Any) -> None: + def __init__(self, *args: object, **kwargs: object) -> None: if _IMPORT_ERROR is not None or _BaseConductGuard is None: raise ImportError(_IMPORT_ERROR_MESSAGE) from _IMPORT_ERROR super().__init__(*args, **kwargs)