Skip to content

Commit

Permalink
stop iteration when module instance found
Browse files Browse the repository at this point in the history
  • Loading branch information
farmio committed Nov 2, 2023
1 parent 7442fe0 commit e6fb4b2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions xknxproject/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,16 @@ def _add_com_object_instance_numbers(self) -> None:
or coir.number is None # only for type safety
):
continue
for mi in self.module_instances:
if coir.ref_id.startswith(f"{mi.identifier}_"):
coir.number += next(
int(arg.value)
for arg in mi.arguments
if arg.ref_id == coir.base_number_argument_ref
)
_module_instance = next(
mi
for mi in self.module_instances
if coir.ref_id.startswith(f"{mi.identifier}_")
)
coir.number += next(
int(arg.value)
for arg in _module_instance.arguments
if arg.ref_id == coir.base_number_argument_ref
)

def apply_module_instance_arguments(self) -> None:
"""Apply module instance arguments."""
Expand Down

0 comments on commit e6fb4b2

Please sign in to comment.