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.

ci: enable Ruff FURB113 (#44109)

Asuka Minato14f863a23f11
diff --git a/api/.ruff.toml b/api/.ruff.toml
index e5e1f970810..608e39c7c1b 100644
--- a/api/.ruff.toml
+++ b/api/.ruff.toml
@@ -62,7 +62,6 @@ ignore = [
"E712", # true-false-comparison
"F821", # undefined-name
"F841", # unused-variable
- "FURB113", # repeated-append
"UP007", # non-pep604-annotation
"B007", # unused-loop-control-variable
"B901", # allow return in yield
diff --git a/api/clients/agent_backend/request_builder.py b/api/clients/agent_backend/request_builder.py
index 47b007cd99c..75e8f060002 100644
--- a/api/clients/agent_backend/request_builder.py
+++ b/api/clients/agent_backend/request_builder.py
@@ -288,21 +288,21 @@ class AgentBackendRunRequestBuilder:
include_shell = run_input.include_shell or run_input.config_layer_config is not None
if include_shell:
- layers.append(
- RunLayerSpec(
- name=DIFY_RUNTIME_LAYER_ID,
- config=(DifyRuntimeLayerConfig(backend_binding_ref=run_input.backend_binding_ref)).model_dump(
- mode="json"
+ layers.extend(
+ [
+ RunLayerSpec(
+ name=DIFY_RUNTIME_LAYER_ID,
+ config=(DifyRuntimeLayerConfig(backend_binding_ref=run_input.backend_binding_ref)).model_dump(
+ mode="json"
+ ),
),
- )
- )
- # Sandboxed bash workspace (dify.shell). It enters before config so
- # eager pulls materialize content in the same filesystem used by model commands.
- layers.append(
- RunLayerSpec(
- name=DIFY_SHELL_LAYER_ID,
- config=(run_input.shell_config or DifyShellLayerConfig()).model_dump(mode="json"),
- )
+ # Sandboxed bash workspace (dify.shell). It enters before config so
+ # eager pulls materialize content in the same filesystem used by model commands.
+ RunLayerSpec(
+ name=DIFY_SHELL_LAYER_ID,
+ config=(run_input.shell_config or DifyShellLayerConfig()).model_dump(mode="json"),
+ ),
+ ]
)
if run_input.config_layer_config is not None:
@@ -422,21 +422,21 @@ class AgentBackendRunRequestBuilder:
include_shell = run_input.include_shell or run_input.config_layer_config is not None
if include_shell:
- layers.append(
- RunLayerSpec(
- name=DIFY_RUNTIME_LAYER_ID,
- config=(DifyRuntimeLayerConfig(backend_binding_ref=run_input.backend_binding_ref)).model_dump(
- mode="json"
+ layers.extend(
+ [
+ RunLayerSpec(
+ name=DIFY_RUNTIME_LAYER_ID,
+ config=(DifyRuntimeLayerConfig(backend_binding_ref=run_input.backend_binding_ref)).model_dump(
+ mode="json"
+ ),
),
- )
- )
- # Sandboxed bash workspace (dify.shell). It enters before config so
- # eager pulls materialize content in the same filesystem used by model commands.
- layers.append(
- RunLayerSpec(
- name=DIFY_SHELL_LAYER_ID,
- config=(run_input.shell_config or DifyShellLayerConfig()).model_dump(mode="json"),
- )
+ # Sandboxed bash workspace (dify.shell). It enters before config so
+ # eager pulls materialize content in the same filesystem used by model commands.
+ RunLayerSpec(
+ name=DIFY_SHELL_LAYER_ID,
+ config=(run_input.shell_config or DifyShellLayerConfig()).model_dump(mode="json"),
+ ),
+ ]
)
if run_input.config_layer_config is not None:
diff --git a/api/core/mcp/auth/auth_flow.py b/api/core/mcp/auth/auth_flow.py
index 9f18bd3e7ad..f259d7d0b6d 100644
--- a/api/core/mcp/auth/auth_flow.py
+++ b/api/core/mcp/auth/auth_flow.py
@@ -114,20 +114,25 @@ def build_oauth_authorization_server_metadata_discovery_urls(auth_server_url: st
base = f"{parsed.scheme}://{parsed.netloc}"
path = parsed.path.rstrip("/")
# OAuth 2.0 Authorization Server Metadata at root (MCP-03-26)
- urls.append(f"{base}/.well-known/oauth-authorization-server")
-
- # OpenID Connect Discovery at root
- urls.append(f"{base}/.well-known/openid-configuration")
+ urls.extend(
+ [
+ f"{base}/.well-known/oauth-authorization-server",
+ # OpenID Connect Discovery at root
+ f"{base}/.well-known/openid-configuration",
+ ]
+ )
if path:
# OpenID Connect Discovery with path insertion
- urls.append(f"{base}/.well-known/openid-configuration{path}")
-
- # OpenID Connect Discovery path appending
- urls.append(f"{base}{path}/.well-known/openid-configuration")
-
- # OAuth 2.0 Authorization Server Metadata with path insertion
- urls.append(f"{base}/.well-known/oauth-authorization-server{path}")
+ urls.extend(
+ [
+ f"{base}/.well-known/openid-configuration{path}",
+ # OpenID Connect Discovery path appending
+ f"{base}{path}/.well-known/openid-configuration",
+ # OAuth 2.0 Authorization Server Metadata with path insertion
+ f"{base}/.well-known/oauth-authorization-server{path}",
+ ]
+ )
return urls
diff --git a/api/core/rag/extractor/word_extractor.py b/api/core/rag/extractor/word_extractor.py
index 44a1c5bba7d..b9f2547fff1 100644
--- a/api/core/rag/extractor/word_extractor.py
+++ b/api/core/rag/extractor/word_extractor.py
@@ -201,8 +201,7 @@ class WordExtractor(BaseExtractor):
header_row = table.rows[0]
headers = self._parse_row(header_row, image_map, total_cols)
- markdown.append("| " + " | ".join(headers) + " |")
- markdown.append("| " + " | ".join(["---"] * total_cols) + " |")
+ markdown.extend(("| " + " | ".join(headers) + " |", "| " + " | ".join(["---"] * total_cols) + " |"))
for row in table.rows[1:]:
row_cells = self._parse_row(row, image_map, total_cols)
diff --git a/api/core/workflow/nodes/agent_v2/runtime_request_builder.py b/api/core/workflow/nodes/agent_v2/runtime_request_builder.py
index 43ebe6ca37d..0fb791fe874 100644
--- a/api/core/workflow/nodes/agent_v2/runtime_request_builder.py
+++ b/api/core/workflow/nodes/agent_v2/runtime_request_builder.py
@@ -361,8 +361,7 @@ class WorkflowAgentRuntimeRequestBuilder:
lines.append(f"- User query: {query}")
if uploaded_files is not None:
- lines.append("- Uploaded workflow files:")
- lines.append(f" - sys.files: {uploaded_files}")
+ lines.extend(("- Uploaded workflow files:", f" - sys.files: {uploaded_files}"))
if resolved_outputs:
lines.append("- Previous node outputs:")
diff --git a/api/extensions/ext_celery.py b/api/extensions/ext_celery.py
index b3ad8391e18..6368a7fd1dd 100644
--- a/api/extensions/ext_celery.py
+++ b/api/extensions/ext_celery.py
@@ -257,8 +257,7 @@ def init_app(app: DifyApp) -> Celery:
"schedule": timedelta(minutes=dify_config.HUMAN_INPUT_TIMEOUT_TASK_INTERVAL),
}
if dify_config.ENABLE_CHECK_UPGRADABLE_PLUGIN_TASK and dify_config.MARKETPLACE_ENABLED:
- imports.append("schedule.check_upgradable_plugin_task")
- imports.append("tasks.process_tenant_plugin_autoupgrade_check_task")
+ imports.extend(("schedule.check_upgradable_plugin_task", "tasks.process_tenant_plugin_autoupgrade_check_task"))
beat_schedule["check_upgradable_plugin_task"] = {
"task": "schedule.check_upgradable_plugin_task.check_upgradable_plugin_task",
"schedule": crontab(minute="*/15"),
diff --git a/api/models/dataset.py b/api/models/dataset.py
index 093606796e8..85963dab8b5 100644
--- a/api/models/dataset.py
+++ b/api/models/dataset.py
@@ -255,40 +255,14 @@ class Dataset(Base):
for dataset_metadata in dataset_metadatas
]
if self.built_in_field_enabled:
- doc_metadata.append(
- {
- "id": "built-in",
- "name": BuiltInField.document_name,
- "type": "string",
- }
- )
- doc_metadata.append(
- {
- "id": "built-in",
- "name": BuiltInField.uploader,
- "type": "string",
- }
- )
- doc_metadata.append(
- {
- "id": "built-in",
- "name": BuiltInField.upload_date,
- "type": "time",
- }
- )
- doc_metadata.append(
- {
- "id": "built-in",
- "name": BuiltInField.last_update_date,
- "type": "time",
- }
- )
- doc_metadata.append(
- {
- "id": "built-in",
- "name": BuiltInField.source,
- "type": "string",
- }
+ doc_metadata.extend(
+ (
+ {"id": "built-in", "name": BuiltInField.document_name, "type": "string"},
+ {"id": "built-in", "name": BuiltInField.uploader, "type": "string"},
+ {"id": "built-in", "name": BuiltInField.upload_date, "type": "time"},
+ {"id": "built-in", "name": BuiltInField.last_update_date, "type": "time"},
+ {"id": "built-in", "name": BuiltInField.source, "type": "string"},
+ )
)
return doc_metadata
diff --git a/api/providers/vdb/vdb-baidu/src/dify_vdb_baidu/baidu_vector.py b/api/providers/vdb/vdb-baidu/src/dify_vdb_baidu/baidu_vector.py
index ae8e7f287b9..c11b92e9794 100644
--- a/api/providers/vdb/vdb-baidu/src/dify_vdb_baidu/baidu_vector.py
+++ b/api/providers/vdb/vdb-baidu/src/dify_vdb_baidu/baidu_vector.py
@@ -273,43 +273,44 @@ class BaiduVector(BaseVector):
# Construct field schema
fields = []
- fields.append(
- Field(
- VDBField.PRIMARY_KEY,
- FieldType.STRING,
- primary_key=True,
- partition_key=True,
- auto_increment=False,
- not_null=True,
+ fields.extend(
+ (
+ Field(
+ VDBField.PRIMARY_KEY,
+ FieldType.STRING,
+ primary_key=True,
+ partition_key=True,
+ auto_increment=False,
+ not_null=True,
+ ),
+ Field(VDBField.CONTENT_KEY, FieldType.TEXT, not_null=False),
+ Field(VDBField.METADATA_KEY, FieldType.JSON, not_null=False),
+ Field(VDBField.VECTOR, FieldType.FLOAT_VECTOR, not_null=True, dimension=dimension),
)
)
- fields.append(Field(VDBField.CONTENT_KEY, FieldType.TEXT, not_null=False))
- fields.append(Field(VDBField.METADATA_KEY, FieldType.JSON, not_null=False))
- fields.append(Field(VDBField.VECTOR, FieldType.FLOAT_VECTOR, not_null=True, dimension=dimension))
# Construct vector index params
indexes = []
- indexes.append(
- VectorIndex(
- index_name=self.vector_index,
- index_type=index_type,
- field=VDBField.VECTOR,
- metric_type=metric_type,
- params=HNSWParams(m=16, efconstruction=200),
- auto_build=True,
- auto_build_index_policy=AutoBuildRowCountIncrement(
- row_count_increment=self._client_config.auto_build_row_count_increment,
- row_count_increment_ratio=self._client_config.auto_build_row_count_increment_ratio,
+ indexes.extend(
+ [
+ VectorIndex(
+ index_name=self.vector_index,
+ index_type=index_type,
+ field=VDBField.VECTOR,
+ metric_type=metric_type,
+ params=HNSWParams(m=16, efconstruction=200),
+ auto_build=True,
+ auto_build_index_policy=AutoBuildRowCountIncrement(
+ row_count_increment=self._client_config.auto_build_row_count_increment,
+ row_count_increment_ratio=self._client_config.auto_build_row_count_increment_ratio,
+ ),
),
- )
- )
-
- # Filtering index
- indexes.append(
- FilteringIndex(
- index_name=self.filtering_index,
- fields=[VDBField.METADATA_KEY],
- )
+ # Filtering index
+ FilteringIndex(
+ index_name=self.filtering_index,
+ fields=[VDBField.METADATA_KEY],
+ ),
+ ]
)
# Get analyzer and parse_mode from config
diff --git a/api/providers/vdb/vdb-lindorm/src/dify_vdb_lindorm/lindorm_vector.py b/api/providers/vdb/vdb-lindorm/src/dify_vdb_lindorm/lindorm_vector.py
index ab191c9b1e8..0d3cb2727e3 100644
--- a/api/providers/vdb/vdb-lindorm/src/dify_vdb_lindorm/lindorm_vector.py
+++ b/api/providers/vdb/vdb-lindorm/src/dify_vdb_lindorm/lindorm_vector.py
@@ -146,8 +146,7 @@ class LindormVectorStore(BaseVector):
action_header["index"]["routing"] = self._routing
action_values[ROUTING_FIELD] = self._routing
- actions.append(action_header)
- actions.append(action_values)
+ actions.extend((action_header, action_values))
try:
_bulk_with_retry(actions)
diff --git a/api/providers/vdb/vdb-milvus/src/dify_vdb_milvus/milvus_vector.py b/api/providers/vdb/vdb-milvus/src/dify_vdb_milvus/milvus_vector.py
index 488e331028d..f692ca1f73e 100644
--- a/api/providers/vdb/vdb-milvus/src/dify_vdb_milvus/milvus_vector.py
+++ b/api/providers/vdb/vdb-milvus/src/dify_vdb_milvus/milvus_vector.py
@@ -354,12 +354,15 @@ class MilvusVector(BaseVector):
):
content_field_kwargs["analyzer_params"] = self._client_config.analyzer_params
- fields.append(FieldSchema(Field.CONTENT_KEY, DataType.VARCHAR, **content_field_kwargs))
-
- # Create the primary key field
- fields.append(FieldSchema(Field.PRIMARY_KEY, DataType.INT64, is_primary=True, auto_id=True))
- # Create the vector field, supports binary or float vectors
- fields.append(FieldSchema(Field.VECTOR, infer_dtype_bydata(embeddings[0]), dim=dim))
+ fields.extend(
+ [
+ FieldSchema(Field.CONTENT_KEY, DataType.VARCHAR, **content_field_kwargs),
+ # Create the primary key field
+ FieldSchema(Field.PRIMARY_KEY, DataType.INT64, is_primary=True, auto_id=True),
+ # Create the vector field, supports binary or float vectors
+ FieldSchema(Field.VECTOR, infer_dtype_bydata(embeddings[0]), dim=dim),
+ ]
+ )
# Create Sparse Vector Index for the collection
if self._hybrid_search_enabled:
fields.append(FieldSchema(Field.SPARSE_VECTOR, DataType.SPARSE_FLOAT_VECTOR))
diff --git a/api/services/knowledge/dataset_read_service.py b/api/services/knowledge/dataset_read_service.py
index 90b076d4400..4702dea90eb 100644
--- a/api/services/knowledge/dataset_read_service.py
+++ b/api/services/knowledge/dataset_read_service.py
@@ -252,33 +252,29 @@ def get_document_built_in_fields(document: Document, *, session: Session) -> lis
def format_document_built_in_fields(document: Document, *, uploader_name: str | None) -> list[DocMetadataDetailItem]:
built_in_fields: list[DocMetadataDetailItem] = []
- built_in_fields.append(
- {"id": "built-in", "name": BuiltInField.document_name, "type": "string", "value": document.name}
- )
- built_in_fields.append({"id": "built-in", "name": BuiltInField.uploader, "type": "string", "value": uploader_name})
- built_in_fields.append(
- {
- "id": "built-in",
- "name": BuiltInField.upload_date,
- "type": "time",
- "value": str(document.created_at.timestamp()),
- }
- )
- built_in_fields.append(
- {
- "id": "built-in",
- "name": BuiltInField.last_update_date,
- "type": "time",
- "value": str(document.updated_at.timestamp()),
- }
- )
- built_in_fields.append(
- {
- "id": "built-in",
- "name": BuiltInField.source,
- "type": "string",
- "value": MetadataDataSource[document.data_source_type],
- }
+ built_in_fields.extend(
+ (
+ {"id": "built-in", "name": BuiltInField.document_name, "type": "string", "value": document.name},
+ {"id": "built-in", "name": BuiltInField.uploader, "type": "string", "value": uploader_name},
+ {
+ "id": "built-in",
+ "name": BuiltInField.upload_date,
+ "type": "time",
+ "value": str(document.created_at.timestamp()),
+ },
+ {
+ "id": "built-in",
+ "name": BuiltInField.last_update_date,
+ "type": "time",
+ "value": str(document.updated_at.timestamp()),
+ },
+ {
+ "id": "built-in",
+ "name": BuiltInField.source,
+ "type": "string",
+ "value": MetadataDataSource[document.data_source_type],
+ },
+ )
)
return built_in_fields
diff --git a/api/tests/unit_tests/core/plugin/utils/test_http_parser.py b/api/tests/unit_tests/core/plugin/utils/test_http_parser.py
index 01c9bee9ed4..e292e74188f 100644
--- a/api/tests/unit_tests/core/plugin/utils/test_http_parser.py
+++ b/api/tests/unit_tests/core/plugin/utils/test_http_parser.py
@@ -560,16 +560,20 @@ class TestFileUploads:
# Build multipart body
body_parts = []
- body_parts.append(f"------{boundary}".encode())
- body_parts.append(b'Content-Disposition: form-data; name="image"; filename="test.png"')
- body_parts.append(b"Content-Type: image/png")
- body_parts.append(b"")
- body_parts.append(binary_content)
- body_parts.append(f"------{boundary}".encode())
- body_parts.append(b'Content-Disposition: form-data; name="caption"')
- body_parts.append(b"")
- body_parts.append(b"Test image")
- body_parts.append(f"------{boundary}--".encode())
+ body_parts.extend(
+ (
+ f"------{boundary}".encode(),
+ b'Content-Disposition: form-data; name="image"; filename="test.png"',
+ b"Content-Type: image/png",
+ b"",
+ binary_content,
+ f"------{boundary}".encode(),
+ b'Content-Disposition: form-data; name="caption"',
+ b"",
+ b"Test image",
+ f"------{boundary}--".encode(),
+ )
+ )
body = b"\r\n".join(body_parts)
@@ -602,16 +606,20 @@ class TestFileUploads:
binary_content = b"\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00"
body_parts = []
- body_parts.append(f"------{boundary}".encode())
- body_parts.append(b'Content-Disposition: form-data; name="photo"; filename="photo.jpg"')
- body_parts.append(b"Content-Type: image/jpeg")
- body_parts.append(b"")
- body_parts.append(binary_content)
- body_parts.append(f"------{boundary}".encode())
- body_parts.append(b'Content-Disposition: form-data; name="album"')
- body_parts.append(b"")
- body_parts.append(b"Vacation 2024")
- body_parts.append(f"------{boundary}--".encode())
+ body_parts.extend(
+ (
+ f"------{boundary}".encode(),
+ b'Content-Disposition: form-data; name="photo"; filename="photo.jpg"',
+ b"Content-Type: image/jpeg",
+ b"",
+ binary_content,
+ f"------{boundary}".encode(),
+ b'Content-Disposition: form-data; name="album"',
+ b"",
+ b"Vacation 2024",
+ f"------{boundary}--".encode(),
+ )
+ )
body = b"\r\n".join(body_parts)
@@ -648,23 +656,27 @@ class TestFileUploads:
body_parts = []
# First file (text)
- body_parts.append(f"------{boundary}".encode())
- body_parts.append(b'Content-Disposition: form-data; name="files"; filename="doc.txt"')
- body_parts.append(b"Content-Type: text/plain")
- body_parts.append(b"")
- body_parts.append(text_file)
- # Second file (binary)
- body_parts.append(f"------{boundary}".encode())
- body_parts.append(b'Content-Disposition: form-data; name="files"; filename="data.bin"')
- body_parts.append(b"Content-Type: application/octet-stream")
- body_parts.append(b"")
- body_parts.append(binary_file)
- # Additional form field
- body_parts.append(f"------{boundary}".encode())
- body_parts.append(b'Content-Disposition: form-data; name="folder"')
- body_parts.append(b"")
- body_parts.append(b"uploads/2024")
- body_parts.append(f"------{boundary}--".encode())
+ body_parts.extend(
+ [
+ f"------{boundary}".encode(),
+ b'Content-Disposition: form-data; name="files"; filename="doc.txt"',
+ b"Content-Type: text/plain",
+ b"",
+ text_file,
+ # Second file (binary)
+ f"------{boundary}".encode(),
+ b'Content-Disposition: form-data; name="files"; filename="data.bin"',
+ b"Content-Type: application/octet-stream",
+ b"",
+ binary_file,
+ # Additional form field
+ f"------{boundary}".encode(),
+ b'Content-Disposition: form-data; name="folder"',
+ b"",
+ b"uploads/2024",
+ f"------{boundary}--".encode(),
+ ]
+ )
body = b"\r\n".join(body_parts)
@@ -700,16 +712,20 @@ class TestFileUploads:
file_content = b"This is my file content with special chars: \xf0\x9f\x98\x80"
body_parts = []
- body_parts.append(f"------{boundary}".encode())
- body_parts.append(b'Content-Disposition: form-data; name="upload"; filename="emoji.txt"')
- body_parts.append(b"Content-Type: text/plain; charset=utf-8")
- body_parts.append(b"")
- body_parts.append(file_content)
- body_parts.append(f"------{boundary}".encode())
- body_parts.append(b'Content-Disposition: form-data; name="metadata"')
- body_parts.append(b"")
- body_parts.append(b'{"encoding": "utf-8", "size": 42}')
- body_parts.append(f"------{boundary}--".encode())
+ body_parts.extend(
+ (
+ f"------{boundary}".encode(),
+ b'Content-Disposition: form-data; name="upload"; filename="emoji.txt"',
+ b"Content-Type: text/plain; charset=utf-8",
+ b"",
+ file_content,
+ f"------{boundary}".encode(),
+ b'Content-Disposition: form-data; name="metadata"',
+ b"",
+ b'{"encoding": "utf-8", "size": 42}',
+ f"------{boundary}--".encode(),
+ )
+ )
body = b"\r\n".join(body_parts)
diff --git a/api/tests/unit_tests/core/workflow/graph_engine/test_table_runner.py b/api/tests/unit_tests/core/workflow/graph_engine/test_table_runner.py
index 3814177c0cf..fdece324442 100644
--- a/api/tests/unit_tests/core/workflow/graph_engine/test_table_runner.py
+++ b/api/tests/unit_tests/core/workflow/graph_engine/test_table_runner.py
@@ -624,19 +624,22 @@ class TableTestRunner:
Formatted report string
"""
report = []
- report.append("=" * 80)
- report.append("TEST SUITE REPORT")
- report.append("=" * 80)
- report.append("")
-
- # Summary
- report.append("SUMMARY:")
- report.append(f" Total Tests: {suite_result.total_tests}")
- report.append(f" Passed: {suite_result.passed_tests}")
- report.append(f" Failed: {suite_result.failed_tests}")
- report.append(f" Success Rate: {suite_result.success_rate:.1f}%")
- report.append(f" Total Time: {suite_result.total_execution_time:.2f}s")
- report.append("")
+ report.extend(
+ [
+ "=" * 80,
+ "TEST SUITE REPORT",
+ "=" * 80,
+ "",
+ # Summary
+ "SUMMARY:",
+ f" Total Tests: {suite_result.total_tests}",
+ f" Passed: {suite_result.passed_tests}",
+ f" Failed: {suite_result.failed_tests}",
+ f" Success Rate: {suite_result.success_rate:.1f}%",
+ f" Total Time: {suite_result.total_execution_time:.2f}s",
+ "",
+ ]
+ )
# Failed tests details
failed_results = suite_result.get_failed_results()
diff --git a/api/tests/unit_tests/services/test_workflow_variable_reference_validator.py b/api/tests/unit_tests/services/test_workflow_variable_reference_validator.py
index 6696e304c3c..94f85c8b97b 100644
--- a/api/tests/unit_tests/services/test_workflow_variable_reference_validator.py
+++ b/api/tests/unit_tests/services/test_workflow_variable_reference_validator.py
@@ -466,10 +466,13 @@ class TestFormatVariableReferenceErrors:
for index in range(11):
producer_id = f"p{index:02d}"
consumer_id = f"c{index:02d}"
- nodes.append(_node(producer_id, "tool", f"Producer {index:02d}"))
- nodes.append(_node(consumer_id, "llm", f"Consumer {index:02d}", selector=[producer_id, "text"]))
- edges.append(_edge("router", producer_id, "true"))
- edges.append(_edge("router", consumer_id, "false"))
+ nodes.extend(
+ (
+ _node(producer_id, "tool", f"Producer {index:02d}"),
+ _node(consumer_id, "llm", f"Consumer {index:02d}", selector=[producer_id, "text"]),
+ )
+ )
+ edges.extend((_edge("router", producer_id, "true"), _edge("router", consumer_id, "false")))
issues = validate_variable_references({"nodes": nodes, "edges": edges})
assert len(issues) == 11
message = format_variable_reference_errors(issues)