<commit_before># -*- coding: utf-8 -*-

from flask import Flask

import config
from toolkit import response

app = Flask('docker-registry')


@app.before_first_request
def first_request():
    cfg = config.load()
    info = cfg.email_exceptions
    if info:
        import logging
        from logging.handlers import SMTPHandler
        mail_handler = SMTPHandler(mailhost=info['smtp_host'],
                fromaddr=info['from_addr'], toaddrs=[info['to_addr']],
                subject='Docker registry exception',
                credentials=(info['smtp_login'], info['smtp_password']))
        mail_handler.setLevel(logging.ERROR)
#        app.logger.addHandler(mail_handler)


@app.route('/_ping')
def ping():
    return response()


@app.route('/')
def root():
    return response('docker-registry server')<commit_msg>Announce the config flavor in the server banner<commit_after># -*- coding: utf-8 -*-

from flask import Flask

import config
from toolkit import response

app = Flask('docker-registry')


@app.before_first_request
def first_request():
    cfg = config.load()
    info = cfg.email_exceptions
    if info:
        import logging
        from logging.handlers import SMTPHandler
        mail_handler = SMTPHandler(mailhost=info['smtp_host'],
                fromaddr=info['from_addr'], toaddrs=[info['to_addr']],
                subject='Docker registry exception',
                credentials=(info['smtp_login'], info['smtp_password']))
        mail_handler.setLevel(logging.ERROR)
        app.logger.addHandler(mail_handler)


@app.route('/_ping')
def ping():
    return response()


@app.route('/')
def root():
    cfg = config.load()
    return response('docker-registry server ({0})'.format(cfg.flavor))
{'fraction_non_alphanumeric': 0.12890173410404623, 'fraction_numerical': 0.0017341040462427746, 'mean_word_length': 3.274074074074074, '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': '6109663', 'n_tokens_mistral': 523, 'n_tokens_neox': 497, 'n_words': 113}