<commit_before>(function() {
  'use strict';

  angular.module('dimApp')
    .controller('dimMinMaxCtrl', dimMinMaxCtrl);

  dimMinMaxCtrl.$inject = ['$scope', '$state', '$q', '$timeout', '$location', 'loadingTracker', 'dimStoreService', 'dimItemService', 'ngDialog', 'dimLoadoutService'];

  function dimMinMaxCtrl($scope, $state, $q, $timeout, $location, loadingTracker, dimStoreService, dimItemService, ngDialog) {
    var vm = this;
    var buckets = [];
    var vendorBuckets = [];
    vm.perks = {};
    vm.vendorPerks = {};

    _.each(['warlock', 'titan', 'hunter'], function(classType) {
      vm.perks[classType] = { Helmet: [], Gauntlets: [], Chest: [], Leg: [], ClassItem: [], Ghost: [], Artifact: [] };
      vm.vendorPerks[classType] = { Helmet: [], Gauntlets: [], Chest: [], Leg: [], ClassItem: [], Ghost: [], Artifact: [] };
    });

    function getBonusType(armorpiece) {
      if (!armorpiece.normalStats) {
        return '';
      }
      return (armorpiece.normalStats[144602215].bonus > 0 ? 'int ' : '') +
        (armorpiece.normalStats[1735777505].bonus > 0 ? 'disc ' : '') +
        (armorpiece.normalStats[4244567218].bonus > 0 ? 'str' : '');
    }

    // for specifc armor (Helmet), look at stats (int/dis), return best one.
    function getBestItem(armor, stats, type, nonExotic) {
      return {
        item: _.max(armor, function(o) {
          if (nonExotic && o.isExotic) {
            return 0;
          }
          var bonus = 0;
          var total = 0;
          stats.forEach(function(stat) {
            total += o.normalStats[stat][vm.scale_type];
            bonus = o.normalStats[stat].bonus;
          });
          return total + bonus;
        }),
        bonus_type: type
      };
    }

    function hasPerks(item, lockedPerks) {
      if (_.isEmpty(lockedPerks)) {
        return true;
      }

      var andPerkHashes = _.map(_.filter(_.keys(lockedPerks), function(perkHash) { return lockedPerks[perkHash] === 'and'; }), Number);
      var orPerkHashes = _.map(_.filter(_.keys(lockedPerks), function(perkHash) { return lockedPerks[perkHash] === 'or'; }), Number);

      return _.some(orPerkHashes, function(perkHash) {  return _.findWhere(item.talentGrid.nodes, { hash: perkHash }); }) ||
             (andPerkHashes.length && _.every(andPerkHashes, function(perkHash) { return _.findWhere(item.talentGrid.nodes, { hash: perkHash }); }));
    }

    function getBestArmor(bucket, vendorBucket, locked, excluded, lockedPerks) {
      var statHashes = [
          { stats: [144602215, 1735777505], type: 'intdisc' },
          { stats: [144602215, 4244567218], type: 'intstr' },
          { stats: [1735777505, 4244567218], type: 'discstr' },
          { stats: [144602215], type: 'int' },
          { stats: [1735777505], type: 'disc' },
          { stats: [4244567218], type: 'str' }
      ];
      var armor = {};
      var best = [];
      var curbest;
      var bestCombs;
      var armortype;

      for (armortype in bucket) {<commit_msg>hound<commit_after>(function() {
  'use strict';

  angular.module('dimApp')
    .controller('dimMinMaxCtrl', dimMinMaxCtrl);

  dimMinMaxCtrl.$inject = ['$scope', '$state', '$q', '$timeout', '$location', 'loadingTracker', 'dimStoreService', 'dimItemService', 'ngDialog', 'dimLoadoutService'];

  function dimMinMaxCtrl($scope, $state, $q, $timeout, $location, loadingTracker, dimStoreService, dimItemService, ngDialog) {
    var vm = this;
    var buckets = [];
    var vendorBuckets = [];
    vm.perks = {};
    vm.vendorPerks = {};

    _.each(['warlock', 'titan', 'hunter'], function(classType) {
      vm.perks[classType] = { Helmet: [], Gauntlets: [], Chest: [], Leg: [], ClassItem: [], Ghost: [], Artifact: [] };
      vm.vendorPerks[classType] = { Helmet: [], Gauntlets: [], Chest: [], Leg: [], ClassItem: [], Ghost: [], Artifact: [] };
    });

    function getBonusType(armorpiece) {
      if (!armorpiece.normalStats) {
        return '';
      }
      return (armorpiece.normalStats[144602215].bonus > 0 ? 'int ' : '') +
        (armorpiece.normalStats[1735777505].bonus > 0 ? 'disc ' : '') +
        (armorpiece.normalStats[4244567218].bonus > 0 ? 'str' : '');
    }

    // for specifc armor (Helmet), look at stats (int/dis), return best one.
    function getBestItem(armor, stats, type, nonExotic) {
      return {
        item: _.max(armor, function(o) {
          if (nonExotic && o.isExotic) {
            return 0;
          }
          var bonus = 0;
          var total = 0;
          stats.forEach(function(stat) {
            total += o.normalStats[stat][vm.scale_type];
            bonus = o.normalStats[stat].bonus;
          });
          return total + bonus;
        }),
        bonus_type: type
      };
    }

    function hasPerks(item, lockedPerks) {
      if (_.isEmpty(lockedPerks)) {
        return true;
      }

      var andPerkHashes = _.map(_.filter(_.keys(lockedPerks), function(perkHash) { return lockedPerks[perkHash] === 'and'; }), Number);
      var orPerkHashes = _.map(_.filter(_.keys(lockedPerks), function(perkHash) { return lockedPerks[perkHash] === 'or'; }), Number);

      return _.some(orPerkHashes, function(perkHash) { return _.findWhere(item.talentGrid.nodes, { hash: perkHash }); }) ||
             (andPerkHashes.length && _.every(andPerkHashes, function(perkHash) { return _.findWhere(item.talentGrid.nodes, { hash: perkHash }); }));
    }

    function getBestArmor(bucket, vendorBucket, locked, excluded, lockedPerks) {
      var statHashes = [
          { stats: [144602215, 1735777505], type: 'intdisc' },
          { stats: [144602215, 4244567218], type: 'intstr' },
          { stats: [1735777505, 4244567218], type: 'discstr' },
          { stats: [144602215], type: 'int' },
          { stats: [1735777505], type: 'disc' },
          { stats: [4244567218], type: 'str' }
      ];
      var armor = {};
      var best = [];
      var curbest;
      var bestCombs;
      var armortype;

      for (armortype in bucket) {
{'fraction_non_alphanumeric': 0.16780879157613238, 'fraction_numerical': 0.040782216279458466, 'mean_word_length': 2.773013871374527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4614967', 'n_tokens_mistral': 2119, 'n_tokens_neox': 1936, 'n_words': 396}