<commit_before># -*- coding: utf-8 -*-
"""
Module to allow quick configuration.
"""
from six.moves import configparser
from six import StringIO
import pkg_resources

import logging.config

def configure(mode, disable_existing_loggers=False):
    """Configure from predefined useful default modes."""
    cfg = configparser.ConfigParser()
    modefn = "{0}.cfg".format(mode) if not mode.endswith(".cfg") else mode
    for filename in ["base.cfg", modefn]:
        cfg.readfp(pkg_resources.resource_stream(__name__, filename))
    cfgbuffer = StringIO()
    cfg.write(cfgbuffer)
    cfgbuffer.seek(0)
    return logging.config.fileConfig(cfgbuffer, disable_existing_loggers=disable_existing_loggers)<commit_msg>Read a custom lumberjack.cfg on startup if necessary.<commit_after># -*- coding: utf-8 -*-
"""
Module to allow quick configuration.
"""
from six.moves import configparser
from six import StringIO
import pkg_resources

import logging.config

def configure(mode, disable_existing_loggers=False):
    """Configure from predefined useful default modes."""
    cfg = configparser.ConfigParser()
    modefn = "{0}.cfg".format(mode) if not mode.endswith(".cfg") else mode
    for filename in ["base.cfg", modefn]:
        cfg.readfp(pkg_resources.resource_stream(__name__, filename))
    cfg.read("lumberjack.cfg")
    cfgbuffer = StringIO()
    cfg.write(cfgbuffer)
    cfgbuffer.seek(0)
    return logging.config.fileConfig(cfgbuffer, disable_existing_loggers=disable_existing_loggers)
{'fraction_non_alphanumeric': 0.11417058428475486, 'fraction_numerical': 0.004029550033579583, 'mean_word_length': 4.7528957528957525, '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': '4599949', 'n_tokens_mistral': 430, 'n_tokens_neox': 425, 'n_words': 111}