style: satisfy strict-rule budget (ANN201, ANN401, TID251)

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.
This commit is contained in:
Conduct AI 2026-09-10 20:18:52 -05:00
parent e39709a673
commit 2e1f320192
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View file

@ -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:

View file

@ -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)