From e9f89175aac06562ec1877ec76afefe6b44250bf Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Oct 2026 01:31:28 +0000 Subject: [PATCH] style(router): annotate the facade's special methods and re-anchor a moved suppression The facade's __init__/__getattr__/__setattr__/__delattr__ added four ANN204 violations, and formatting python_router.py moved a rebind-ok comment off the line it suppresses (LIT013). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Aw1xktpUnix5tWhvSzey8t --- litellm/router.py | 8 ++++---- litellm/router_backends/python_router.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/litellm/router.py b/litellm/router.py index be029dbd089..d0f911bfdc3 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -57,20 +57,20 @@ class Router(_RouterSurface): if not TYPE_CHECKING: - def __init__(self, *args, **kwargs): # kwargs-ok: forwards PythonRouter.__init__'s signature + def __init__(self, *args, **kwargs) -> None: # kwargs-ok: forwards PythonRouter.__init__'s signature object.__setattr__(self, "backend", select_backend(args, kwargs)) __init__.__signature__ = inspect.signature(PythonRouter.__init__) - def __getattr__(self, name): + def __getattr__(self, name: str) -> object: if name == "backend": raise AttributeError(name) return getattr(self.backend, name) - def __setattr__(self, name, value): + def __setattr__(self, name: str, value: object) -> None: setattr(self.backend, name, value) - def __delattr__(self, name): + def __delattr__(self, name: str) -> None: delattr(self.backend, name) diff --git a/litellm/router_backends/python_router.py b/litellm/router_backends/python_router.py index cf66dab37ed..9263414877d 100644 --- a/litellm/router_backends/python_router.py +++ b/litellm/router_backends/python_router.py @@ -3559,8 +3559,8 @@ class PythonRouter: self._ageneric_api_call_with_fallbacks_responses_attempt ) if e.generated_content and not e.is_pre_first_chunk: - initial_kwargs["input"] = ( - PythonRouter._build_responses_continuation_input( # rebind-ok: fallback hop input + initial_kwargs["input"] = ( # rebind-ok: fallback hop input + PythonRouter._build_responses_continuation_input( initial_kwargs.get("input"), e.generated_content, )