<commit_before>// https://github.com/nteract/nteract/issues/389
import CodeMirror from "codemirror";

import "codemirror/mode/meta";
import "codemirror/mode/python/python";

CodeMirror.defineMode(
  "ipython",
  (
    conf: CodeMirror.EditorConfiguration,
    parserConf: any
  ): CodeMirror.Mode<any> => {
    const ipythonConf = Object.assign({}, parserConf, {
      name: "python",
      singleOperators: new RegExp("^[\\+\\-\\*/%&|@\\^~<>!\\?]"),
      identifiers: new RegExp(
        "^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"
      ) // Technically Python3
    });
    return CodeMirror.getMode(conf, ipythonConf);
  },
  "python"
);

CodeMirror.defineMIME("text/x-ipython", "ipython");<commit_msg>ignore defineMIME and defineMode typescript bits<commit_after>// https://github.com/nteract/nteract/issues/389
import CodeMirror from "codemirror";

import "codemirror/mode/meta";
import "codemirror/mode/python/python";

// The TypeScript definitions are missing these versions
// of the codemirror define* functions that IPython uses for
// highlighting magics
// @ts-ignore
CodeMirror.defineMode(
  "ipython",
  (
    conf: CodeMirror.EditorConfiguration,
    parserConf: any
  ): CodeMirror.Mode<any> => {
    const ipythonConf = Object.assign({}, parserConf, {
      name: "python",
      singleOperators: new RegExp("^[\\+\\-\\*/%&|@\\^~<>!\\?]"),
      identifiers: new RegExp(
        "^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"
      ) // Technically Python3
    });
    return CodeMirror.getMode(conf, ipythonConf);
  },
  "python"
);

// @ts-ignore
CodeMirror.defineMIME("text/x-ipython", "ipython");
{'fraction_non_alphanumeric': 0.1795343137254902, 'fraction_numerical': 0.014705882352941176, 'mean_word_length': 3.4986225895316805, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '5431914', 'n_tokens_mistral': 621, 'n_tokens_neox': 591, 'n_words': 100}