<commit_before>
var vm = require('vm');
var path = require('path');
var fs = require('fs');

function isLegacyVM() {
  // vm.isContext was added in 0.12.x
  return vm.isContext === undefined;
}

function createContext(sandbox) {
  if (isLegacyVM()) {
    var Contextify = require('contextify');
    Contextify(sandbox);
  } else {
    vm.createContext(sandbox);
  }
}

function runInSandbox(filePath, sandbox) {
  var fullPath = path.resolve(filePath);
  var fileContent = fs.readFileSync(fullPath, 'utf8');

  if (isLegacyVM()) {
    sandbox.run(fileContent, fullPath);
  } else {
    var fileScript = new vm.Script(fileContent, { filename: fullPath });
    fileScript.runInContext(sandbox);
  }
}

function createSandbox(dependencies) {
  var wrappedConsole =  Object.create(console);
  wrappedConsole.error = function() {
    console.error.apply(console, Array.prototype.map.call(arguments, function(a) {<commit_msg>Forgot to require the chalk dependancy<commit_after>
var vm = require('vm');
var path = require('path');
var fs = require('fs');
var chalk = require('chalk');

function isLegacyVM() {
  // vm.isContext was added in 0.12.x
  return vm.isContext === undefined;
}

function createContext(sandbox) {
  if (isLegacyVM()) {
    var Contextify = require('contextify');
    Contextify(sandbox);
  } else {
    vm.createContext(sandbox);
  }
}

function runInSandbox(filePath, sandbox) {
  var fullPath = path.resolve(filePath);
  var fileContent = fs.readFileSync(fullPath, 'utf8');

  if (isLegacyVM()) {
    sandbox.run(fileContent, fullPath);
  } else {
    var fileScript = new vm.Script(fileContent, { filename: fullPath });
    fileScript.runInContext(sandbox);
  }
}

function createSandbox(dependencies) {
  var wrappedConsole =  Object.create(console);
  wrappedConsole.error = function() {
    console.error.apply(console, Array.prototype.map.call(arguments, function(a) {
{'fraction_non_alphanumeric': 0.13946117274167988, 'fraction_numerical': 0.004226096143687269, 'mean_word_length': 4.473988439306359, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2828233', 'n_tokens_mistral': 634, 'n_tokens_neox': 612, 'n_words': 132}