Skip to content

Commit 68df8b0

Browse files
committed
wip
1 parent 859c811 commit 68df8b0

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

hugr-py/src/hugr/passes/_composable_pass.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from copy import deepcopy
99
from dataclasses import dataclass
10-
from typing import TYPE_CHECKING, Protocol, runtime_checkable
10+
from typing import TYPE_CHECKING, Any, Protocol, TypeVar, runtime_checkable
1111

1212
if TYPE_CHECKING:
1313
from collections.abc import Callable
@@ -110,3 +110,24 @@ def apply_inplace(hugr: Hugr) -> None:
110110
@property
111111
def name(self) -> str:
112112
return f"Composed({ ', '.join(pass_.name for pass_ in self.passes) })"
113+
114+
115+
@dataclass
116+
class PassResult:
117+
"""The result of a series of composed passes applied to a HUGR.
118+
119+
Includes a flag indicating whether the passes modified the HUGR, and an
120+
arbitrary result object for each pass.
121+
122+
In some cases, `modified` may be set to `True` even if the pass did not
123+
modify the program.
124+
125+
:param modified: Whether the passes modified the HUGR.
126+
:param results: The result of each applied pass, as a tuple of the pass and
127+
the result.
128+
"""
129+
130+
hugr: Hugr
131+
modified: bool
132+
inline: bool
133+
results: list[tuple[ComposablePass, Any]]

0 commit comments

Comments
 (0)