chore(typing): declare the mid-conversation type aliases with TypeAlias

The Final sweep tightened LIT010, which exempts TypeAlias declarations but
counts a bare alias assignment as an unannotated binding.
This commit is contained in:
Shifat Islam Santo 2026-08-26 16:49:48 -05:00
parent d2c3d07267
commit 6e1e44ce41
2 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,7 @@ import re
import xml.etree.ElementTree as ET
from collections.abc import Iterator, Mapping, Sequence
from enum import Enum
from typing import Any, Final, TypedDict, cast, overload
from typing import Any, Final, TypeAlias, TypedDict, cast, overload
from jinja2.sandbox import ImmutableSandboxedEnvironment
@ -2307,7 +2307,7 @@ def _drop_unsignable_thinking_blocks(
# mutable-ok: anthropic_messages_pt's callers have always appended to the list it returns
_AnthropicMessageList = list[AllAnthropicPassThroughMessageValues]
_AnthropicMessageList: TypeAlias = list[AllAnthropicPassThroughMessageValues]
def anthropic_messages_pt(

View file

@ -26,7 +26,7 @@ Anthropic wire shape is built later by ``anthropic_messages_pt``.
from collections.abc import Iterator, Mapping, Sequence
from itertools import groupby
from typing import Final, Literal
from typing import Final, Literal, TypeAlias
from litellm.types.llms.anthropic import AnthropicMessagesSystemMessageParam, AnthropicSystemMessageContent
from litellm.types.llms.openai import (
@ -44,8 +44,8 @@ CONVERTED_SYSTEM_NOTE: Final = (
_USER_TYPE_ROLES: Final = frozenset({"user", "tool", "function"})
_TOOL_ROLES: Final = frozenset({"tool", "function"})
_MessageKind = Literal["system", "tool", "user", "other"]
_TextPart = tuple[str, ChatCompletionCachedContent | None]
_MessageKind: TypeAlias = Literal["system", "tool", "user", "other"]
_TextPart: TypeAlias = tuple[str, ChatCompletionCachedContent | None]
def _as_mapping(value: object) -> Mapping[str, object] | None: