Skip to content

Commit 3c808d0

Browse files
Merge origin/main into upgrade-egglog
2 parents 2befa89 + 60d5435 commit 3c808d0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

python/egglog/egraph.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,7 @@ def saturate(
11881188
*,
11891189
expr: Expr | None = None,
11901190
max: int = 1000,
1191+
visualize: bool = True,
11911192
**kwargs: Unpack[GraphvizKwargs],
11921193
) -> None:
11931194
"""
@@ -1203,18 +1204,22 @@ def to_json() -> str:
12031204
print(self.extract(expr), "\n")
12041205
return self._serialize(**kwargs).to_json()
12051206

1206-
egraphs = [to_json()]
1207+
if visualize:
1208+
egraphs = [to_json()]
12071209
i = 0
12081210
# Always visualize, even if we encounter an error
12091211
try:
12101212
while (self.run(schedule or 1).updated) and i < max:
12111213
i += 1
1212-
egraphs.append(to_json())
1214+
if visualize:
1215+
egraphs.append(to_json())
12131216
except:
1214-
egraphs.append(to_json())
1217+
if visualize:
1218+
egraphs.append(to_json())
12151219
raise
12161220
finally:
1217-
VisualizerWidget(egraphs=egraphs).display_or_open()
1221+
if visualize:
1222+
VisualizerWidget(egraphs=egraphs).display_or_open()
12181223

12191224
@classmethod
12201225
def current(cls) -> EGraph:

0 commit comments

Comments
 (0)