<commit_before>if (typeof require !== 'undefined') {
  if (typeof superagent === 'undefined') superagent = require('superagent');
  if (typeof LRUCache === 'undefined') {
    try {
      LRUCache = require('lru-cache');
    } catch(e) {
      // ignore, not actually required
    }
  }
}

(function(init) {
  'use strict';
  var Hubkit = init();
  if (typeof angular !== 'undefined') {
    var glob = this;
    angular.module('hubkit', []).factory('Hubkit', ['$q', '$rootScope', function($q, $rootScope) {
      glob.Promise = function(fn) {
        var deferred = $q.defer();
        fn(
          function(value) {deferred.resolve(value);},
          function(reason) {deferred.reject(reason);}
        );
        return deferred.promise;
      };
      return Hubkit;
    }]);
  } else if (typeof module !== 'undefined') {
    module.exports = Hubkit;
  } else {
    this.Hubkit = Hubkit;
  }
}).call(this, function() {
  'use strict';

  var cache = typeof LRUCache === 'undefined' ? null :
    new LRUCache({max: 500000, length: function(item) {return item.size;}});

  var Hubkit = function(options) {
    options = defaults({}, options);
    defaults(options, {
      method: 'get', host: 'https://api.github.com', perPage: 100, allPages: true, cache: cache
    });
    // NodeJS doesn't set a userAgent by default but GitHub requires one.
    if (typeof require !== 'undefined' && !options.userAgent) {
      options.userAgent = 'Hubkit';
    }
    this.defaultOptions = options;
  };

  Hubkit.prototype.request = function(path, options) {
    var self = this;
    options = defaults({}, options);
    defaults(options, this.defaultOptions);
    path = interpolatePath(path, options);
    var req = superagent(options.method, path);
    addHeaders(req, options);
    // Pin cached value, in case it gets evicted during the request
    var cachedItem = checkCache(req, options);
    if (options.immutable && options.method === 'GET' && cachedItem) {
      return cachedItem.promise || Promise.resolve(cachedItem.value);
    }

    var requestPromise = new Promise(function(resolve, reject) {
      var result = [];

      function onComplete(error, res) {
        Hubkit.rateLimit = res && res.header['x-ratelimit-limit'] &&
          parseInt(res.header['x-ratelimit-limit'], 10);
        Hubkit.rateLimitRemaining = res && res.header['x-ratelimit-remaining'] &&
          parseInt(res.header['x-ratelimit-remaining'], 10);
        Hubkit.oAuthScopes = res && res.header['x-oauth-scopes'] &&
          res.header['x-oauth-scopes'].split(/\s*,\s*/);
        if (error) {
          reject(error);
        } else if (res.status === 304) {
          resolve(cachedItem.value);
        } else if (!(res.ok || options.boolean && res.notFound && res.body &&
            res.body.message === 'Not Found')) {
          var errors = '';
          if (res.body.errors) {<commit_msg>Add workaround for Firefox caching bug.<commit_after>if (typeof require !== 'undefined') {
  if (typeof superagent === 'undefined') superagent = require('superagent');
  if (typeof LRUCache === 'undefined') {
    try {
      LRUCache = require('lru-cache');
    } catch(e) {
      // ignore, not actually required
    }
  }
}

(function(init) {
  'use strict';
  var Hubkit = init();
  if (typeof angular !== 'undefined') {
    var glob = this;
    angular.module('hubkit', []).factory('Hubkit', ['$q', '$rootScope', function($q, $rootScope) {
      glob.Promise = function(fn) {
        var deferred = $q.defer();
        fn(
          function(value) {deferred.resolve(value);},
          function(reason) {deferred.reject(reason);}
        );
        return deferred.promise;
      };
      return Hubkit;
    }]);
  } else if (typeof module !== 'undefined') {
    module.exports = Hubkit;
  } else {
    this.Hubkit = Hubkit;
  }
}).call(this, function() {
  'use strict';

  var cache = typeof LRUCache === 'undefined' ? null :
    new LRUCache({max: 500000, length: function(item) {return item.size;}});

  var Hubkit = function(options) {
    options = defaults({}, options);
    defaults(options, {
      method: 'get', host: 'https://api.github.com', perPage: 100, allPages: true, cache: cache
    });
    // NodeJS doesn't set a userAgent by default but GitHub requires one.
    if (typeof require !== 'undefined' && !options.userAgent) {
      options.userAgent = 'Hubkit';
    }
    this.defaultOptions = options;
  };

  Hubkit.prototype.request = function(path, options) {
    var self = this;
    options = defaults({}, options);
    defaults(options, this.defaultOptions);
    path = interpolatePath(path, options);
    var req = superagent(options.method, path);
    addHeaders(req, options);
    var cachedItem = null;
    if (options.cache) {
      // Pin cached value, in case it gets evicted during the request
      cachedItem = checkCache(req, options);
      if (options.immutable && options.method === 'GET' && cachedItem) {
        return cachedItem.promise || Promise.resolve(cachedItem.value);
      }
    } else {
      // Work around Firefox bug that forces caching.  We can't use Cache-Control because it's not
      // allowed by Github's cross-domain request headers.
      // https://bugzilla.mozilla.org/show_bug.cgi?id=428916
      req.set('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT');
    }

    var requestPromise = new Promise(function(resolve, reject) {
      var result = [];

      function onComplete(error, res) {
        Hubkit.rateLimit = res && res.header['x-ratelimit-limit'] &&
          parseInt(res.header['x-ratelimit-limit'], 10);
        Hubkit.rateLimitRemaining = res && res.header['x-ratelimit-remaining'] &&
          parseInt(res.header['x-ratelimit-remaining'], 10);
        Hubkit.oAuthScopes = res && res.header['x-oauth-scopes'] &&
          res.header['x-oauth-scopes'].split(/\s*,\s*/);
        if (error) {
          reject(error);
        } else if (res.status === 304) {
          resolve(cachedItem.value);
        } else if (!(res.ok || options.boolean && res.notFound && res.body &&
            res.body.message === 'Not Found')) {
          var errors = '';
          if (res.body.errors) {
{'fraction_non_alphanumeric': 0.1586991869918699, 'fraction_numerical': 0.007967479674796748, 'mean_word_length': 2.7759361571516266, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, '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': '1236262', 'n_tokens_mistral': 1930, 'n_tokens_neox': 1852, 'n_words': 452}