<commit_before>from os import environ as env
import urlparse

class ConfigError(Exception):
    pass

def configure(app):
    c = app.config

    c['DEBUG']        = _switch('DEBUG', False)
    c['TESTING']      = _switch('TESTING', False)
    c['CSRF_ENABLED'] = _switch('CSRF_ENABLED', True)
    c['AUTH_ON']      = _switch('AUTH_ON', True)
    c['AUTHZ_ON']     = _switch('AUTHZ_ON', True)

    # Required settings
    c['SECRET_KEY']            = env.get('SECRET_KEY')
    c['RECAPTCHA_PUBLIC_KEY']  = env.get('RECAPTCHA_PUBLIC_KEY')
    c['RECAPTCHA_PRIVATE_KEY'] = env.get('RECAPTCHA_PRIVATE_KEY')

    # Optional settings
    c.setdefault('SQLALCHEMY_DATABASE_URI', env.get('DATABASE_URL',
                                                    'sqlite:///%s/annotateit.db' % app.instance_path))
    c.setdefault('DEFAULT_MAIL_SENDER', env.get('DEFAULT_MAIL_SENDER',
                                                'AnnotateIt <<EMAIL>>'))

    # ElasticSearch config
    c.setdefault('ELASTICSEARCH_HOST', env.get('ELASTICSEARCH_HOST', 'http://127.0.0.1:9200'))
    c.setdefault('ELASTICSEARCH_INDEX', env.get('ELASTICSEARCH_INDEX', 'annotateit'))
<commit_msg>Fix setup of DEBUG/TESTING vars<commit_after>from os import environ as env
import urlparse

class ConfigError(Exception):
    pass

def configure(app):
    c = app.config

    app.debug   = _switch('DEBUG', False)
    app.testing = _switch('TESTING', False)

    c['CSRF_ENABLED'] = _switch('CSRF_ENABLED', True)
    c['AUTH_ON']      = _switch('AUTH_ON', True)
    c['AUTHZ_ON']     = _switch('AUTHZ_ON', True)

    c['SECRET_KEY']            = env.get('SECRET_KEY')
    c['RECAPTCHA_PUBLIC_KEY']  = env.get('RECAPTCHA_PUBLIC_KEY')
    c['RECAPTCHA_PRIVATE_KEY'] = env.get('RECAPTCHA_PRIVATE_KEY')

    # Optional settings
    c.setdefault('SQLALCHEMY_DATABASE_URI', env.get('DATABASE_URL',
                                                    'sqlite:///%s/annotateit.db' % app.instance_path))
    c.setdefault('DEFAULT_MAIL_SENDER', env.get('DEFAULT_MAIL_SENDER',
                                                'AnnotateIt <<EMAIL>>'))

    # ElasticSearch config
    c.setdefault('ELASTICSEARCH_HOST', env.get('ELASTICSEARCH_HOST', 'http://127.0.0.1:9200'))
    c.setdefault('ELASTICSEARCH_INDEX', env.get('ELASTICSEARCH_INDEX', 'annotateit'))

{'fraction_non_alphanumeric': 0.14440121054907046, 'fraction_numerical': 0.00864677907479464, 'mean_word_length': 2.922033898305085, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2716154', 'n_tokens_mistral': 818, 'n_tokens_neox': 800, 'n_words': 114}