fix: type annotations and import sorting in flow modules

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2024-12-30 20:59:06 +00:00
parent 1ece057ffc
commit 4d93a60806
2 changed files with 9 additions and 9 deletions

View File

@@ -2,7 +2,7 @@ import ast
import inspect
import os
from pathlib import Path
from typing import Any, Callable, Dict, Optional, Tuple, cast
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, cast
from pyvis.network import Network
@@ -205,8 +205,8 @@ def compute_positions(flow: Flow[Any], node_levels: Dict[str, int],
Positions are calculated to maintain clear hierarchical structure while
ensuring optimal spacing and readability of the flow diagram.
"""
level_nodes = {}
node_positions = {}
level_nodes: Dict[int, List[str]] = {}
node_positions: Dict[str, Tuple[float, float]] = {}
for method_name, level in node_levels.items():
level_nodes.setdefault(level, []).append(method_name)
@@ -306,9 +306,9 @@ def add_edges(net: Network, flow: Flow[Any],
else:
edge_smooth = {"type": "cubicBezier"}
else:
edge_smooth = False
edge_smooth: Dict[str, Any] = {"type": "straight"}
edge_style = {
edge_style: Dict[str, Any] = {
"color": edge_color,
"width": 2,
"arrows": "to",
@@ -369,9 +369,9 @@ def add_edges(net: Network, flow: Flow[Any],
else:
edge_smooth = {"type": "cubicBezier"}
else:
edge_smooth = False
edge_smooth: Dict[str, Any] = {"type": "straight"}
edge_style = {
edge_style: Dict[str, Any] = {
"color": colors["router_edge"],
"width": 2,
"arrows": "to",