Search in sources :

Example 6 with MIMEContainer

use of com.twosigma.beakerx.mimetype.MIMEContainer in project beakerx by twosigma.

the class MessageCreator method showResult.

private static boolean showResult(SimpleEvaluationObject seo) {
    boolean ret = true;
    if (seo != null && seo.getPayload() != null && seo.getPayload() instanceof MIMEContainer) {
        MIMEContainer input = (MIMEContainer) seo.getPayload();
        ret = !MIMEContainer.MIME.HIDDEN.equals(input.getMime().asString());
    } else if ((seo != null && !seo.getOutputdata().isEmpty())) {
        ret = true;
    }
    return ret;
}
Also used : MIMEContainer(com.twosigma.beakerx.mimetype.MIMEContainer)

Example 7 with MIMEContainer

use of com.twosigma.beakerx.mimetype.MIMEContainer in project beakerx by twosigma.

the class CompiledCodeRunner method runCompiledCodeAndPublish.

public static void runCompiledCodeAndPublish(Message message, ExecuteCompiledCode handler, Object... params) {
    final SimpleEvaluationObject seo = initOutput(message);
    InternalVariable.setValue(seo);
    KernelManager.get().publish(singletonList(MessageCreator.buildClearOutput(message, true)));
    try {
        Object result = handler.executeCode(params);
        if (result != null) {
            List<MIMEContainer> resultString = MIMEContainerFactory.createMIMEContainers(result);
            KernelManager.get().publish(singletonList(MessageCreator.buildDisplayData(message, resultString)));
        }
    } catch (Exception e) {
        printError(message, seo, e);
    }
    seo.clrOutputHandler();
}
Also used : MIMEContainer(com.twosigma.beakerx.mimetype.MIMEContainer) SimpleEvaluationObject(com.twosigma.beakerx.jvm.object.SimpleEvaluationObject) SimpleEvaluationObject(com.twosigma.beakerx.jvm.object.SimpleEvaluationObject)

Aggregations

MIMEContainer (com.twosigma.beakerx.mimetype.MIMEContainer)7 MagicCommandResult (com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandResult)2 Map (java.util.Map)2 Plot (com.twosigma.beakerx.chart.xychart.Plot)1 XYGraphics (com.twosigma.beakerx.chart.xychart.plotitem.XYGraphics)1 SimpleEvaluationObject (com.twosigma.beakerx.jvm.object.SimpleEvaluationObject)1 Kernel (com.twosigma.beakerx.kernel.Kernel)1 MagicCommandOutput (com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandOutput)1 HIDDEN (com.twosigma.beakerx.mimetype.MIMEContainer.HIDDEN)1 Text (com.twosigma.beakerx.mimetype.MIMEContainer.Text)1 TableDisplay (com.twosigma.beakerx.table.TableDisplay)1 DisplayableWidget (com.twosigma.beakerx.widget.DisplayableWidget)1 Collection (java.util.Collection)1 Collections.singletonList (java.util.Collections.singletonList)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Displayers (jupyter.Displayers)1 Test (org.junit.Test)1