<commit_before>var AWS = require('aws-sdk');
var EC2 = AWS.EC2;
var _ = require('lodash');
var inquirer = require("inquirer");

var TAG_FILTERS = {
  Filters: [{
    Name: 'resource-type',
    Values: [
      'instance',
      'reserved-instances',
    ]
  }],
  MaxResults: 5000
};

module.exports = function (config) {
  return new Promise(function (resolve, reject) {
    if (config.aws != null) {
      var ec2 = new EC2();
      ec2.describeTags(TAG_FILTERS, function (err, data) {
        if (err) {
          reject(err)
        } else {
          var tags = parseTagResults(data, config);
          inquirer.prompt([{ // choose key
            type: 'list',
            pageSize: 10,
            name: 'tagKey',
            message: 'please choose a Tag key',
            choices: _.uniq(_.map(tags, 'key')).sort()
          }, { // choose value
            type: 'list',
            pageSize: 10,
            name: 'tagValue',
            message: 'please choose a Tag value',
            choices: function (answer) {
              return getValueForKeyAnswer(answer, tags);
            }
          }], function (answer) {
            var tagKey = answer.tagKey;
            var tagValue = answer.tagValue;
            var hostnames = [];
            var checkField = "PublicDnsName";
            if (config.aws.usePrivateDns) {
              checkField = "PrivateDnsName"
            }
            ec2.describeInstances({
              Filters: [{
                Name: "tag:" + tagKey,<commit_msg>fix promise resolution<commit_after>var AWS = require('aws-sdk');
var EC2 = AWS.EC2;
var _ = require('lodash');
var inquirer = require("inquirer");

var TAG_FILTERS = {
  Filters: [{
    Name: 'resource-type',
    Values: [
      'instance',
      'reserved-instances',
    ]
  }],
  MaxResults: 5000
};

module.exports = function (config) {
  return new Promise(function (resolve, reject) {
    if (config.aws != null) {
      var ec2 = new EC2();
      ec2.describeTags(TAG_FILTERS, function (err, data) {
        if (err) {
          reject(err)
        } else {
          var tags = parseTagResults(data, config);
          inquirer.prompt([{ // choose key
            type: 'list',
            pageSize: 10,
            name: 'tagKey',
            message: 'please choose a Tag key',
            choices: _.uniq(_.map(tags, 'key')).sort()
          }, { // choose value
            type: 'list',
            pageSize: 10,
            name: 'tagValue',
            message: 'please choose a Tag value',
            choices: function (answer) {
              return getValueForKeyAnswer(answer, tags);
            }
          }])
          .then(function (answer) {
            var tagKey = answer.tagKey;
            var tagValue = answer.tagValue;
            var hostnames = [];
            var checkField = "PublicDnsName";
            if (config.aws.usePrivateDns) {
              checkField = "PrivateDnsName"
            }
            ec2.describeInstances({
              Filters: [{
                Name: "tag:" + tagKey,
{'fraction_non_alphanumeric': 0.1269319302860901, 'fraction_numerical': 0.009207497533706017, 'mean_word_length': 1.6920353982300884, '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': '5748937', 'n_tokens_mistral': 912, 'n_tokens_neox': 879, 'n_words': 217}