<commit_before>var semver = Npm.require('semver');

ConstraintSolver = {};

// catalog is a catalog.Catalog object. We have to pass this in because
// we're in a package and can't require('release.js'). If this code
// moves to the tool, or if all of the tool code moves to a star, we
// should get cat from release.current.catalog rather than passing it
// in.
ConstraintSolver.PackagesResolver = function (catalog, options) {
  var self = this;

  options = options || {};

  self.catalog = catalog;

  // The main resolver
  self.resolver = new ConstraintSolver.Resolver();

  // XXX for now we convert unibuilds to unit versions as "deps#os"

  var allPackageNames = catalog.getAllPackageNames();
  var sortedVersionsForPackage = {};
  var forEveryVersion = function (iter) {
    _.each(allPackageNames, function (packageName) {
      if (! sortedVersionsForPackage[packageName])
        sortedVersionsForPackage[packageName] = catalog.getSortedVersions(packageName);
      _.each(sortedVersionsForPackage[packageName], function (version) {
        var versionDef = catalog.getVersion(packageName, version);
        iter(packageName, version, versionDef);
      });
    });
  };

  // Create a unit version for every package
  // Set constraints and dependencies between units
  forEveryVersion(function (packageName, version, versionDef) {
    var unibuilds = {};
    // XXX in theory there might be different archs but in practice they are
    // always "os" and "browser". Fix this once we actually have different
    // archs used.
    _.each(["os", "browser"], function (arch) {
      var unitName = packageName + "#" + arch;
      unibuilds[unitName] = new ConstraintSolver.UnitVersion(
        unitName, version, versionDef.earliestCompatibleVersion);
      unitVersion = unibuilds[unitName];
      self.resolver.addUnitVersion(unitVersion);
    });

    _.each(versionDef.dependencies, function (dep, depName) {
      _.each(dep.references, function (ref) {<commit_msg>missing var<commit_after>var semver = Npm.require('semver');

ConstraintSolver = {};

// catalog is a catalog.Catalog object. We have to pass this in because
// we're in a package and can't require('release.js'). If this code
// moves to the tool, or if all of the tool code moves to a star, we
// should get cat from release.current.catalog rather than passing it
// in.
ConstraintSolver.PackagesResolver = function (catalog, options) {
  var self = this;

  options = options || {};

  self.catalog = catalog;

  // The main resolver
  self.resolver = new ConstraintSolver.Resolver();

  // XXX for now we convert unibuilds to unit versions as "deps#os"

  var allPackageNames = catalog.getAllPackageNames();
  var sortedVersionsForPackage = {};
  var forEveryVersion = function (iter) {
    _.each(allPackageNames, function (packageName) {
      if (! sortedVersionsForPackage[packageName])
        sortedVersionsForPackage[packageName] = catalog.getSortedVersions(packageName);
      _.each(sortedVersionsForPackage[packageName], function (version) {
        var versionDef = catalog.getVersion(packageName, version);
        iter(packageName, version, versionDef);
      });
    });
  };

  // Create a unit version for every package
  // Set constraints and dependencies between units
  forEveryVersion(function (packageName, version, versionDef) {
    var unibuilds = {};
    // XXX in theory there might be different archs but in practice they are
    // always "os" and "browser". Fix this once we actually have different
    // archs used.
    _.each(["os", "browser"], function (arch) {
      var unitName = packageName + "#" + arch;
      unibuilds[unitName] = new ConstraintSolver.UnitVersion(
        unitName, version, versionDef.earliestCompatibleVersion);
      var unitVersion = unibuilds[unitName];
      self.resolver.addUnitVersion(unitVersion);
    });

    _.each(versionDef.dependencies, function (dep, depName) {
      _.each(dep.references, function (ref) {
{'fraction_non_alphanumeric': 0.10595358224016145, 'fraction_numerical': 0.0, 'mean_word_length': 3.6374269005847952, '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': '2759438', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1096, 'n_words': 352}