<commit_before>var _ = require('underscore'),
    EventEmitter = require('events').EventEmitter,
    fu = require('./fileUtil'),
    path = require('path'),
    watcher = require('./watcher');

function WatchManager() {
  EventEmitter.call(this);

  this.reset();

  this._exec = this.setupExec();
}

WatchManager.prototype = {
  configFile: function(path, mixins, callback) {
    if (_.isFunction(mixins)) {
      callback = mixins;
      mixins = undefined;
    }

    var self = this;
    watcher.watchFile(path, mixins || [], function() {
      self.emit('watch-change', {fileName: path, config: true});

      self.pushChange({callback: callback, fileName: path, config: true});
    });
  },
  moduleOutput: function(status, callback) {
    var self = this;

    function theWatcher(type, filename, sourceChange) {
      self.emit('watch-change', {fileName: sourceChange, output: status.fileName});
      self.pushChange({
        callback: callback,
        type: type,
        fileName: status.fileName,
        sourceChange: sourceChange
      });
    }

    var input = status.inputs.map(function(input) { return fu.resolvePath(input.dir || input); }),
        removed = _.difference(this.watching[status.fileName], input);

    if (removed.length) {
      watcher.unwatchFile(status.fileName, removed);
    }

    watcher.watchFile({ virtual: status.fileName }, input, theWatcher);
    this.watching[status.fileName] = input;
  },


  setupExec: function() {
    return _.debounce(_.bind(this.flushQueue, this), 500);
  },
  flushQueue: function() {<commit_msg>Fix incorrect function reference<commit_after>var _ = require('underscore'),
    EventEmitter = require('events').EventEmitter,
    fu = require('./fileUtil'),
    path = require('path'),
    watcher = require('./watcher');

function WatchManager() {
  EventEmitter.call(this);

  this.reset();

  this._exec = this.setupExec();
}

WatchManager.prototype = {
  configFile: function(path, mixins, callback) {
    if (_.isFunction(mixins)) {
      callback = mixins;
      mixins = undefined;
    }

    var self = this;
    watcher.watchFile(path, mixins || [], function() {
      self.emit('watch-change', {fileName: path, config: true});

      self.pushChange({callback: callback, fileName: path, config: true});
    });
  },
  moduleOutput: function(status, callback) {
    var self = this;

    function theWatcher(type, filename, sourceChange) {
      self.emit('watch-change', {fileName: sourceChange, output: status.fileName});
      self.pushChange({
        callback: callback,
        type: type,
        fileName: status.fileName,
        sourceChange: sourceChange
      });
    }

    var input = status.inputs.map(function(input) { return fu.resolvePath(input.dir || input); }),
        removed = _.difference(this.watching[status.fileName], input);

    if (removed.length) {
      watcher.unwatch(status.fileName, removed);
    }

    watcher.watchFile({ virtual: status.fileName }, input, theWatcher);
    this.watching[status.fileName] = input;
  },


  setupExec: function() {
    return _.debounce(_.bind(this.flushQueue, this), 500);
  },
  flushQueue: function() {
{'fraction_non_alphanumeric': 0.14887551472917326, 'fraction_numerical': 0.0019005384859043396, 'mean_word_length': 3.314207650273224, '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': '7017434', 'n_tokens_mistral': 945, 'n_tokens_neox': 944, 'n_words': 195}