Skip to content

Commit 9679f9b

Browse files
return aliases directly
1 parent 5d52ce9 commit 9679f9b

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/python/pathsim_utils.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,11 @@ def get_input_index(block: Block, edge: dict, block_to_input_index: dict) -> int
350350

351351
if edge["targetHandle"] is not None:
352352
if block._port_map_in:
353-
return block._port_map_in[edge["targetHandle"]]
353+
# aliases are not yet supported for subsystems
354+
if isinstance(block, pathsim.Subsystem):
355+
return block._port_map_in[edge["targetHandle"]]
356+
else:
357+
return edge["targetHandle"]
354358

355359
if isinstance(block, Function):
356360
return int(edge["targetHandle"].replace("target-", ""))
@@ -377,7 +381,11 @@ def get_output_index(block: Block, edge: dict) -> int:
377381
"""
378382
if edge["sourceHandle"] is not None:
379383
if block._port_map_out:
380-
return block._port_map_out[edge["sourceHandle"]]
384+
# aliases are not yet supported for subsystems
385+
if isinstance(block, pathsim.Subsystem):
386+
return block._port_map_out[edge["sourceHandle"]]
387+
else:
388+
return edge["sourceHandle"]
381389

382390
if isinstance(block, Splitter):
383391
# Splitter outputs are always in order, so we can use the handle directly
@@ -433,7 +441,7 @@ def make_connections(nodes, edges, blocks) -> list[Connection]:
433441
if edge["sourceHandle"]:
434442
label += f" ({edge['sourceHandle']})"
435443
target_block.labels.append(label)
436-
print(f"Connecting {source_block.id} output {output_index} to {target_block.id} input {input_index}")
444+
437445
connection = Connection(
438446
source_block[output_index],
439447
target_block[input_index],

0 commit comments

Comments
 (0)