chore: cleanup ruff flake8-simplify linter rules (#8286)

Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
Bowen Liang
2024-09-12 12:55:45 +08:00
committed by GitHub
parent 0bb7569d46
commit 0f14873255
34 changed files with 108 additions and 136 deletions

View File

@@ -24,7 +24,7 @@ class AnswerStreamGeneratorRouter:
# parse stream output node value selectors of answer nodes
answer_generate_route: dict[str, list[GenerateRouteChunk]] = {}
for answer_node_id, node_config in node_id_config_mapping.items():
if not node_config.get("data", {}).get("type") == NodeType.ANSWER.value:
if node_config.get("data", {}).get("type") != NodeType.ANSWER.value:
continue
# get generate route for stream output

View File

@@ -17,7 +17,7 @@ class EndStreamGeneratorRouter:
# parse stream output node value selector of end nodes
end_stream_variable_selectors_mapping: dict[str, list[list[str]]] = {}
for end_node_id, node_config in node_id_config_mapping.items():
if not node_config.get("data", {}).get("type") == NodeType.END.value:
if node_config.get("data", {}).get("type") != NodeType.END.value:
continue
# skip end node in parallel

View File

@@ -20,7 +20,7 @@ class ToolEntity(BaseModel):
if not isinstance(value, dict):
raise ValueError("tool_configurations must be a dictionary")
for key in values.data.get("tool_configurations", {}).keys():
for key in values.data.get("tool_configurations", {}):
value = values.data.get("tool_configurations", {}).get(key)
if not isinstance(value, str | int | float | bool):
raise ValueError(f"{key} must be a string")