<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from scarlett.core.config import Config, ScarlettConfigLocations
import scarlett.plugin
import datetime
import os
import platform
import logging
import logging.config
import scarlett.errors

__author__ = '<NAME>'
__email__ = '@bossjones'
__version__ = '0.1.0'
Version = __version__  # for backware compatibility

# http://bugs.python.org/issue7980
datetime.datetime.strptime('', '')

UserAgent = 'Scarlett/%s Python/%s %s/%s' % (
    __version__,
    platform.python_version(),
    platform.system(),
    platform.release()
)

config = Config()


def init_logging():
    for file in ScarlettConfigLocations:
        try:
            logging.config.fileConfig(os.path.expanduser(file))
        except:
            pass


class NullHandler(logging.Handler):

    def emit(self, record):
        pass

log = logging.getLogger('scarlett')
perflog = logging.getLogger('scarlett.perf')
log.addHandler(NullHandler())
perflog.addHandler(NullHandler())
init_logging()

# convenience function to set logging to a particular file


def set_file_logger(name, filepath, level=logging.INFO, format_string=None):
    global log
    if not format_string:
        format_string = "%(asctime)s %(name)s [%(levelname)s]:%(message)s"
    logger = logging.getLogger(name)
    logger.setLevel(level)
    fh = logging.FileHandler(filepath)
    fh.setLevel(level)
    formatter = logging.Formatter(format_string)
    fh.setFormatter(formatter)
    logger.addHandler(fh)
    log = logger


def set_stream_logger(name, level=logging.DEBUG, format_string=None):
    global log
    if not format_string:
        format_string = "%(asctime)s %(name)s [%(levelname)s]:%(message)s"
    logger = logging.getLogger(name)
    logger.setLevel(level)
    fh = logging.StreamHandler()
    fh.setLevel(level)
    formatter = logging.Formatter(format_string)
    fh.setFormatter(formatter)
    logger.addHandler(fh)
    log = logger


def connect_voice(brain, **kwargs):
    global log
    scarlett.log.debug("connect_voice")
    from scarlett.basics.voice import Voice
    return Voice(brain)


def connect_forecastio(brain):
    global log
    scarlett.log.debug("connect_forecastio")
    from scarlett.features.forecast import FeatureForecast
    return FeatureForecast()


def connect_wordnik(brain):
    global log
    scarlett.log.debug("connect_wordnik")


def connect_nltk(brain):
    global log
    scarlett.log.debug("connect_nltk")


def connect_hue(brain):
    global log
    scarlett.log.debug("connect_hue")
    from scarlett.features.hue_lights import FeatureHueLights
    return FeatureHueLights()


def connect_time(brain):
    global log
    scarlett.log.debug("connect_time")
    from scarlett.features.time import FeatureTime
    return FeatureTime()


def connect_wa(brain):
    global log
    scarlett.log.debug("connect_wa")


def connect_brain():
    global log
    scarlett.log.debug("connect_brain")
    from scarlett.brain import ScarlettBrain
    return ScarlettBrain(brain_name="DeepThought", flush=True)<commit_msg>wip: added more args to params<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from scarlett.core.config import Config, ScarlettConfigLocations
import scarlett.plugin
import datetime
import os
import platform
import logging
import logging.config
import scarlett.errors

__author__ = '<NAME>'
__email__ = '@bossjones'
__version__ = '0.1.0'
Version = __version__  # for backware compatibility

# http://bugs.python.org/issue7980
datetime.datetime.strptime('', '')

UserAgent = 'Scarlett/%s Python/%s %s/%s' % (
    __version__,
    platform.python_version(),
    platform.system(),
    platform.release()
)

config = Config()


def init_logging():
    for file in ScarlettConfigLocations:
        try:
            logging.config.fileConfig(os.path.expanduser(file))
        except:
            pass


class NullHandler(logging.Handler):

    def emit(self, record):
        pass

log = logging.getLogger('scarlett')
perflog = logging.getLogger('scarlett.perf')
log.addHandler(NullHandler())
perflog.addHandler(NullHandler())
init_logging()

# convenience function to set logging to a particular file


def set_file_logger(name, filepath, level=logging.INFO, format_string=None):
    global log
    if not format_string:
        format_string = "%(asctime)s %(name)s [%(levelname)s]:%(message)s"
    logger = logging.getLogger(name)
    logger.setLevel(level)
    fh = logging.FileHandler(filepath)
    fh.setLevel(level)
    formatter = logging.Formatter(format_string)
    fh.setFormatter(formatter)
    logger.addHandler(fh)
    log = logger


def set_stream_logger(name, level=logging.DEBUG, format_string=None):
    global log
    if not format_string:
        format_string = "%(asctime)s %(name)s [%(levelname)s]:%(message)s"
    logger = logging.getLogger(name)
    logger.setLevel(level)
    fh = logging.StreamHandler()
    fh.setLevel(level)
    formatter = logging.Formatter(format_string)
    fh.setFormatter(formatter)
    logger.addHandler(fh)
    log = logger


def connect_voice(brain, **kwargs):
    global log
    scarlett.log.debug("connect_voice")
    from scarlett.basics.voice import Voice
    return Voice(brain)


def connect_forecastio(brain, **kwargs):
    global log
    scarlett.log.debug("connect_forecastio")
    from scarlett.features.forecast import FeatureForecast
    return FeatureForecast()


def connect_wordnik(brain, **kwargs):
    global log
    scarlett.log.debug("connect_wordnik")


def connect_nltk(brain, **kwargs):
    global log
    scarlett.log.debug("connect_nltk")


def connect_hue(brain, **kwargs):
    global log
    scarlett.log.debug("connect_hue")
    from scarlett.features.hue_lights import FeatureHueLights
    return FeatureHueLights()


def connect_time(brain, **kwargs):
    global log
    scarlett.log.debug("connect_time")
    from scarlett.features.time import FeatureTime
    return FeatureTime()


def connect_wa(brain, **kwargs):
    global log
    scarlett.log.debug("connect_wa")


def connect_brain():
    global log
    scarlett.log.debug("connect_brain")
    from scarlett.brain import ScarlettBrain
    return ScarlettBrain(brain_name="DeepThought", flush=True)
{'fraction_non_alphanumeric': 0.11089650732335425, 'fraction_numerical': 0.002575245453082247, 'mean_word_length': 4.027508090614886, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6397177', 'n_tokens_mistral': 2010, 'n_tokens_neox': 1916, 'n_words': 412}