PassResult¶
- class hugr.passes.composable.PassResult(hugr: Hugr, inplace: bool = False, modified: bool = False, results: list[tuple[PassName, Any]] = <factory>)[source]¶
Bases:
objectThe result of a series of composed passes applied to a HUGR.
Includes a flag indicating whether the passes modified the HUGR, and an arbitrary result object for each pass.
- Attr hugr:
The transformed Hugr.
- Attr inplace:
Whether the pass was applied inplace. If this is True, hugr will be the same object passed as input. If this is False, hugr will be an independent copy of the original Hugr.
- Attr modified:
Whether the pass made changes to the HUGR. If False, hugr will have the same contents as the original Hugr. If True, no guarantees are made about the contents of hugr.
- Attr results:
The result of each applied pass, as a tuple of the pass name and the result.
Methods
Create a new PassResult after a pass application.
Extend the PassResult with the results of another PassResult.
Attributes
inplacemodifiedhugrresults- classmethod for_pass(composable_pass: ComposablePass, hugr: Hugr, *, result: Any, inplace: bool, modified: bool = True) PassResult[source]¶
Create a new PassResult after a pass application.
- Parameters:
hugr – The Hugr that was transformed.
composable_pass – The pass that was applied.
result – The result of the pass application.
inplace – Whether the pass was applied inplace.
modified – Whether the pass modified the HUGR.
- then(other: PassResult) PassResult[source]¶
Extend the PassResult with the results of another PassResult.
Keeps the hugr returned by the last pass.