How to use the @jupyterlab/nbformat.isStream function in @jupyterlab/nbformat

To help you get started, we’ve selected a few @jupyterlab/nbformat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kubeflow-kale / kale / labextension / src / lib / CellUtils.ts View on Github external
}
    if (index < 0 || index >= notebook.model.cells.length) {
      throw new Error('Cell index out of range.');
    }
    const cell: ICellModel = notebook.model.cells.get(index);
    if (!isCodeCellModel(cell)) {
      throw new Error('cell is not a code cell.');
    }
    if (cell.outputs.length < 1) {
      return null;
    }
    const out = cell.outputs.toJSON().pop();
    if (isExecuteResult(out)) {
      return out.data['text/plain'];
    }
    if (isStream(out)) {
      return out.text;
    }
    if (isError(out)) {
      const errData: IError = out;

      throw new Error(
        `Code resulted in errors. Error name: ${errData.ename}.\nMessage: ${errData.evalue}.`,
      );
    }
  }

@jupyterlab/nbformat

Notebook format interfaces

BSD-3-Clause
Latest version published 24 days ago

Package Health Score

98 / 100
Full package analysis

Similar packages