Skip to content

Commit 6ed33b0

Browse files
committed
another file
Signed-off-by: Thijs Baaijen <[email protected]>
1 parent 5b4dd78 commit 6ed33b0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/power_grid_model_ds/_core/model/graphs/container.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def delete_branch3(self, branch: Branch3Array) -> None:
9595
def make_active(self, branch: BranchArray) -> None:
9696
"""Add branch to all active_only graphs"""
9797

98-
from_node = branch.from_node.item()
99-
to_node = branch.to_node.item()
98+
from_node = branch["from_node"].item()
99+
to_node = branch["to_node"].item()
100100
for field in dataclasses.fields(self):
101101
graph = getattr(self, field.name)
102102
if graph.active_only:
@@ -105,8 +105,8 @@ def make_active(self, branch: BranchArray) -> None:
105105
def make_inactive(self, branch: BranchArray) -> None:
106106
"""Remove a branch from all active_only graphs"""
107107

108-
from_node = branch.from_node.item()
109-
to_node = branch.to_node.item()
108+
from_node = branch["from_node"].item()
109+
to_node = branch["to_node"].item()
110110
for field in dataclasses.fields(self):
111111
graph = getattr(self, field.name)
112112
if graph.active_only:
@@ -128,10 +128,10 @@ def from_arrays(cls, arrays: "Grid") -> "GraphContainer":
128128
@staticmethod
129129
def _validate_branches(arrays: "Grid") -> None:
130130
for array in arrays.branch_arrays:
131-
if any(~np.isin(array.from_node, arrays.node.id)):
132-
raise RecordDoesNotExist(f"Found invalid .from_node values in {array.__class__.__name__}")
133-
if any(~np.isin(array.to_node, arrays.node.id)):
134-
raise RecordDoesNotExist(f"Found invalid .to_node values in {array.__class__.__name__}")
131+
if any(~np.isin(array["from_node"], arrays.node["id"])):
132+
raise RecordDoesNotExist(f"Found invalid from_node values in {array.__class__.__name__}")
133+
if any(~np.isin(array["to_node"], arrays.node["id"])):
134+
raise RecordDoesNotExist(f"Found invalid to_node values in {array.__class__.__name__}")
135135

136136
def _append(self, array: FancyArray) -> None:
137137
if isinstance(array, NodeArray):

0 commit comments

Comments
 (0)