Exemple #1
0
def render(cell,val):
    print "RENDER %s"%cell
    if hasattr(val, 'to_js'):
        val2 = ["html", val.to_js()]
    elif type(val) == list:
        val2 = ["list", val]
    else:
        val2 = ["text", str(val)]
    plots = pt.get_plots()
    if (len(plots) > 0):
        js.globals['PLOTS'][cell] = js.convert(plots)
    js.globals['RESULTS'][cell] = js.convert(val2)
Exemple #2
0
def checkpoint(cell, val, local):
    import js
    import matplotlib.pyplot as pt
    if hasattr(val, 'to_js') and type(val) != type:
        val2 = ["html", val.to_js()]
    else:
        val2 = ["text", str(val)]
    plots = pt.get_plots()
    if (len(plots) > 0):
        js.globals['PLOTS'] = js.convert(plots)
    js.globals['RESULTS'] = js.convert(val2)
    types = dict([[k, {"name": k, "reflection": livebook_inspect(local[k])}] for k in local.keys()])
    js.globals['LOCALS'][cell] = js.convert(types)
Exemple #3
0
def checkpoint(cell, val, local):
    import js
    import matplotlib.pyplot as pt
    if hasattr(val, 'to_js') and type(val) != type:
        val2 = ["html", val.to_js()]
    else:
        val2 = ["text", str(val)]
    plots = pt.get_plots()
    if (len(plots) > 0):
        js.globals['PLOTS'] = js.convert(plots)
    js.globals['RESULTS'] = js.convert(val2)
    types = dict([[k, {
        "name": k,
        "reflection": livebook_inspect(local[k])
    }] for k in local.keys()])
    js.globals['LOCALS'][cell] = js.convert(types)