@@ -78,22 +78,6 @@ def get_downstream_nodes(grid: "Grid", node_id: int, inclusive: bool = False):
7878 )
7979
8080
81- def _get_branches (grid : "Grid" , from_node : int , to_node : int ) -> BranchArray :
82- """Return active branch records and an index filtered to the requested path nodes."""
83-
84- active_branches = grid .branches .filter (from_status = 1 , to_status = 1 ).filter (
85- from_node = from_node , to_node = to_node , mode_ = "AND"
86- )
87- if grid .three_winding_transformer .size :
88- three_winding_active = grid .three_winding_transformer .as_branches ().filter (
89- from_status = 1 , to_status = 1 , from_node = from_node , to_node = to_node , mode_ = "AND"
90- )
91- if three_winding_active .size :
92- active_branches = fp .concatenate (active_branches , three_winding_active )
93-
94- return active_branches
95-
96-
9781def iter_branches_in_shortest_path (
9882 grid : "Grid" , from_node_id : int , to_node_id : int
9983) -> Iterator [BranchArray | Branch3Array ]:
@@ -115,6 +99,22 @@ def iter_branches_in_shortest_path(
11599 yield typed_branches
116100
117101
102+ def _get_branches (grid : "Grid" , from_node : int , to_node : int ) -> BranchArray :
103+ """Return active branch records and an index filtered to the requested path nodes."""
104+
105+ active_branches = grid .branches .filter (from_status = 1 , to_status = 1 ).filter (
106+ from_node = from_node , to_node = to_node , mode_ = "AND"
107+ )
108+ if grid .three_winding_transformer .size :
109+ three_winding_active = grid .three_winding_transformer .as_branches ().filter (
110+ from_status = 1 , to_status = 1 , from_node = from_node , to_node = to_node , mode_ = "AND"
111+ )
112+ if three_winding_active .size :
113+ active_branches = fp .concatenate (active_branches , three_winding_active )
114+
115+ return active_branches
116+
117+
118118def find_differences_between_grids (
119119 grid1 : "Grid" , grid2 : "Grid" , print_diff : bool = False
120120) -> dict [str , dict [str , object ]]:
0 commit comments