From cb9e775d91e76bac06c3e186a32bbe2ac98df582 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Sun, 8 Mar 2026 09:16:21 +0100 Subject: [PATCH 1/2] Fixed linter error: UP007 --- src/models/responses.py | 6 +++--- src/utils/conversations.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/models/responses.py b/src/models/responses.py index 946a71fbf..9f87759a5 100644 --- a/src/models/responses.py +++ b/src/models/responses.py @@ -2,7 +2,7 @@ """Models for REST API responses.""" -from typing import Any, ClassVar, Literal, Optional, Union +from typing import Any, ClassVar, Literal, Optional from fastapi import status from llama_stack_api.openai_responses import ( @@ -318,11 +318,11 @@ class ProviderResponse(AbstractSuccessfulResponse): ..., description="The API this provider implements", ) - config: dict[str, Union[bool, float, str, list[Any], object, None]] = Field( + config: dict[str, bool | float | str | list[Any] | object | None] = Field( ..., description="Provider configuration parameters", ) - health: dict[str, Union[bool, float, str, list[Any], object, None]] = Field( + health: dict[str, bool | float | str | list[Any] | object | None] = Field( ..., description="Current health status of the provider", ) diff --git a/src/utils/conversations.py b/src/utils/conversations.py index 577c3fce7..561a87afb 100644 --- a/src/utils/conversations.py +++ b/src/utils/conversations.py @@ -2,7 +2,7 @@ import json from datetime import UTC, datetime -from typing import Any, Optional, Union, cast +from typing import Any, Optional, cast from llama_stack_api.openai_responses import ( OpenAIResponseOutputMessageFileSearchToolCall as FileSearchCall, @@ -26,7 +26,7 @@ from utils.types import ToolCallSummary, ToolResultSummary -def _extract_text_from_content(content: Union[str, list[Any]]) -> str: +def _extract_text_from_content(content: str | list[Any]) -> str: """Extract text content from message content. Args: From f8c83fbd5d60f22ba54328d2e9e959adb15a1f07 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Sun, 8 Mar 2026 09:16:34 +0100 Subject: [PATCH 2/2] Enable new Ruff rule: UP007 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e7db92c67..1ea2f60bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -223,7 +223,7 @@ disable = ["R0801"] extend-exclude = ["tests/profiles/syntax_error.py"] [tool.ruff.lint] -extend-select = ["TID251", "UP006", "RUF100"] +extend-select = ["TID251", "UP006", "UP007", "RUF100"] [tool.ruff.lint.flake8-tidy-imports.banned-api] unittest = { msg = "use pytest instead of unittest" }