<commit_before>from lablog.triggers import Trigger, TriggerEnabled, TriggerDisabled
from lablog.hooks import post_slack
from datetime import datetime, timedelta

class CO2(Trigger):

    def post(self):
        fiveminsago = datetime.utcnow()-timedelta(minutes=5)
        if fiveminsago > self.last_run:
            post_slack.delay(message={"text":"Warning! C02 levels are elevated. {}PPM".format(val)})

    def run(self, message):
        val = message['fields']['value']
        if val > 550:
            self.post()
            raise TriggerEnabled(level=1)
        elif val < 550:
            raise TriggerDisabled()

        return False<commit_msg>updates post method<commit_after>from lablog.triggers import Trigger, TriggerEnabled, TriggerDisabled
from lablog.hooks import post_slack
from datetime import datetime, timedelta

class CO2(Trigger):

    def post(self, val):
        fiveminsago = datetime.utcnow()-timedelta(minutes=5)
        if fiveminsago > self.last_run:
            post_slack.delay(message={"text":"Warning! C02 levels are elevated. {}PPM".format(val)})

    def run(self, message):
        val = message['fields']['value']
        if val > 550:
            self.post(val)
            raise TriggerEnabled(level=1)
        elif val < 550:
            raise TriggerDisabled()

        return False
{'fraction_non_alphanumeric': 0.1033182503770739, 'fraction_numerical': 0.016591251885369532, 'mean_word_length': 2.8801169590643276, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 7, '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': '6475837', 'n_tokens_mistral': 408, 'n_tokens_neox': 385, 'n_words': 98}