<commit_before>var models = require('../models'),
    _ = require('lodash');

var ec2Action = function(){
    this.actions = [];
};

/*
    Todo: document this.
*/
ec2Action.prototype.parseAction = function(data, action){
    var self = this;
    var actionAWS = '';

    if(action === 'stop') //todo: finish this if for start and terminate.
        actionAWS = 'StoppingInstances';

    if(!_.get(data, '_action_[0].InstanceId'.replace('_action_', actionAWS))) return {};

    _.each(data[actionAWS], function(data){
            var ar = new models.actionRequest();
            ar.action = action;
            ar.input = data.InstanceId;
            ar.actionProcessed = [32, 64, 80].indexOf(data.CurrentState) === -1 ? true : false; 

            if(!ar.actionProcessed)
            {
                ar.err = data;
                ar.errMessage =  "_action_ action couldn't be processed. Current State: _currState_."
                                 .replace('_action_', action)
                                 .replace('_currState_', data.CurrentState.Name);
            }

            self.actions.push(ar);
    });
};

// var actionCodeEnum = {
//     '0' : 'pending'
//     '16' : 'running'
//     '32' : 'shutting-down'<commit_msg>refactoring possibleStatuses in actionCollection<commit_after>var models = require('../models'),
    _ = require('lodash');

var ec2Action = function(){
    this.actions = [];
};

/*
    Todo: document this.
*/
ec2Action.prototype.parseAction = function(data, action){
    var self = this;
    var actionAWS = '';
    var possibleStatus = [];

    if(action === 'stop')//todo: finish this if for start and terminate.
    {
        actionAWS = 'StoppingInstances';
        possibleStatus = [32, 64, 80];
    }
    //else if(action === 'start')....
    else return {}; 

    if(!_.get(data, '_action_[0].InstanceId'.replace('_action_', actionAWS))) return {};

    _.each(data[actionAWS], function(data){
            var ar = new models.actionRequest();
            ar.action = action;
            ar.input = data.InstanceId;
            ar.actionProcessed = possibleStatus.indexOf(data.CurrentState.Code) > -1 ? true : false; 

            if(!ar.actionProcessed)
            {
                ar.err = data;
                ar.errMessage =  "_action_ action couldn't be processed. Current State: _currState_."
                                 .replace('_action_', action)
                                 .replace('_currState_', data.CurrentState.Name);
            }

            self.actions.push(ar);
    });
};

// var actionCodeEnum = {
//     '0' : 'pending'
//     '16' : 'running'
//     '32' : 'shutting-down'
{'fraction_non_alphanumeric': 0.1508653122648608, 'fraction_numerical': 0.011286681715575621, 'mean_word_length': 1.984287317620651, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7046173', 'n_tokens_mistral': 808, 'n_tokens_neox': 766, 'n_words': 164}