<commit_before>
// show the installed versions of a package

module.exports = exports = ls;
var npm = require("../npm"),
  exec = require("./utils/exec"),
  path = require("path"),
  fs = require("fs"),
  log = require("./utils").log;

function ls (pkg, cb) {
  if (!cb) {
    cb = pkg;
    pkg = false;
  }
  fs.readdir(npm.dir, function (er, packages) {
    if (er) return cb(er);
    packages = packages.filter(function (dir) {
      return (pkg ? dir === pkg : true) && dir.charAt(0) !== "."
    });
    if (!packages.length) {
      if (pkg) log(pkg, "not found");
      else log("nothing installed");
    }
    packages.forEach(function (package) {
      var packageDir = path.join(npm.dir, package),
        activeVersion = null;
      fs.readdir(packageDir, function (er, versions) {
        if (er) return cb(er);
        versions
          .filter(function (version) {
            if (version !== "active") return true;
            var active = path.join(packageDir, "active");
            if (fs.lstatSync(active).isSymbolicLink()) {
              activeVersion = path.basename(fs.readlinkSync(active));
            }
          })
          .forEach(function (version) {
            log(package+" "+version +
              (activeVersion === version
              ? " \033[33mactive\033[0m" : ""), "installed");
          });
      });
    });
  });
}
<commit_msg>Don't include exec() since it's not used.<commit_after>
// show the installed versions of a package

module.exports = exports = ls;
var npm = require("../npm"),
  path = require("path"),
  fs = require("fs"),
  log = require("./utils").log;

function ls (pkg, cb) {
  if (!cb) {
    cb = pkg;
    pkg = false;
  }
  fs.readdir(npm.dir, function (er, packages) {
    if (er) return cb(er);
    packages = packages.filter(function (dir) {
      return (pkg ? dir === pkg : true) && dir.charAt(0) !== "."
    });
    if (!packages.length) {
      if (pkg) log(pkg, "not found");
      else log("nothing installed");
    }
    packages.forEach(function (package) {
      var packageDir = path.join(npm.dir, package),
        activeVersion = null;
      fs.readdir(packageDir, function (er, versions) {
        if (er) return cb(er);
        versions
          .filter(function (version) {
            if (version !== "active") return true;
            var active = path.join(packageDir, "active");
            if (fs.lstatSync(active).isSymbolicLink()) {
              activeVersion = path.basename(fs.readlinkSync(active));
            }
          })
          .forEach(function (version) {
            log(package+" "+version +
              (activeVersion === version
              ? " \033[33mactive\033[0m" : ""), "installed");
          });
      });
    });
  });
}

{'fraction_non_alphanumeric': 0.16690962099125364, 'fraction_numerical': 0.007288629737609329, 'mean_word_length': 2.162442396313364, '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': '6999646', 'n_tokens_mistral': 863, 'n_tokens_neox': 828, 'n_words': 202}