<commit_before>#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4


import re
from .base import BaseHandler


class KeywordHandler(BaseHandler):

    @classmethod
    def _keyword(cls):
        if hasattr(cls, "keyword"):
            prefix = r"^(?:%s)(?:[\s,;:]+(.+))?$" % (cls.keyword)
            return re.compile(prefix, re.IGNORECASE)

    @classmethod
    def dispatch(cls, router, msg):

        keyword = cls._keyword()
        if keyword is None:
            return False

        match = keyword.match(msg.text)
        if match is None:
            return False

        # spawn an instance of this handler, and stash<commit_msg>KeywordHandler should ignore leading spaces.<commit_after>#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4


import re
from .base import BaseHandler


class KeywordHandler(BaseHandler):

    @classmethod
    def _keyword(cls):
        if hasattr(cls, "keyword"):
            prefix = r"^\s*(?:%s)(?:[\s,;:]+(.+))?$" % (cls.keyword)
            return re.compile(prefix, re.IGNORECASE)

    @classmethod
    def dispatch(cls, router, msg):

        keyword = cls._keyword()
        if keyword is None:
            return False

        match = keyword.match(msg.text)
        if match is None:
            return False

        # spawn an instance of this handler, and stash
{'fraction_non_alphanumeric': 0.12537993920972645, 'fraction_numerical': 0.004559270516717325, 'mean_word_length': 2.3173803526448364, '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': '4983635', 'n_tokens_mistral': 416, 'n_tokens_neox': 398, 'n_words': 117}