refactor: replace bare dict with dict[str, Any] in tools manage services (#35075)

This commit is contained in:
wdeveloper16
2026-04-13 19:08:31 +02:00
committed by GitHub
parent e5bd80c719
commit 57c5f0ec87
4 changed files with 17 additions and 14 deletions

View File

@ -92,7 +92,7 @@ class ApiToolManageService:
@staticmethod
def convert_schema_to_tool_bundles(
schema: str, extra_info: dict | None = None
schema: str, extra_info: dict[str, Any] | None = None
) -> tuple[list[ApiToolBundle], ApiProviderSchemaType]:
"""
convert schema to tool bundles
@ -109,8 +109,8 @@ class ApiToolManageService:
user_id: str,
tenant_id: str,
provider_name: str,
icon: dict,
credentials: dict,
icon: dict[str, Any],
credentials: dict[str, Any],
schema_type: ApiProviderSchemaType,
schema: str,
privacy_policy: str,
@ -244,8 +244,8 @@ class ApiToolManageService:
tenant_id: str,
provider_name: str,
original_provider: str,
icon: dict,
credentials: dict,
icon: dict[str, Any],
credentials: dict[str, Any],
_schema_type: ApiProviderSchemaType,
schema: str,
privacy_policy: str | None,
@ -356,8 +356,8 @@ class ApiToolManageService:
tenant_id: str,
provider_name: str,
tool_name: str,
credentials: dict,
parameters: dict,
credentials: dict[str, Any],
parameters: dict[str, Any],
schema_type: ApiProviderSchemaType,
schema: str,
):

View File

@ -147,7 +147,7 @@ class BuiltinToolManageService:
tenant_id: str,
provider: str,
credential_id: str,
credentials: dict | None = None,
credentials: dict[str, Any] | None = None,
name: str | None = None,
):
"""
@ -177,7 +177,7 @@ class BuiltinToolManageService:
)
original_credentials = encrypter.decrypt(db_provider.credentials)
new_credentials: dict = {
new_credentials: dict[str, Any] = {
key: value if value != HIDDEN_VALUE else original_credentials.get(key, UNKNOWN_VALUE)
for key, value in credentials.items()
}
@ -216,7 +216,7 @@ class BuiltinToolManageService:
api_type: CredentialType,
tenant_id: str,
provider: str,
credentials: dict,
credentials: dict[str, Any],
expires_at: int = -1,
name: str | None = None,
):
@ -657,7 +657,7 @@ class BuiltinToolManageService:
def save_custom_oauth_client_params(
tenant_id: str,
provider: str,
client_params: dict | None = None,
client_params: dict[str, Any] | None = None,
enable_oauth_custom_client: bool | None = None,
):
"""

View File

@ -69,7 +69,9 @@ class ToolTransformService:
return ""
@staticmethod
def repack_provider(tenant_id: str, provider: dict | ToolProviderApiEntity | PluginDatasourceProviderEntity):
def repack_provider(
tenant_id: str, provider: dict[str, Any] | ToolProviderApiEntity | PluginDatasourceProviderEntity
):
"""
repack provider

View File

@ -1,6 +1,7 @@
import json
import logging
from datetime import datetime
from typing import Any
from graphon.model_runtime.utils.encoders import jsonable_encoder
from sqlalchemy import delete, or_, select
@ -35,7 +36,7 @@ class WorkflowToolManageService:
workflow_app_id: str,
name: str,
label: str,
icon: dict,
icon: dict[str, Any],
description: str,
parameters: list[WorkflowToolParameterConfiguration],
privacy_policy: str = "",
@ -117,7 +118,7 @@ class WorkflowToolManageService:
workflow_tool_id: str,
name: str,
label: str,
icon: dict,
icon: dict[str, Any],
description: str,
parameters: list[WorkflowToolParameterConfiguration],
privacy_policy: str = "",