<commit_before>// @flow
import * as Immutable from "immutable";

import { emptyNotebook } from "@nteract/commutable";

export type DocumentRecordProps = {
  type: "notebook",
  // TODO: This _needs_ to become a Record
  notebook: Immutable.Map<string, any>,
  savedNotebook: Immutable.Map<string, any>,
  transient: Immutable.Map<string, any>, // has the keypaths for updating displays
  // transient should be more fully typed (be a record itself)
  // right now it's keypaths and then it looks like it's able to handle any per
  // cell transient data that will be deleted when the kernel is restarted
  cellPagers: any,
  editorFocused: any,
  cellFocused: any,
  copied: Immutable.Map<any, any>
};
export const makeDocumentRecord: Immutable.RecordFactory<
  DocumentRecordProps
> = Immutable.Record({
  type: "notebook",
  notebook: emptyNotebook,
  savedNotebook: emptyNotebook,
  transient: Immutable.Map({
    keyPathsForDisplays: Immutable.Map()
  }),
  cellPagers: Immutable.Map(),
  editorFocused: null,
  cellFocused: null,
  copied: Immutable.Map()
});
export type DocumentRecord = Immutable.RecordOf<DocumentRecordProps>;

export type NotebookContentRecordProps = {
  mimetype: ?string,
  created: ?Date,
  format: "json",
  lastSaved: ?Date,
  model: DocumentRecord,
  filepath: string,
  type: "notebook",
  writable: boolean
};

export const makeNotebookContentRecord: Immutable.RecordFactory<
  NotebookContentRecordProps
> = Immutable.Record({
  mimetype: null,
  created: null,
  format: "json",
  lastSaved: null,
  model: makeDocumentRecord(),
  filepath: "",
  type: "notebook",
  writable: true
});

export type NotebookContentRecord = Immutable.RecordOf<
  NotebookContentRecordProps<commit_msg>keep kernelRef in the notebook model<commit_after>// @flow
import * as Immutable from "immutable";

import { emptyNotebook } from "@nteract/commutable";

import type { KernelRef } from "../..";

export type DocumentRecordProps = {
  type: "notebook",
  // TODO: This _needs_ to become a Record
  notebook: Immutable.Map<string, any>,
  savedNotebook: Immutable.Map<string, any>,
  transient: Immutable.Map<string, any>, // has the keypaths for updating displays
  // transient should be more fully typed (be a record itself)
  // right now it's keypaths and then it looks like it's able to handle any per
  // cell transient data that will be deleted when the kernel is restarted
  cellPagers: any,
  editorFocused: any,
  cellFocused: any,
  copied: Immutable.Map<any, any>,
  kernelRef: ?KernelRef
};
export const makeDocumentRecord: Immutable.RecordFactory<
  DocumentRecordProps
> = Immutable.Record({
  type: "notebook",
  notebook: emptyNotebook,
  savedNotebook: emptyNotebook,
  transient: Immutable.Map({
    keyPathsForDisplays: Immutable.Map()
  }),
  cellPagers: Immutable.Map(),
  editorFocused: null,
  cellFocused: null,
  copied: Immutable.Map(),
  kernelRef: null
});
export type DocumentRecord = Immutable.RecordOf<DocumentRecordProps>;

export type NotebookContentRecordProps = {
  mimetype: ?string,
  created: ?Date,
  format: "json",
  lastSaved: ?Date,
  model: DocumentRecord,
  filepath: string,
  type: "notebook",
  writable: boolean
};

export const makeNotebookContentRecord: Immutable.RecordFactory<
  NotebookContentRecordProps
> = Immutable.Record({
  mimetype: null,
  created: null,
  format: "json",
  lastSaved: null,
  model: makeDocumentRecord(),
  filepath: "",
  type: "notebook",
  writable: true
});

export type NotebookContentRecord = Immutable.RecordOf<
  NotebookContentRecordProps
{'fraction_non_alphanumeric': 0.10575296108291032, 'fraction_numerical': 0.0, 'mean_word_length': 4.730210016155089, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1212360', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1097, 'n_words': 326}