<commit_before>'''
The matcher subsystem needs a function called 'confirm_top', which
takes the data passed to a top file environment and determines if that
data matches this minion.
'''

def confirm_top(self, match, data, nodegroups=None):
    '''
    Takes the data passed to a top file environment and determines if the
    data matches this minion
    '''
    matcher = 'compound'
    if not data:
        log.error('Received bad data when setting the match from the top '
                  'file')
        return False
    for item in data:
        if isinstance(item, dict):
            if 'match' in item:
                matcher = item['match']
    if hasattr(self, matcher + '_match'):
        funcname = '{0}_match'.format(matcher)
        if matcher == 'nodegroup':
            return getattr(self, funcname)(match, nodegroups)<commit_msg>Add logging back into confirm_top.py, lint.<commit_after># -*- coding: utf-8 -*-
'''
The matcher subsystem needs a function called 'confirm_top', which
takes the data passed to a top file environment and determines if that
data matches this minion.
'''
from __future__ import absolute_import
import logging

log = logging.getLogger(__file__)


def confirm_top(self, match, data, nodegroups=None):
    '''
    Takes the data passed to a top file environment and determines if the
    data matches this minion
    '''
    matcher = 'compound'
    if not data:
        log.error('Received bad data when setting the match from the top '
                  'file')
        return False
    for item in data:
        if isinstance(item, dict):
            if 'match' in item:
                matcher = item['match']
    if hasattr(self, matcher + '_match'):
        funcname = '{0}_match'.format(matcher)
        if matcher == 'nodegroup':
            return getattr(self, funcname)(match, nodegroups)
{'fraction_non_alphanumeric': 0.0911062906724512, 'fraction_numerical': 0.0016268980477223427, 'mean_word_length': 2.69, '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': '3839373', 'n_tokens_mistral': 501, 'n_tokens_neox': 492, 'n_words': 200}