remove bare list, dict, Sequence, None, Any (#25058)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
Asuka Minato
2025-09-06 04:32:23 +09:00
committed by GitHub
parent 2b0695bdde
commit a78339a040
306 changed files with 787 additions and 817 deletions

View File

@@ -205,9 +205,7 @@ class Graph(BaseModel):
return graph
@classmethod
def _recursively_add_node_ids(
cls, node_ids: list[str], edge_mapping: dict[str, list[GraphEdge]], node_id: str
) -> None:
def _recursively_add_node_ids(cls, node_ids: list[str], edge_mapping: dict[str, list[GraphEdge]], node_id: str):
"""
Recursively add node ids
@@ -225,7 +223,7 @@ class Graph(BaseModel):
)
@classmethod
def _check_connected_to_previous_node(cls, route: list[str], edge_mapping: dict[str, list[GraphEdge]]) -> None:
def _check_connected_to_previous_node(cls, route: list[str], edge_mapping: dict[str, list[GraphEdge]]):
"""
Check whether it is connected to the previous node
"""
@@ -256,7 +254,7 @@ class Graph(BaseModel):
parallel_mapping: dict[str, GraphParallel],
node_parallel_mapping: dict[str, str],
parent_parallel: Optional[GraphParallel] = None,
) -> None:
):
"""
Recursively add parallel ids
@@ -461,7 +459,7 @@ class Graph(BaseModel):
level_limit: int,
parent_parallel_id: str,
current_level: int = 1,
) -> None:
):
"""
Check if it exceeds N layers of parallel
"""
@@ -488,7 +486,7 @@ class Graph(BaseModel):
edge_mapping: dict[str, list[GraphEdge]],
merge_node_id: str,
start_node_id: str,
) -> None:
):
"""
Recursively add node ids
@@ -614,7 +612,7 @@ class Graph(BaseModel):
@classmethod
def _recursively_fetch_routes(
cls, edge_mapping: dict[str, list[GraphEdge]], start_node_id: str, routes_node_ids: list[str]
) -> None:
):
"""
Recursively fetch route
"""

View File

@@ -47,7 +47,7 @@ class RouteNodeState(BaseModel):
index: int = 1
def set_finished(self, run_result: NodeRunResult) -> None:
def set_finished(self, run_result: NodeRunResult):
"""
Node finished
@@ -94,7 +94,7 @@ class RuntimeRouteState(BaseModel):
self.node_state_mapping[state.id] = state
return state
def add_route(self, source_node_state_id: str, target_node_state_id: str) -> None:
def add_route(self, source_node_state_id: str, target_node_state_id: str):
"""
Add route to the graph state

View File

@@ -66,7 +66,7 @@ class GraphEngineThreadPool(ThreadPoolExecutor):
initializer=None,
initargs=(),
max_submit_count=dify_config.MAX_SUBMIT_COUNT,
) -> None:
):
super().__init__(max_workers, thread_name_prefix, initializer, initargs)
self.max_submit_count = max_submit_count
self.submit_count = 0
@@ -80,7 +80,7 @@ class GraphEngineThreadPool(ThreadPoolExecutor):
def task_done_callback(self, future):
self.submit_count -= 1
def check_is_full(self) -> None:
def check_is_full(self):
if self.submit_count > self.max_submit_count:
raise ValueError(f"Max submit count {self.max_submit_count} of workflow thread pool reached.")
@@ -104,7 +104,7 @@ class GraphEngine:
max_execution_steps: int,
max_execution_time: int,
thread_pool_id: Optional[str] = None,
) -> None:
):
thread_pool_max_submit_count = dify_config.MAX_SUBMIT_COUNT
thread_pool_max_workers = 10
@@ -537,7 +537,7 @@ class GraphEngine:
parent_parallel_id: Optional[str] = None,
parent_parallel_start_node_id: Optional[str] = None,
handle_exceptions: list[str] = [],
) -> None:
):
"""
Run parallel nodes
"""