<commit_before># coding=utf-8
import datetime

from util import get_config_option, LoggerConfigurationError


class Logger(object):
    """Abstract class basis for loggers."""

    dependencies = []

    supports_batch = False

    doing_batch = True

    batch_data = {}

    def __init__(self, config_options):
        if "depend" in config_options:
            self.set_dependencies([x.strip() for x in config_options["depend"].split(",")])

    @staticmethod
    def get_config_option(config_options, key, **kwargs):
        kwargs['exception'] = LoggerConfigurationError
        return get_config_option(config_options, key, **kwargs)

    def hup(self):
        """Close and reopen our log file, if supported.

        This should be overridden where needed."""
        return

    def save_result(self):
        raise NotImplementedError

    def set_dependencies(self, dependency_list):
        """Record which monitors we depend on.
        If a monitor we depend on fails, it means we can't reach the database, so we shouldn't bother trying to write to it."""
        # TODO: Maybe cache the commands until connection returns
<commit_msg>Use get_config_option for base logger class<commit_after># coding=utf-8
import datetime

from util import get_config_option, LoggerConfigurationError


class Logger(object):
    """Abstract class basis for loggers."""

    dependencies = []

    supports_batch = False

    doing_batch = True

    batch_data = {}

    def __init__(self, config_options):
        self.set_dependencies(Logger.get_config_option(
            config_options,
            'depend',
            required_type='[str]',
            default=[]
        ))

    @staticmethod
    def get_config_option(config_options, key, **kwargs):
        kwargs['exception'] = LoggerConfigurationError
        return get_config_option(config_options, key, **kwargs)

    def hup(self):
        """Close and reopen our log file, if supported.

        This should be overridden where needed."""
        return

    def save_result(self):
        raise NotImplementedError

    def set_dependencies(self, dependency_list):
        """Record which monitors we depend on.
        If a monitor we depend on fails, it means we can't reach the database, so we shouldn't bother trying to write to it."""
        # TODO: Maybe cache the commands until connection returns

{'fraction_non_alphanumeric': 0.08523206751054853, 'fraction_numerical': 0.0008438818565400844, 'mean_word_length': 3.01864406779661, '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': '4777399', 'n_tokens_mistral': 633, 'n_tokens_neox': 599, 'n_words': 213}