From 631aa1a353cb8a632ec72937518995503a116f13 Mon Sep 17 00:00:00 2001 From: mutnale_sushant Date: Wed, 16 Sep 2026 08:21:07 +0530 Subject: [PATCH] fix(param_utils): resolve type-discipline and basedpyright violations in custom_logger_registry --- .../custom_logger_registry.py | 30 +++++++++++-------- .../test_litellm/test_openai_params_strip.py | 4 +-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/litellm/litellm_core_utils/custom_logger_registry.py b/litellm/litellm_core_utils/custom_logger_registry.py index b970426f21c..76d6093f55c 100644 --- a/litellm/litellm_core_utils/custom_logger_registry.py +++ b/litellm/litellm_core_utils/custom_logger_registry.py @@ -10,7 +10,9 @@ Example: from typing import Union -from litellm import _custom_logger_compatible_callbacks_literal +from litellm import ( + _custom_logger_compatible_callbacks_literal, # pyright: ignore[reportPrivateUsage] # internal type alias +) from litellm.integrations.agentops import AgentOps from litellm.integrations.anthropic_cache_control_hook import AnthropicCacheControlHook from litellm.integrations.argilla import ArgillaLogger @@ -51,8 +53,12 @@ from litellm.integrations.sqs import SQSLogger from litellm.integrations.vector_store_integrations.vector_store_pre_call_hook import ( VectorStorePreCallHook, ) -from litellm.proxy.hooks.dynamic_rate_limiter import _PROXY_DynamicRateLimitHandler -from litellm.proxy.hooks.dynamic_rate_limiter_v3 import _PROXY_DynamicRateLimitHandlerV3 +from litellm.proxy.hooks.dynamic_rate_limiter import ( + _PROXY_DynamicRateLimitHandler, # pyright: ignore[reportPrivateUsage] # internal handler type +) +from litellm.proxy.hooks.dynamic_rate_limiter_v3 import ( + _PROXY_DynamicRateLimitHandlerV3, # pyright: ignore[reportPrivateUsage] # internal handler type +) class CustomLoggerRegistry: @@ -111,24 +117,24 @@ class CustomLoggerRegistry: } try: - from litellm_enterprise.enterprise_callbacks.pagerduty.pagerduty import ( - PagerDutyAlerting, + from litellm_enterprise.enterprise_callbacks.pagerduty.pagerduty import ( # pyright: ignore[reportMissingImports] # optional enterprise dependency + PagerDutyAlerting, # pyright: ignore[reportUnknownVariableType] # optional enterprise dependency ) - from litellm_enterprise.enterprise_callbacks.send_emails.resend_email import ( - ResendEmailLogger, + from litellm_enterprise.enterprise_callbacks.send_emails.resend_email import ( # pyright: ignore[reportMissingImports] # optional enterprise dependency + ResendEmailLogger, # pyright: ignore[reportUnknownVariableType] # optional enterprise dependency ) - from litellm_enterprise.enterprise_callbacks.send_emails.sendgrid_email import ( - SendGridEmailLogger, + from litellm_enterprise.enterprise_callbacks.send_emails.sendgrid_email import ( # pyright: ignore[reportMissingImports] # optional enterprise dependency + SendGridEmailLogger, # pyright: ignore[reportUnknownVariableType] # optional enterprise dependency ) - from litellm_enterprise.enterprise_callbacks.send_emails.smtp_email import ( - SMTPEmailLogger, + from litellm_enterprise.enterprise_callbacks.send_emails.smtp_email import ( # pyright: ignore[reportMissingImports] # optional enterprise dependency + SMTPEmailLogger, # pyright: ignore[reportUnknownVariableType] # optional enterprise dependency ) from litellm.integrations.generic_api.generic_api_callback import ( GenericAPILogger, ) - enterprise_loggers = { + enterprise_loggers: dict[str, type[object]] = { # mutable-ok: enterprise callback mapping "pagerduty": PagerDutyAlerting, "generic_api": GenericAPILogger, "resend_email": ResendEmailLogger, diff --git a/tests/test_litellm/test_openai_params_strip.py b/tests/test_litellm/test_openai_params_strip.py index a558470823b..50521afb4b2 100644 --- a/tests/test_litellm/test_openai_params_strip.py +++ b/tests/test_litellm/test_openai_params_strip.py @@ -30,8 +30,8 @@ async def clear_client_cache(): try: await GLOBAL_LOGGING_WORKER.clear_queue() - except Exception: - pass + except Exception as exc: + _ = exc @pytest.mark.asyncio