How to use the @nteract/commutable.monocellNotebook.setIn function in @nteract/commutable

To help you get started, we’ve selected a few @nteract/commutable 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 nteract / nteract / applications / desktop / __tests__ / renderer / epics / loading.spec.ts View on Github external
? "\\home\\whatever\\Untitled.ipynb"
      : "/home/whatever/Untitled.ipynb";

    expect(responseActions).toEqual([
      {
        type: actions.FETCH_CONTENT_FULFILLED,
        payload: {
          contentRef: "cRef",
          kernelRef: "kRef",
          filepath: filepath,
          model: {
            type: "notebook",
            mimetype: "application/x-ipynb+json",
            format: "json",
            content: toJS(
              monocellNotebook
                .setIn(["metadata", "kernel_info", "name"], "hylang")
                .setIn(["metadata", "language_info", "name"], "hylang")
            ),
            writable: true,
            name: "Untitled.ipynb",
            path: filepath,
            created: expect.any(String),
            last_modified: expect.any(String)
          }
        }
      }
    ]);
  });
});
github nteract / nteract / applications / desktop / __tests__ / renderer / epics / loading.spec.ts View on Github external
? "\\home\\whatever2\\some.ipynb"
        : "/home/whatever2/some.ipynb";

    expect(responseActions).toEqual([
      {
        type: actions.FETCH_CONTENT_FULFILLED,
        payload: {
          contentRef: "cRef",
          kernelRef: "kRef",
          filepath,
          model: {
            type: "notebook",
            mimetype: "application/x-ipynb+json",
            format: "json",
            content: toJS(
              monocellNotebook
                .setIn(["metadata", "kernel_info", "name"], "hylang")
                .setIn(["metadata", "language_info", "name"], "hylang")
            ),
            writable: true,
            name: "some.ipynb",
            path: filepath,
            created: expect.any(String),
            last_modified: expect.any(String)
          }
        }
      }
    ]);
  });
});
github nteract / nteract / packages / core / src / dummy / index.js View on Github external
function buildDummyNotebook(config) {
  let notebook = monocellNotebook.setIn(
    ["metadata", "kernelspec", "name"],
    "python2"
  );

  if (config) {
    if (config.codeCellCount) {
      for (let i = 1; i < config.codeCellCount; i++) {
        notebook = appendCellToNotebook(notebook, emptyCodeCell);
      }
    }

    if (config.markdownCellCount) {
      for (let i = 0; i < config.markdownCellCount; i++) {
        notebook = appendCellToNotebook(
          notebook,
          emptyCodeCell.set("cell_type", "markdown")
github nteract / nteract / packages / fixtures / src / index.ts View on Github external
function buildFixtureNotebook(config: JSONObject) {
  let notebook = monocellNotebook.setIn(
    ["metadata", "kernelspec", "name"],
    "python2"
  );

  if (config) {
    if (config.codeCellCount) {
      for (let i = 1; i < config.codeCellCount; i++) {
        notebook = appendCellToNotebook(notebook, emptyCodeCell);
      }
    }

    if (config.markdownCellCount) {
      for (let i = 0; i < config.markdownCellCount; i++) {
        notebook = appendCellToNotebook(
          notebook,
          emptyMarkdownCell.set("cell_type", "markdown")