<commit_before># encoding: utf-8

log = __import__('logging').getLogger(__name__)


class ResponseRegistry(object):
    def __init__(self):
        self.registry = list()
    
    def register(self, handler, *types):
        self.registry.insert(0, (types, handler))
    
    def __call__(self, context, response):
        for k, v in self.registry:
            if isinstance(response, k):
                if v(context, response):
                    return v
        return False


registry = ResponseRegistry()
<commit_msg>Optimizations.<commit_after># encoding: utf-8

log = __import__('logging').getLogger(__name__)


class ResponseRegistry(object):
    __slots__ = ('registry', )
    
    def __init__(self):
        self.registry = list()
    
    def register(self, handler, *types):
        self.registry.insert(0, (types, handler))
    
    def __call__(self, context, response):
        for k, v in self.registry:
            if isinstance(response, k):
                if v(context, response):
                    return v
        return False


registry = ResponseRegistry()

{'fraction_non_alphanumeric': 0.11131554737810488, 'fraction_numerical': 0.0036798528058877645, 'mean_word_length': 2.3476923076923075, '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': '1418336', 'n_tokens_mistral': 306, 'n_tokens_neox': 297, 'n_words': 80}