3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00

Support repr_html for jupyter

This commit is contained in:
Arie Gurfinkel 2019-09-07 16:59:51 +03:00 committed by Nikolaj Bjorner
parent 228d68f165
commit e881c4af3f

View file

@ -296,6 +296,14 @@ class Z3PPObject:
def use_pp(self): def use_pp(self):
return True return True
def _repr_html_(self):
in_html = in_html_mode()
set_html_mode(True)
res = repr(self)
set_html_mode(in_html)
return res
class AstRef(Z3PPObject): class AstRef(Z3PPObject):
"""AST are Direct Acyclic Graphs (DAGs) used to represent sorts, declarations and expressions.""" """AST are Direct Acyclic Graphs (DAGs) used to represent sorts, declarations and expressions."""
def __init__(self, ast, ctx=None): def __init__(self, ast, ctx=None):
@ -6418,6 +6426,13 @@ class CheckSatResult:
else: else:
return "unknown" return "unknown"
def _repr_html_(self):
in_html = in_html_mode()
set_html_mode(True)
res = repr(self)
set_html_mode(in_html)
return res
sat = CheckSatResult(Z3_L_TRUE) sat = CheckSatResult(Z3_L_TRUE)
unsat = CheckSatResult(Z3_L_FALSE) unsat = CheckSatResult(Z3_L_FALSE)
unknown = CheckSatResult(Z3_L_UNDEF) unknown = CheckSatResult(Z3_L_UNDEF)