<commit_before>import ssl
import logging
from logging.handlers import SysLogHandler
from threading import Timer

logger = logging.getLogger('pixelated.startup')


def init_logging(name, level=logging.INFO, config_file=None):
    global logger
    logger_name = 'pixelated.%s' % name

    logging.basicConfig(level=level)
    if config_file:
        logging.config.fileConfig(config_file)
    else:
        formatter = logging.Formatter('%(asctime)s %(name)s: %(levelname)s %(message)s', '%b %e %H:%M:%S')
        syslog = SysLogHandler(address='/dev/log', facility=SysLogHandler.LOG_DAEMON)
        syslog.setFormatter(formatter)
        logger.addHandler(syslog)

    logger.name = logger_name
    logger.info('Initialized logging')


def latest_available_ssl_version():
    return ssl.PROTOCOL_TLSv1


class Watchdog:
    def __init__(self, timeout, userHandler=None, args=[]):
        self.timeout = timeout
        self.handler = userHandler if userHandler is not None else self.defaultHandler
        self.timer = Timer(self.timeout, self.handler, args=args)
        self.timer.daemon = True
        self.timer.start()

    def reset(self):
        self.timer.cancel()
        self.timer = Timer(self.timeout, self.handler)

    def stop(self):
        self.timer.cancel()

    def defaultHandler(self):
        raise self
<commit_msg>Revert "Downgraded SSL version to TLS 1 until we have the requests library fixed"<commit_after>import ssl
import logging
from logging.handlers import SysLogHandler
from threading import Timer

logger = logging.getLogger('pixelated.startup')


def init_logging(name, level=logging.INFO, config_file=None):
    global logger
    logger_name = 'pixelated.%s' % name

    logging.basicConfig(level=level)
    if config_file:
        logging.config.fileConfig(config_file)
    else:
        formatter = logging.Formatter('%(asctime)s %(name)s: %(levelname)s %(message)s', '%b %e %H:%M:%S')
        syslog = SysLogHandler(address='/dev/log', facility=SysLogHandler.LOG_DAEMON)
        syslog.setFormatter(formatter)
        logger.addHandler(syslog)

    logger.name = logger_name
    logger.info('Initialized logging')


def latest_available_ssl_version():
    try:
        return ssl.PROTOCOL_TLSv1_2
    except AttributeError:
        return ssl.PROTOCOL_TLSv1


class Watchdog:
    def __init__(self, timeout, userHandler=None, args=[]):
        self.timeout = timeout
        self.handler = userHandler if userHandler is not None else self.defaultHandler
        self.timer = Timer(self.timeout, self.handler, args=args)
        self.timer.daemon = True
        self.timer.start()

    def reset(self):
        self.timer.cancel()
        self.timer = Timer(self.timeout, self.handler)

    def stop(self):
        self.timer.cancel()

    def defaultHandler(self):
        raise self

{'fraction_non_alphanumeric': 0.10658640226628895, 'fraction_numerical': 0.0017705382436260624, 'mean_word_length': 3.359567901234568, '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': '4911171', 'n_tokens_mistral': 877, 'n_tokens_neox': 845, 'n_words': 192}