<commit_before>import os
import re

from util import hook


@hook.sieve
def sieve_suite(bot, input, func, args):
    events = args.get('events', ['PRIVMSG'])

    if input.command not in events and events != '*':
        return None

    if input.nick.lower()[-3:] == 'bot' and args.get('ignorebots', True):
        return None

    regex = args.get('re')
    if not regex:
        hook = args.get('hook', r'(.*)')

        if args.get('prefix', True):
            if input.chan == input.nick: # private message, prefix not required
                prefix = r'^(?:[.!]?|'
            else:
                prefix = r'^(?:[.!]|'
            hook = prefix + input.conn.nick + r'[:,]*\s)' + hook

        regex = re.compile(hook, flags=re.I)
        args['re'] = regex

    input.re = regex.match(input.msg)
    if input.re is None:
        return None<commit_msg>revert sieve to version without broken caching<commit_after>import os
import re

from util import hook


@hook.sieve
def sieve_suite(bot, input, func, args):
    events = args.get('events', ['PRIVMSG'])

    if input.command not in events and events != '*':
        return None

    if input.nick.lower()[-3:] == 'bot' and args.get('ignorebots', True):
        return None

    hook = args.get('hook', r'(.*)')

    if args.get('prefix', True):
        if input.chan == input.nick: # private message, prefix not required
            prefix = r'^(?:[.!]?|'
        else:
            prefix = r'^(?:[.!]|'
        hook = prefix + input.conn.nick + r'[:,]*\s)' + hook

    input.re = re.match(hook, input.msg, flags=re.I)
    if input.re is None:
        return None
{'fraction_non_alphanumeric': 0.16687192118226601, 'fraction_numerical': 0.0012315270935960591, 'mean_word_length': 2.282828282828283, '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': '4113481', 'n_tokens_mistral': 535, 'n_tokens_neox': 518, 'n_words': 149}