chore: use 'XXX | None' instead of Optional[XXX] in graph.py

This commit is contained in:
-LAN- 2025-08-28 15:45:22 +08:00
parent c396788128
commit d7e0c5f759
No known key found for this signature in database
GPG Key ID: 6BA0D108DED011FF
1 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import logging
from collections import defaultdict
from collections.abc import Mapping
from typing import Any, Optional, Protocol, cast
from typing import Any, Protocol, cast
from core.workflow.enums import NodeType
from core.workflow.nodes.base.node import Node
@ -36,10 +36,10 @@ class Graph:
def __init__(
self,
*,
nodes: Optional[dict[str, Node]] = None,
edges: Optional[dict[str, Edge]] = None,
in_edges: Optional[dict[str, list[str]]] = None,
out_edges: Optional[dict[str, list[str]]] = None,
nodes: dict[str, Node] | None = None,
edges: dict[str, Edge] | None = None,
in_edges: dict[str, list[str]] | None = None,
out_edges: dict[str, list[str]] | None = None,
root_node: Node,
):
"""
@ -81,7 +81,7 @@ class Graph:
cls,
node_configs_map: dict[str, dict[str, Any]],
edge_configs: list[dict[str, Any]],
root_node_id: Optional[str] = None,
root_node_id: str | None = None,
) -> str:
"""
Find the root node ID if not specified.
@ -192,7 +192,7 @@ class Graph:
*,
graph_config: Mapping[str, Any],
node_factory: "NodeFactory",
root_node_id: Optional[str] = None,
root_node_id: str | None = None,
) -> "Graph":
"""
Initialize graph