def serialize_traceback(exc_type, exc_value, tb, **opts): return wl.OpenerView([ wl.Row([ safe_force_text(exc_type.__name__), " ", safe_force_text(exc_value) ]), wl.Style( wl.Column(_serialize_traceback(exc_type, exc_value, tb, **opts)), FontFamily="Courier") ], True)
def _serialize_frames(filename, function, pre_context, post_context, context_line, variables, lineno, pre_context_lineno, is_opened=False, **opts): if filename: description = wl.Row([ wl.Button( wl.Style(filename, wl.RGBColor(0.25, 0.48, 1), wl.Small, FontFamily="Courier"), wl.If(wl.FileExistsQ(filename), wl.SystemOpen(filename)), Appearance="Frameless", ), " in ", function, ]) else: description = function yield wl.OpenerView( [ description, wl.Column( iterate( (wl.Column( iterate( (_paginate(pre_context_lineno + i, l) for i, l in enumerate(pre_context)), [ wl.Item( _paginate(lineno, context_line), Background=wl.LightYellow, ) ], (_paginate(lineno + i + 1, l) for i, l in enumerate(post_context)), ), Background=[[wl.GrayLevel(0.95), wl.GrayLevel(1)]], Frame=wl.LightGray, ), ), _serialize_variables(variables), )), ], is_opened, )
def wl_print(*payload): return wl_side_effect(wl.Print(wl.Row(riffle(payload, " "))))