<commit_before>"""Plugin that adds guest memory usage in GB"""
MIN_HOST_MEM = 1000000  # kB


def inject(node):
    """Adds guest RAM usage data to the host"""
    node.setdefault('kitchen', {})
    node['kitchen'].setdefault('data', {})
    node['kitchen']['data']['memory_usage'] = MIN_HOST_MEM
    for guest in node.get('virtualization', {}).get('guests', []):
        memory = int(guest.get('memory').get('total').rstrip('kB'))
        node['kitchen']['data']['memory_usage'] += memory
    # transform into GB
    node['kitchen']['data']['memory_usage'] /= 1048576<commit_msg>Handle cases where memory key is not present<commit_after>"""Plugin that adds guest memory usage in GB"""
MIN_HOST_MEM = 1000000  # kB


def inject(node):
    """Adds guest RAM usage data to the host"""
    node.setdefault('kitchen', {})
    node['kitchen'].setdefault('data', {})
    node['kitchen']['data']['memory_usage'] = MIN_HOST_MEM
    for guest in node.get('virtualization', {}).get('guests', []):
        memory = int(guest.get('memory', {}).get('total', '').rstrip('kB'))
        node['kitchen']['data']['memory_usage'] += memory
    # transform into GB
    node['kitchen']['data']['memory_usage'] /= 1048576
{'fraction_non_alphanumeric': 0.20016680567139283, 'fraction_numerical': 0.02335279399499583, 'mean_word_length': 4.555555555555555, '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': '2485123', 'n_tokens_mistral': 390, 'n_tokens_neox': 365, 'n_words': 86}