<commit_before>var AttacheCORSUpload = (function() {
  var counter = 0;

  AttacheCORSUpload.prototype.onComplete = function(uid, json) { };
  AttacheCORSUpload.prototype.onProgress = function(uid, json) { };
  AttacheCORSUpload.prototype.onError = function(uid, status) { alert(status); };

  function AttacheCORSUpload(options) {
    if (options == null) options = {};
    for (option in options) {
      this[option] = options[option];
    }
    this.handleFileSelect(options.file_element);
  }

  AttacheCORSUpload.prototype.handleFileSelect = function(file_element) {
    var f, files, output, _i, _len, _results, url, $ele;
    $ele = $(file_element);
    url = $ele.data('uploadurl');
    if ($ele.data('hmac')) {
      url = url +
            "?hmac=" + encodeURIComponent($ele.data('hmac')) +
            "&uuid=" + encodeURIComponent($ele.data('uuid')) +
            "&expiration=" + encodeURIComponent($ele.data('expiration')) +
            ""
    }

    files = file_element.files;
    output = [];
    _results = [];
    for (_i = 0, _len = files.length; _i < _len; _i++) {
      f = files[_i];
      f.uid = counter++;
      this.onProgress(f.uid, { filename: f.name, percentLoaded: 0, bytesLoaded: 0, bytesTotal: f.size });
      _results.push(this.performUpload(f, url));
    }
    return _results;
  };

  AttacheCORSUpload.prototype.createCORSRequest = function(method, url) {
    var xhr;
    xhr = new XMLHttpRequest();
    if (xhr.withCredentials != null) {
      xhr.open(method, url, true);
    } else if (typeof XDomainRequest !== "undefined") {
      xhr = new XDomainRequest();
      xhr.open(method, url);
    } else {
      xhr = null;
    }
    return xhr;
  };

  AttacheCORSUpload.prototype.performUpload = function(file, url) {<commit_msg>Fix AttacheCORSUpload assigned file UID should be more unique than regular counter - will clash with existing file (if we ever not reset "state.files")<commit_after>var AttacheCORSUpload = (function() {
  var counter = 0;

  AttacheCORSUpload.prototype.onComplete = function(uid, json) { };
  AttacheCORSUpload.prototype.onProgress = function(uid, json) { };
  AttacheCORSUpload.prototype.onError = function(uid, status) { alert(status); };

  function AttacheCORSUpload(options) {
    if (options == null) options = {};
    for (option in options) {
      this[option] = options[option];
    }
    this.handleFileSelect(options.file_element);
  }

  AttacheCORSUpload.prototype.handleFileSelect = function(file_element) {
    var f, files, output, _i, _len, _results, url, $ele, prefix;
    $ele = $(file_element);
    url = $ele.data('uploadurl');
    if ($ele.data('hmac')) {
      url = url +
            "?hmac=" + encodeURIComponent($ele.data('hmac')) +
            "&uuid=" + encodeURIComponent($ele.data('uuid')) +
            "&expiration=" + encodeURIComponent($ele.data('expiration')) +
            ""
    }

    prefix = Date.now() + "_";
    files = file_element.files;
    output = [];
    _results = [];
    for (_i = 0, _len = files.length; _i < _len; _i++) {
      f = files[_i];
      f.uid = prefix + (counter++);
      this.onProgress(f.uid, { filename: f.name, percentLoaded: 0, bytesLoaded: 0, bytesTotal: f.size });
      _results.push(this.performUpload(f, url));
    }
    return _results;
  };

  AttacheCORSUpload.prototype.createCORSRequest = function(method, url) {
    var xhr;
    xhr = new XMLHttpRequest();
    if (xhr.withCredentials != null) {
      xhr.open(method, url, true);
    } else if (typeof XDomainRequest !== "undefined") {
      xhr = new XDomainRequest();
      xhr.open(method, url);
    } else {
      xhr = null;
    }
    return xhr;
  };

  AttacheCORSUpload.prototype.performUpload = function(file, url) {
{'fraction_non_alphanumeric': 0.14959785522788205, 'fraction_numerical': 0.0021447721179624667, 'mean_word_length': 3.1045104510451047, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2880778', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1208, 'n_words': 256}