<commit_before>__author__ = 'Omry_Nachman'

import time


def noop():
    return None


class ConditionHandler:
    def __init__(self, sensor, condition_func, on_true=noop, on_false=noop,
                 recheck_interval=120, max_checks=10, recheck_on=True):
        self.sensor = sensor
        self.condition_func = condition_func
        self.on_true = on_true
        self.on_false = on_false
        self.recheck_interval = recheck_interval
        self.max_checks = max_checks
        self.recheck_on = recheck_on

    def execute(self, itteration_count=0, samples=[], start_time=time.time()):
        try:
            measure = self.sensor.measure()
            condition_satisfied = self.condition_func(measure)
            if condition_satisfied:
                self.on_true()<commit_msg>added name attribute to ConditionHandler<commit_after>__author__ = 'Omry_Nachman'

import time


def noop():
    return None


class ConditionHandler:
    def __init__(self, name, sensor, condition_func, on_true=noop, on_false=noop,
                 recheck_interval=120, max_checks=10, recheck_on=True):
        self.name = name
        self.sensor = sensor
        self.condition_func = condition_func
        self.on_true = on_true
        self.on_false = on_false
        self.recheck_interval = recheck_interval
        self.max_checks = max_checks
        self.recheck_on = recheck_on

    def execute(self, itteration_count=0, samples=[], start_time=time.time()):
        try:
            measure = self.sensor.measure()
            condition_satisfied = self.condition_func(measure)
            if condition_satisfied:
                self.on_true()
{'fraction_non_alphanumeric': 0.08272946859903382, 'fraction_numerical': 0.007246376811594203, 'mean_word_length': 2.649779735682819, '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': '6514693', 'n_tokens_mistral': 517, 'n_tokens_neox': 494, 'n_words': 98}