<commit_before>from .core.log import RedisPub


class RedisPubMixin(object):

    @property
    def config(self):
        try:
            from flask import Flask
            if isinstance(self, Flask):
                return super(RedisPubMixin, self).config
        except:
            pass

        try:
            from celery import Celery
            if isinstance(self, Celery):
                return super(RedisPubMixin, self).conf
        except:
            pass

    @property
    def redispub(self):
        if not hasattr(self, '_redispub'):
            self._redispub = RedisPub(
                bubble=self.config['TORABOT_BUBBLE_LOG']
            )
        return self._redispub<commit_msg>use function to get conf<commit_after>from .core.log import RedisPub


class RedisPubMixin(object):

    def get_conf(self, name):
        try:
            from flask import Flask
            if isinstance(self, Flask):
                return super(RedisPubMixin, self).config[name]
        except:
            pass

        try:
            from celery import Celery
            if isinstance(self, Celery):
                return super(RedisPubMixin, self).conf[name]
        except:
            pass

        assert False

    @property
    def redispub(self):
        if not hasattr(self, '_redispub'):
            self._redispub = RedisPub(
                bubble=self.get_conf('TORABOT_BUBBLE_LOG')
            )
        return self._redispub
{'fraction_non_alphanumeric': 0.07560137457044673, 'fraction_numerical': 0.0, 'mean_word_length': 1.6569343065693432, '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': '316286', 'n_tokens_mistral': 420, 'n_tokens_neox': 400, 'n_words': 99}