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(lint): sort __all__ definitions (#11243)

Bowen Liange79eac688a3c
diff --git a/api/.ruff.toml b/api/.ruff.toml
index 9a6dd46f692..0f3185223c1 100644
--- a/api/.ruff.toml
+++ b/api/.ruff.toml
@@ -20,6 +20,8 @@ select = [
"PLC0208", # iteration-over-set
"PLC2801", # unnecessary-dunder-call
"PLC0414", # useless-import-alias
+ "PLE0604", # invalid-all-object
+ "PLE0605", # invalid-all-format
"PLR0402", # manual-from-import
"PLR1711", # useless-return
"PLR1714", # repeated-equality-comparison
@@ -28,6 +30,7 @@ select = [
"RUF100", # unused-noqa
"RUF101", # redirected-noqa
"RUF200", # invalid-pyproject-toml
+ "RUF022", # unsorted-dunder-all
"S506", # unsafe-yaml-load
"SIM", # flake8-simplify rules
"TRY400", # error-instead-of-exception
diff --git a/api/core/file/__init__.py b/api/core/file/__init__.py
index fe9e52258ac..44749ebec35 100644
--- a/api/core/file/__init__.py
+++ b/api/core/file/__init__.py
@@ -7,13 +7,13 @@ from .models import (
)
__all__ = [
+ "FILE_MODEL_IDENTITY",
+ "ArrayFileAttribute",
+ "File",
+ "FileAttribute",
+ "FileBelongsTo",
+ "FileTransferMethod",
"FileType",
"FileUploadConfig",
- "FileTransferMethod",
- "FileBelongsTo",
- "File",
"ImageConfig",
- "FileAttribute",
- "ArrayFileAttribute",
- "FILE_MODEL_IDENTITY",
]
diff --git a/api/core/model_runtime/entities/__init__.py b/api/core/model_runtime/entities/__init__.py
index 5e52f10b4c6..1c73755cffd 100644
--- a/api/core/model_runtime/entities/__init__.py
+++ b/api/core/model_runtime/entities/__init__.py
@@ -18,25 +18,25 @@ from .message_entities import (
from .model_entities import ModelPropertyKey
__all__ = [
+ "AssistantPromptMessage",
+ "AudioPromptMessageContent",
+ "DocumentPromptMessageContent",
"ImagePromptMessageContent",
- "VideoPromptMessageContent",
- "PromptMessage",
- "PromptMessageRole",
+ "LLMResult",
+ "LLMResultChunk",
+ "LLMResultChunkDelta",
"LLMUsage",
"ModelPropertyKey",
- "AssistantPromptMessage",
+ "PromptMessage",
"PromptMessage",
"PromptMessageContent",
+ "PromptMessageContentType",
"PromptMessageRole",
+ "PromptMessageRole",
+ "PromptMessageTool",
"SystemPromptMessage",
"TextPromptMessageContent",
- "UserPromptMessage",
- "PromptMessageTool",
"ToolPromptMessage",
- "PromptMessageContentType",
- "LLMResult",
- "LLMResultChunk",
- "LLMResultChunkDelta",
- "AudioPromptMessageContent",
- "DocumentPromptMessageContent",
+ "UserPromptMessage",
+ "VideoPromptMessageContent",
]
diff --git a/api/core/model_runtime/model_providers/volcengine_maas/legacy/volc_sdk/__init__.py b/api/core/model_runtime/model_providers/volcengine_maas/legacy/volc_sdk/__init__.py
index 8b3eb157be5..2a269557f28 100644
--- a/api/core/model_runtime/model_providers/volcengine_maas/legacy/volc_sdk/__init__.py
+++ b/api/core/model_runtime/model_providers/volcengine_maas/legacy/volc_sdk/__init__.py
@@ -1,4 +1,4 @@
from .common import ChatRole
from .maas import MaasError, MaasService
-__all__ = ["MaasService", "ChatRole", "MaasError"]
+__all__ = ["ChatRole", "MaasError", "MaasService"]
diff --git a/api/core/variables/__init__.py b/api/core/variables/__init__.py
index 144c1b899fb..2b1a58f93aa 100644
--- a/api/core/variables/__init__.py
+++ b/api/core/variables/__init__.py
@@ -32,32 +32,32 @@ from .variables import (
)
__all__ = [
- "IntegerVariable",
- "FloatVariable",
- "ObjectVariable",
- "SecretVariable",
- "StringVariable",
- "ArrayAnyVariable",
- "Variable",
- "SegmentType",
- "SegmentGroup",
- "Segment",
- "NoneSegment",
- "NoneVariable",
- "IntegerSegment",
- "FloatSegment",
- "ObjectSegment",
"ArrayAnySegment",
- "StringSegment",
- "ArrayStringVariable",
- "ArrayNumberVariable",
- "ArrayObjectVariable",
- "ArraySegment",
+ "ArrayAnyVariable",
"ArrayFileSegment",
+ "ArrayFileVariable",
"ArrayNumberSegment",
+ "ArrayNumberVariable",
"ArrayObjectSegment",
+ "ArrayObjectVariable",
+ "ArraySegment",
"ArrayStringSegment",
+ "ArrayStringVariable",
"FileSegment",
"FileVariable",
- "ArrayFileVariable",
+ "FloatSegment",
+ "FloatVariable",
+ "IntegerSegment",
+ "IntegerVariable",
+ "NoneSegment",
+ "NoneVariable",
+ "ObjectSegment",
+ "ObjectVariable",
+ "SecretVariable",
+ "Segment",
+ "SegmentGroup",
+ "SegmentType",
+ "StringSegment",
+ "StringVariable",
+ "Variable",
]
diff --git a/api/core/workflow/callbacks/__init__.py b/api/core/workflow/callbacks/__init__.py
index 403fbbaa2fa..fba86c1e2eb 100644
--- a/api/core/workflow/callbacks/__init__.py
+++ b/api/core/workflow/callbacks/__init__.py
@@ -2,6 +2,6 @@ from .base_workflow_callback import WorkflowCallback
from .workflow_logging_callback import WorkflowLoggingCallback
__all__ = [
- "WorkflowLoggingCallback",
"WorkflowCallback",
+ "WorkflowLoggingCallback",
]
diff --git a/api/core/workflow/nodes/answer/__init__.py b/api/core/workflow/nodes/answer/__init__.py
index 7a10f47eed2..ee7676c7e48 100644
--- a/api/core/workflow/nodes/answer/__init__.py
+++ b/api/core/workflow/nodes/answer/__init__.py
@@ -1,4 +1,4 @@
from .answer_node import AnswerNode
from .entities import AnswerStreamGenerateRoute
-__all__ = ["AnswerStreamGenerateRoute", "AnswerNode"]
+__all__ = ["AnswerNode", "AnswerStreamGenerateRoute"]
diff --git a/api/core/workflow/nodes/base/__init__.py b/api/core/workflow/nodes/base/__init__.py
index 61f727740c8..72d6392d4e0 100644
--- a/api/core/workflow/nodes/base/__init__.py
+++ b/api/core/workflow/nodes/base/__init__.py
@@ -1,4 +1,4 @@
from .entities import BaseIterationNodeData, BaseIterationState, BaseNodeData
from .node import BaseNode
-__all__ = ["BaseNode", "BaseNodeData", "BaseIterationNodeData", "BaseIterationState"]
+__all__ = ["BaseIterationNodeData", "BaseIterationState", "BaseNode", "BaseNodeData"]
diff --git a/api/core/workflow/nodes/end/__init__.py b/api/core/workflow/nodes/end/__init__.py
index adb381701ce..c4c00e3ddc7 100644
--- a/api/core/workflow/nodes/end/__init__.py
+++ b/api/core/workflow/nodes/end/__init__.py
@@ -1,4 +1,4 @@
from .end_node import EndNode
from .entities import EndStreamParam
-__all__ = ["EndStreamParam", "EndNode"]
+__all__ = ["EndNode", "EndStreamParam"]
diff --git a/api/core/workflow/nodes/event/__init__.py b/api/core/workflow/nodes/event/__init__.py
index 581def95533..5e3b31e48ba 100644
--- a/api/core/workflow/nodes/event/__init__.py
+++ b/api/core/workflow/nodes/event/__init__.py
@@ -2,9 +2,9 @@ from .event import ModelInvokeCompletedEvent, RunCompletedEvent, RunRetrieverRes
from .types import NodeEvent
__all__ = [
+ "ModelInvokeCompletedEvent",
+ "NodeEvent",
"RunCompletedEvent",
"RunRetrieverResourceEvent",
"RunStreamChunkEvent",
- "NodeEvent",
- "ModelInvokeCompletedEvent",
]
diff --git a/api/core/workflow/nodes/http_request/__init__.py b/api/core/workflow/nodes/http_request/__init__.py
index 9408c2dde0c..c51c6789999 100644
--- a/api/core/workflow/nodes/http_request/__init__.py
+++ b/api/core/workflow/nodes/http_request/__init__.py
@@ -1,4 +1,4 @@
from .entities import BodyData, HttpRequestNodeAuthorization, HttpRequestNodeBody, HttpRequestNodeData
from .node import HttpRequestNode
-__all__ = ["HttpRequestNodeData", "HttpRequestNodeAuthorization", "HttpRequestNodeBody", "BodyData", "HttpRequestNode"]
+__all__ = ["BodyData", "HttpRequestNode", "HttpRequestNodeAuthorization", "HttpRequestNodeBody", "HttpRequestNodeData"]
diff --git a/api/core/workflow/nodes/question_classifier/__init__.py b/api/core/workflow/nodes/question_classifier/__init__.py
index 70414c4199e..4d06b6bea36 100644
--- a/api/core/workflow/nodes/question_classifier/__init__.py
+++ b/api/core/workflow/nodes/question_classifier/__init__.py
@@ -1,4 +1,4 @@
from .entities import QuestionClassifierNodeData
from .question_classifier_node import QuestionClassifierNode
-__all__ = ["QuestionClassifierNodeData", "QuestionClassifierNode"]
+__all__ = ["QuestionClassifierNode", "QuestionClassifierNodeData"]
diff --git a/api/core/workflow/nodes/variable_assigner/__init__.py b/api/core/workflow/nodes/variable_assigner/__init__.py
index 83da4bdc79b..eedbd6d2559 100644
--- a/api/core/workflow/nodes/variable_assigner/__init__.py
+++ b/api/core/workflow/nodes/variable_assigner/__init__.py
@@ -2,7 +2,7 @@ from .node import VariableAssignerNode
from .node_data import VariableAssignerData, WriteMode
__all__ = [
- "VariableAssignerNode",
"VariableAssignerData",
+ "VariableAssignerNode",
"WriteMode",
]
diff --git a/api/models/__init__.py b/api/models/__init__.py
index cd6c7674da0..61a38870cf9 100644
--- a/api/models/__init__.py
+++ b/api/models/__init__.py
@@ -24,30 +24,30 @@ from .workflow import (
)
__all__ = [
+ "Account",
+ "AccountIntegrate",
+ "ApiToken",
+ "App",
+ "AppMode",
+ "Conversation",
"ConversationVariable",
- "Document",
+ "DataSourceOauthBinding",
"Dataset",
"DatasetProcessRule",
+ "Document",
"DocumentSegment",
- "DataSourceOauthBinding",
- "AppMode",
- "Workflow",
- "App",
- "Message",
"EndUser",
- "MessageFile",
- "UploadFile",
- "Account",
- "WorkflowAppLog",
- "WorkflowRun",
- "Site",
"InstalledApp",
- "RecommendedApp",
- "ApiToken",
- "AccountIntegrate",
"InvitationCode",
- "Tenant",
- "Conversation",
+ "Message",
"MessageAnnotation",
+ "MessageFile",
+ "RecommendedApp",
+ "Site",
+ "Tenant",
"ToolFile",
+ "UploadFile",
+ "Workflow",
+ "WorkflowAppLog",
+ "WorkflowRun",
]
diff --git a/api/services/errors/__init__.py b/api/services/errors/__init__.py
index bb5711145c0..eb1f055708c 100644
--- a/api/services/errors/__init__.py
+++ b/api/services/errors/__init__.py
@@ -14,16 +14,16 @@ from . import (
)
__all__ = [
- "base",
- "conversation",
- "message",
- "index",
- "app_model_config",
"account",
- "document",
- "dataset",
"app",
- "completion",
+ "app_model_config",
"audio",
+ "base",
+ "completion",
+ "conversation",
+ "dataset",
+ "document",
"file",
+ "index",
+ "message",
]