<commit_before>// Copyright 2013 Joyent, Inc.  All rights reserved.

var assert = require('assert-plus');
var util = require('util');


function translateAction(job) {

    if (/^provision/.test(job.name)) {
        return 'provision';
    }

    if (job.params.task !== 'update' && job.params.task !== 'snapshot') {
        return job.params.task;
    }

    if (job.params.task === 'snapshot') {
        if (/^snapshot/.test(job.name)) {
            return 'create_snapshot';
        } else if (/^rollback/.test(job.name)) {
            return 'rollback_snapshot';
        } else if (/^delete-snapshot/.test(job.name)) {
            return 'delete_snapshot';
        }
    }

    // The multiple possibilities for machine update:
    if (job.params.set_customer_metadata &&
            job.params.remove_customer_metadata) {
        return 'replace_metadata';
    }

    if (job.params.remove_tags && job.params.set_tags) {
        return 'replace_tags';
    }

    if (job.params.remove_customer_metadata) {
        return 'remove_metadata';
    }

    if (job.params.set_customer_metadata) {
        return 'set_metadata';
    }

    if (job.params.remove_tags) {
        return 'remove_tags';
    }

    if (job.params.set_tags) {
        return 'set_tags';
    }

    if (job.params.subtask === 'rename' || job.params.subtask === 'resize') {
        return job.params.subtask;
    }<commit_msg>PUBAPI-872: Fixed another set of MachineAudit actions broken since ZAPI-499<commit_after>// Copyright 2013 Joyent, Inc.  All rights reserved.

var assert = require('assert-plus');
var util = require('util');


function translateAction(job) {

    if (/^provision/.test(job.name)) {
        return 'provision';
    }

    if (job.params.task !== 'update' && job.params.task !== 'snapshot') {
        return job.params.task;
    }

    if (job.params.task === 'snapshot') {
        if (/^snapshot/.test(job.name)) {
            return 'create_snapshot';
        } else if (/^rollback/.test(job.name)) {
            return 'rollback_snapshot';
        } else if (/^delete-snapshot/.test(job.name)) {
            return 'delete_snapshot';
        }
    }

    // The multiple possibilities for machine update:
    if (job.params.payload.set_customer_metadata &&
            job.params.payload.remove_customer_metadata) {
        return 'replace_metadata';
    }

    if (job.params.payload.remove_tags && job.params.payload.set_tags) {
        return 'replace_tags';
    }

    if (job.params.payload.remove_customer_metadata) {
        return 'remove_metadata';
    }

    if (job.params.payload.set_customer_metadata) {
        return 'set_metadata';
    }

    if (job.params.payload.remove_tags) {
        return 'remove_tags';
    }

    if (job.params.payload.set_tags) {
        return 'set_tags';
    }

    if (job.params.subtask === 'rename' || job.params.subtask === 'resize') {
        return job.params.subtask;
    }
{'fraction_non_alphanumeric': 0.14251537935748462, 'fraction_numerical': 0.004784688995215311, 'mean_word_length': 2.364367816091954, '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': '4458273', 'n_tokens_mistral': 925, 'n_tokens_neox': 896, 'n_words': 175}