<commit_before>var path = require('path');
var through2 = require('through2');
var PluginError = require('gulp-util').PluginError;
var colors = require('gulp-util').colors;
var log = require('gulp-util').log;
var QN = require('qn');
var Moment = require('moment');
var fs = require('fs');
var Q = require('q');
var util = require('util')

module.exports = function (qiniu, option) {
  option = option || {};
  option = extend({dir: '', versioning: false, versionFile: null}, option);

  var qn = QN.create(qiniu)
    , version = Moment().format('YYMMDDHHmm')
    , filesTotal = 0
    , filesSuccessTotal = 0
    , qs = [];

  return through2.obj(function (file, enc, next) {
    var that = this;
    if (file._contents === null) return next();
    filesTotal++;

    var filePath = path.relative(file.base, file.path);
    var fileKey = option.dir + (option.dir[option.dir.length - 1] === '/' ? '' : '/') + (option.versioning ? version + '/' : '') + filePath;

    qs.push(Q.nbind(qn.upload, qn)(file._contents, {key: fileKey})
      .then(function () {
        filesSuccessTotal++;
        log('Uploaded', colors.green(filePath), '→', colors.green(fileKey));
      }, function (err) {
        that.emit('error', new PluginError('gulp-qiniu', err));
      }));

    next();
  }, function () {
    Q.all(qs)
      .then(function (rets) {
        log('Total uploaded:', colors.green(rets.length));
        if (!option.versioning) return;
        log('Version:', colors.green(version));

        if (option.versionFile) {
          fs.writeFileSync(option.versionFile, JSON.stringify({version: version}))
          log('Write version file:', colors.green(option.versionFile));
        }
      }, function (err) {
        log('Failed upload files:', err.message);
      });
  });

  function extend (target, source) {
    target = target || {};
    for (var prop in source) {
      if (typeof source[prop] === 'object') {
        target[prop] = extend(target[prop], source[prop]);
      } else {
        target[prop] = source[prop];
      }
    }
    return target;
  }
};<commit_msg>Remove unused variables, force update<commit_after>var path = require('path');
var through2 = require('through2');
var PluginError = require('gulp-util').PluginError;
var colors = require('gulp-util').colors;
var log = require('gulp-util').log;
var QN = require('qn');
var Moment = require('moment');
var fs = require('fs');
var Q = require('q');
var util = require('util')

module.exports = function (qiniu, option) {
  option = option || {};
  option = extend({dir: '', versioning: false, versionFile: null}, option);

  var qn = QN.create(qiniu)
    , version = Moment().format('YYMMDDHHmm')
    , qs = [];

  return through2.obj(function (file, enc, next) {
    var that = this;
    if (file._contents === null) return next();

    var filePath = path.relative(file.base, file.path);
    var fileKey = option.dir + ((!option.dir || option.dir[option.dir.length - 1]) === '/' ? '' : '/') + (option.versioning ? version + '/' : '') + filePath;

    qs.push(Q.nbind(qn.delete, qn)(fileKey)
      .then(function () {
        return Q.nbind(qn.upload, qn)(file._contents, {key: fileKey})
      })
      .then(function () {
        log('Uploaded', colors.green(filePath), '→', colors.green(fileKey));
      }, function (err) {
        that.emit('error', new PluginError('gulp-qiniu', err));
      }));

    next();
  }, function () {
    Q.all(qs)
      .then(function (rets) {
        log('Total uploaded:', colors.green(rets.length));
        if (!option.versioning) return;
        log('Version:', colors.green(version));

        if (option.versionFile) {
          fs.writeFileSync(option.versionFile, JSON.stringify({version: version}))
          log('Write version file:', colors.green(option.versionFile));
        }
      }, function (err) {
        log('Failed upload files:', err.message);
      });
  });

  function extend(target, source) {
    target = target || {};
    for (var prop in source) {
      if (typeof source[prop] === 'object') {
        target[prop] = extend(target[prop], source[prop]);
      } else {
        target[prop] = source[prop];
      }
    }
    return target;
  }
};
{'fraction_non_alphanumeric': 0.18418537983755376, 'fraction_numerical': 0.0023889154323936935, 'mean_word_length': 3.02209414024976, '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': '2662505', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1305, 'n_words': 294}