Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

chore: suppress pyrefly necessary conversions (#40444)

Tushar Motwaniaa5e8a5eff86
diff --git a/api/controllers/common/wraps.py b/api/controllers/common/wraps.py
index 34fe8cc96aa..1e95b5f8d68 100644
--- a/api/controllers/common/wraps.py
+++ b/api/controllers/common/wraps.py
@@ -152,7 +152,7 @@ def _extract_resource_id(
if resource_type == RBACResourceScope.APP:
app_id = matched_args.get("app_id")
if app_id:
- return str(app_id)
+ return str(app_id) # pyrefly: ignore[unnecessary-type-conversion]
agent_id = matched_args.get("agent_id")
if agent_id:
@@ -161,7 +161,7 @@ def _extract_resource_id(
resource_id = matched_args.get("resource_id")
if resource_id:
- return str(resource_id)
+ return str(resource_id) # pyrefly: ignore[unnecessary-type-conversion]
raise ValueError("Missing app_id in request path")
if resource_type == RBACResourceScope.DATASET:
@@ -174,6 +174,6 @@ def _extract_resource_id(
dataset = db.session.scalar(select(Dataset).where(Dataset.pipeline_id == str(pipeline_id)))
if not dataset:
raise NotFound("Dataset not found for pipeline")
- return str(dataset.id)
+ return str(dataset.id) # pyrefly: ignore[unnecessary-type-conversion]
raise ValueError("Missing dataset_id or pipeline_id in request path")
raise ValueError(f"Unknown resource_type: {resource_type}")
diff --git a/api/controllers/console/agent/composer.py b/api/controllers/console/agent/composer.py
index db52ba11e27..76d7863776e 100644
--- a/api/controllers/console/agent/composer.py
+++ b/api/controllers/console/agent/composer.py
@@ -284,7 +284,7 @@ class WorkflowAgentComposerSaveToRosterApi(Resource):
def _require_snippet_app_id(*, session: Session, tenant_id: str, snippet_id: UUID) -> str:
snippet = SnippetService(session=session).get_snippet_by_id(
- snippet_id=str(snippet_id),
+ snippet_id=str(snippet_id), # pyrefly: ignore[unnecessary-type-conversion]
tenant_id=tenant_id,
)
if snippet is None:
diff --git a/api/controllers/console/agent/roster.py b/api/controllers/console/agent/roster.py
index aed038eed7e..8ffe2bbe467 100644
--- a/api/controllers/console/agent/roster.py
+++ b/api/controllers/console/agent/roster.py
@@ -1069,7 +1069,7 @@ class AgentLogMessagesApi(Resource):
payload = _agent_observability_service(session).list_log_messages(
app=app_model,
agent_id=str(agent_id),
- conversation_id=str(conversation_id),
+ conversation_id=str(conversation_id), # pyrefly: ignore[unnecessary-type-conversion]
params=AgentLogQueryParams(
page=query.page,
limit=query.limit,
diff --git a/api/controllers/console/apikey.py b/api/controllers/console/apikey.py
index 5179fc163e7..e848944f1a8 100644
--- a/api/controllers/console/apikey.py
+++ b/api/controllers/console/apikey.py
@@ -204,7 +204,7 @@ class AppApiKeyListResource(BaseApiKeyListResource):
"""Get all API keys for an app"""
return dump_response(
ApiKeyList,
- self._get_api_key_list(str(resource_id), current_tenant_id, session=session),
+ self._get_api_key_list(str(resource_id), current_tenant_id, session=session), # pyrefly: ignore[unnecessary-type-conversion]
)
@console_ns.doc("create_app_api_key")
@@ -221,7 +221,7 @@ class AppApiKeyListResource(BaseApiKeyListResource):
"""Create a new API key for an app"""
return dump_response(
ApiKeyItem,
- self._create_api_key(str(resource_id), current_tenant_id, session=session),
+ self._create_api_key(str(resource_id), current_tenant_id, session=session), # pyrefly: ignore[unnecessary-type-conversion]
), 201
resource_type = ApiTokenType.APP
@@ -251,7 +251,7 @@ class AppApiKeyResource(BaseApiKeyResource):
) -> tuple[str, int]:
"""Delete an API key for an app"""
self._delete_api_key(
- str(resource_id),
+ str(resource_id), # pyrefly: ignore[unnecessary-type-conversion]
str(api_key_id),
current_tenant_id,
current_user,
@@ -276,7 +276,7 @@ class DatasetApiKeyListResource(BaseApiKeyListResource):
"""Get all API keys for a dataset"""
return dump_response(
ApiKeyList,
- self._get_api_key_list(str(resource_id), current_tenant_id, session=session),
+ self._get_api_key_list(str(resource_id), current_tenant_id, session=session), # pyrefly: ignore[unnecessary-type-conversion]
)
@console_ns.doc("create_dataset_api_key")
@@ -292,7 +292,7 @@ class DatasetApiKeyListResource(BaseApiKeyListResource):
"""Create a new API key for a dataset"""
return dump_response(
ApiKeyItem,
- self._create_api_key(str(resource_id), current_tenant_id, session=session),
+ self._create_api_key(str(resource_id), current_tenant_id, session=session), # pyrefly: ignore[unnecessary-type-conversion]
), 201
resource_type = ApiTokenType.DATASET
@@ -321,7 +321,7 @@ class DatasetApiKeyResource(BaseApiKeyResource):
) -> tuple[str, int]:
"""Delete an API key for a dataset"""
self._delete_api_key(
- str(resource_id),
+ str(resource_id), # pyrefly: ignore[unnecessary-type-conversion]
str(api_key_id),
current_tenant_id,
current_user,