Skip to content

Commit 245781d

Browse files
committed
improve logic
Signed-off-by: Thijs Baaijen <[email protected]>
1 parent 14d4584 commit 245781d

File tree

1 file changed

+2
-2
lines changed
  • src/power_grid_model_ds/_core/model/grids

1 file changed

+2
-2
lines changed

src/power_grid_model_ds/_core/model/grids/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ def get_typed_branches(self, branch_ids: list[int] | npt.NDArray[np.int32]) -> B
158158
raise ValueError("No branch_ids provided.")
159159
for branch_array in self.branch_arrays:
160160
array = branch_array.filter(branch_ids)
161-
if 0 < len(array) != len(branch_ids):
161+
if array.size > 0 and array.size != len(branch_ids):
162162
raise ValueError("Branches are not of the same type.")
163-
if len(array):
163+
if array.size:
164164
return array
165165
raise RecordDoesNotExist(f"Branches {branch_ids} not found in grid.")
166166

0 commit comments

Comments
 (0)