<commit_before>/**
 * @ngdoc service
 * @name predicsis.jsSDK.helpers.s3FileHelper
 * @require $injector
 * - Uploads
 */
angular
  .module('predicsis.jsSDK.helpers')
  .service('s3FileHelper', function($injector) {
    'use strict';

    var Upload = $injector.get('Uploads');
    var files = [];
    var progressHandlers = [];
    var endHandlers = [];
    var errorHandlers = [];
    var requests = [];

    function findFileIndex(file) {
      var index = files.indexOf(file);
      if(index === -1) {
        files.push(file);
        index = files.length - 1;
      }
      return index;
    }

    function progressHandler(fileIndex, evt) {
      if(progressHandlers[fileIndex]) {
        progressHandlers[fileIndex](evt);
      }
    }

    function endHandler(fileIndex, evt) {
      if(endHandlers[fileIndex]) {
        endHandlers[fileIndex](evt);
      }
    }

    function errorHandler(fileIndex, err) {
      if(errorHandlers[fileIndex]) {
        errorHandlers[fileIndex](err);
      }
    }

    function clean(fileIndex) {
      delete progressHandlers[fileIndex];
      delete files[fileIndex];
      delete requests[fileIndex];
    }

    function abort(file) {
      var fileIndex = findFileIndex(file);
      if(requests[filesIndex]) {
        requests[filesIndex].abort();
      }
    }

    function addProgressListener(file, cb) {
      var fileIndex = findFileIndex(file);
      progressHandlers[fileIndex] = cb;
    }

    function addEndListener(file, cb) {
      var fileIndex = findFileIndex(file);
      endHandlers[fileIndex] = cb;<commit_msg>fix typo<commit_after>/**
 * @ngdoc service
 * @name predicsis.jsSDK.helpers.s3FileHelper
 * @require $injector
 * - Uploads
 */
angular
  .module('predicsis.jsSDK.helpers')
  .service('s3FileHelper', function($injector) {
    'use strict';

    var Upload = $injector.get('Uploads');
    var files = [];
    var progressHandlers = [];
    var endHandlers = [];
    var errorHandlers = [];
    var requests = [];

    function findFileIndex(file) {
      var index = files.indexOf(file);
      if(index === -1) {
        files.push(file);
        index = files.length - 1;
      }
      return index;
    }

    function progressHandler(fileIndex, evt) {
      if(progressHandlers[fileIndex]) {
        progressHandlers[fileIndex](evt);
      }
    }

    function endHandler(fileIndex, evt) {
      if(endHandlers[fileIndex]) {
        endHandlers[fileIndex](evt);
      }
    }

    function errorHandler(fileIndex, err) {
      if(errorHandlers[fileIndex]) {
        errorHandlers[fileIndex](err);
      }
    }

    function clean(fileIndex) {
      delete progressHandlers[fileIndex];
      delete files[fileIndex];
      delete requests[fileIndex];
    }

    function abort(file) {
      var fileIndex = findFileIndex(file);
      if(requests[fileIndex]) {
        requests[fileIndex].abort();
      }
    }

    function addProgressListener(file, cb) {
      var fileIndex = findFileIndex(file);
      progressHandlers[fileIndex] = cb;
    }

    function addEndListener(file, cb) {
      var fileIndex = findFileIndex(file);
      endHandlers[fileIndex] = cb;
{'fraction_non_alphanumeric': 0.12663060769965, 'fraction_numerical': 0.002545338848234171, 'mean_word_length': 2.664335664335664, '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': '2943192', 'n_tokens_mistral': 981, 'n_tokens_neox': 969, 'n_words': 172}