<commit_before>var repls = require('repl');
var util = require('util');

var debug = util.debuglog('amok-repl');

function plugin(input, output, options) {
  if (typeof options === 'undefined') {
    options = {};
  }

  return function repl(client, runner, done) {
    debug('start');
    var repl = repls.start({
      input: input,
      output: output,
      useColors: options.useColors
    });

    repl.on('exit', function() {
      runner.close();
    });

    repl.writer = function (output) {
      if (!output) {
        return '';
      }

      var result = output.result;

      if (result.value === 'null') {
        return util.inspect(null, { colors: repl.useColors });
      } else if (result.type === 'undefined') {
        return util.inspect(undefined, { colors: repl.useColors });
      } else if (result.value !== undefined) {
        return util.inspect(result.value, { colors: repl.useColors });
      } else if (result.type === 'function') {
        return '[Function]';
      } else if (result.type === 'object') {
        return '[Object]';
      }
    };

    repl.eval = function (cmd, context, filename, callback) {
      client.runtime.evaluate(cmd, callback);
    };

    repl.complete = function (line, callback) {
      callback([], line);
    };

    client.console.on('data', function (chunk) {
      repl.output.clearLine();
      repl.output.cursorTo(0);
      repl.output.write(chunk + '\n');
      repl.prompt(true);
    });

    client.on('attach', function () {
      client.runtime.enable(function (error) {
        if (error) {
          return client.emit('error');
        }

        debug('runtime');
      });
    });

    debug('ready');
    done();
  };
}

module.exports = plugin;<commit_msg>Fix bad repl client event name<commit_after>var repls = require('repl');
var util = require('util');

var debug = util.debuglog('amok-repl');

function plugin(input, output, options) {
  if (typeof options === 'undefined') {
    options = {};
  }

  return function repl(client, runner, done) {
    debug('start');
    var repl = repls.start({
      input: input,
      output: output,
      useColors: options.useColors
    });

    repl.on('exit', function() {
      runner.close();
    });

    repl.writer = function (output) {
      if (!output) {
        return '';
      }

      var result = output.result;

      if (result.value === 'null') {
        return util.inspect(null, { colors: repl.useColors });
      } else if (result.type === 'undefined') {
        return util.inspect(undefined, { colors: repl.useColors });
      } else if (result.value !== undefined) {
        return util.inspect(result.value, { colors: repl.useColors });
      } else if (result.type === 'function') {
        return '[Function]';
      } else if (result.type === 'object') {
        return '[Object]';
      }
    };

    repl.eval = function (cmd, context, filename, callback) {
      client.runtime.evaluate(cmd, callback);
    };

    repl.complete = function (line, callback) {
      callback([], line);
    };

    client.console.on('data', function (chunk) {
      repl.output.clearLine();
      repl.output.cursorTo(0);
      repl.output.write(chunk + '\n');
      repl.prompt(true);
    });

    client.on('connect', function () {
      client.runtime.enable(function (error) {
        if (error) {
          return client.emit('error');
        }

        debug('runtime');
      });
    });

    debug('ready');
    done();
  };
}

module.exports = plugin;
{'fraction_non_alphanumeric': 0.16942384483742157, 'fraction_numerical': 0.0005704506560182544, 'mean_word_length': 2.378612716763006, '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': '1112469', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1058, 'n_words': 234}