<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod

from six import add_metaclass


@add_metaclass(ABCMeta)
class BaseChannel(object):
    @abstractmethod
    def send(self, message):
        pass

    def load_required_config(self, config, key_attrs):
        for key, attr in key_attrs.items():
            value = config.get(key, None)
            if value is None:
                raise Exception
            setattr(self, attr, value)

    def load_optional_config(self, config, key_attrs):
        for key, attr in key_attrs.items():
            value = config.get(key, None)
            if value is not None:
                setattr(self, attr, value)<commit_msg>Update exceptions in BaseChannel<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod

from six import add_metaclass

from channels.exceptions import ImproperlyConfigured


@add_metaclass(ABCMeta)
class BaseChannel(object):
    @abstractmethod
    def send(self, message):
        pass

    def load_required_config(self, config, key_attrs):
        for key, attr in key_attrs.items():
            value = config.get(key, None)
            if value is None:
                raise ImproperlyConfigured("Required configuration: " + key)
            setattr(self, attr, value)

    def load_optional_config(self, config, key_attrs):
        for key, attr in key_attrs.items():
            value = config.get(key, None)
            if value is not None:
                setattr(self, attr, value)
{'fraction_non_alphanumeric': 0.08469259723964868, 'fraction_numerical': 0.0012547051442910915, 'mean_word_length': 2.6085972850678734, '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': '1971276', 'n_tokens_mistral': 456, 'n_tokens_neox': 444, 'n_words': 138}