Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(py): Set output cont for Conditionals #1415

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions hugr-py/src/hugr/cond_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ def new_nested(
def _update_outputs(self, outputs: TypeRow) -> None:
if self.parent_op._outputs is None:
self.parent_op._outputs = outputs
self.parent_node = self.hugr._update_node_outs(
self.parent_node, len(outputs)
)
else:
if outputs != self.parent_op._outputs:
msg = "Mismatched case outputs."
Expand Down
5 changes: 4 additions & 1 deletion hugr-py/src/hugr/node_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@
start = index.start or 0
stop = index.stop or self._num_out_ports
if stop is None:
msg = "Stop must be specified when number of outputs unknown"
msg = (

Check warning on line 167 in hugr-py/src/hugr/node_port.py

View check run for this annotation

Codecov / codecov/patch

hugr-py/src/hugr/node_port.py#L167

Added line #L167 was not covered by tests
f"{self} does not have a fixed number of output ports. "
"Iterating over all output ports is not supported."
)
raise ValueError(msg)
step = index.step or 1
return (self[i] for i in range(start, stop, step))
Expand Down
Loading