<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import os
import argparse
import re
import yaml

def get_revision_number(yaml_content, tool_name):
    for tool in yaml_content['tools']:
        if tool["name"] == tool_name:
            if tool.has_key("revision"):
                print tool["revision"][0]

def get_owner(yaml_content, tool_name):
    for tool in yaml_content['tools']:
        if tool["name"] == tool_name:
            print tool['owner']

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--file', required=True)
    parser.add_argument('--tool_name', required=True)
    parser.add_argument('--tool_function', required=True)
    args = parser.parse_args()

    with open(args.file,'r') as yaml_file:
        yaml_content = yaml.load(yaml_file)

    functions = {
        'get_revision_number': get_revision_number,
        'get_owner': get_owner
    }

    functions[args.tool_function](yaml_content, args.tool_name)<commit_msg>Correct key for revision in tool playbook parser<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import os
import argparse
import re
import yaml

def get_revision_number(yaml_content, tool_name):
    for tool in yaml_content['tools']:
        if tool["name"] == tool_name:
            if tool.has_key("revisions"):
                print tool["revisions"][0]

def get_owner(yaml_content, tool_name):
    for tool in yaml_content['tools']:
        if tool["name"] == tool_name:
            print tool['owner']

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--file', required=True)
    parser.add_argument('--tool_name', required=True)
    parser.add_argument('--tool_function', required=True)
    args = parser.parse_args()

    with open(args.file,'r') as yaml_file:
        yaml_content = yaml.load(yaml_file)

    functions = {
        'get_revision_number': get_revision_number,
        'get_owner': get_owner
    }

    functions[args.tool_function](yaml_content, args.tool_name)
{'fraction_non_alphanumeric': 0.1289384391662627, 'fraction_numerical': 0.0019389238972370335, 'mean_word_length': 3.3728813559322033, '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': '1064991', 'n_tokens_mistral': 672, 'n_tokens_neox': 647, 'n_words': 138}