From e747b4d6ce383301ded1d8f93569f15bfae0e04b Mon Sep 17 00:00:00 2001 From: vrlo Date: Mon, 20 Jul 2026 16:07:28 +0200 Subject: [PATCH] fix(azure_ai): annotate cast() with cast-ok reason for LIT006 budget The PR's unchecked cast(dict, message) added a LIT006 violation (type_discipline_gate.py), pushing the LIT006 total to 1117 over the 1111 ceiling. This gate runs after the UP006 gate and was not reached in prior runs because the UP006 gate failed first; now that UP006 passes it runs and catches this. Add a cast-ok suppression with a reason, as the gate requires (AllMessageValues is a union of TypedDicts and pop/strip need a mutable mapping). --- litellm/llms/azure_ai/chat/transformation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/azure_ai/chat/transformation.py b/litellm/llms/azure_ai/chat/transformation.py index 96e9f489715..6e3e6b7779a 100644 --- a/litellm/llms/azure_ai/chat/transformation.py +++ b/litellm/llms/azure_ai/chat/transformation.py @@ -70,7 +70,7 @@ def _strip_unsupported_message_fields(message: AllMessageValues) -> None: the adapter attaches inside ``tool_calls[].function``) are stripped recursively so nested tool-call signatures are removed too. """ - m = cast(dict, message) + m = cast(dict, message) # cast-ok: AllMessageValues is a union of TypedDicts; pop/strip need a mutable mapping for field in _RECURSIVELY_STRIPPED_FIELDS: filter_value_from_dict(m, field) for field in _TOP_LEVEL_OUTPUT_ONLY_FIELDS: