<commit_before># -*- coding: utf-8 -*-
import flask
import os
import sys
import sqlalchemy as sa
from sqlalchemy import orm
from importlib import import_module


def _apply_site_configuration(application):
    # Pull configuration from the project-specific settings module.
    module = '{}_SETTINGS_MODULE'.format(application.name).replace('.', '_')
    if module in os.environ:
        application.config.from_envvar(module)

    # Pull configuration from the a generic settings module.
    if 'SETTINGS_MODULE' in os.environ:
        application.config.from_envvar('SETTINGS_MODULE')


def Application(package):
    # Instantiate the flask application context.
    context = flask.Flask(package)

    # Configure the application.
    # Pull configuration from the project settings module.
    context.config.from_object('{}.settings'.format(package))

    # Detect if were testing.
    testing = False
    for arg in sys.argv:
        if 'test' in arg:
            testing = True
            break

    # Change configuration if we're testing.
    context.config['DATABASE_URI'] = 'sqlite:///:memory:'
    context.config['DATABASE_ENGINE'] = sa.create_engine(
        context.config['DATABASE_URI'], echo=False)

    context.config['DATABASE_SESSION'].configure(
        bind=context.config['DATABASE_ENGINE'])

    # Apply site configuration.
    _apply_site_configuration(context)

    # Return the flask context.
    return context


def _add_package_context(application, package, context):
    with application.app_context():
        try:
            # Attempt to pull in this context.
            import_module('{}.{}'.format(package, context))
<commit_msg>Really change if testing.<commit_after># -*- coding: utf-8 -*-
import flask
import os
import sys
import sqlalchemy as sa
from sqlalchemy import orm
from importlib import import_module


def _apply_site_configuration(application):
    # Pull configuration from the project-specific settings module.
    module = '{}_SETTINGS_MODULE'.format(application.name).replace('.', '_')
    if module in os.environ:
        application.config.from_envvar(module)

    # Pull configuration from the a generic settings module.
    if 'SETTINGS_MODULE' in os.environ:
        application.config.from_envvar('SETTINGS_MODULE')


def Application(package):
    # Instantiate the flask application context.
    context = flask.Flask(package)

    # Configure the application.
    # Pull configuration from the project settings module.
    context.config.from_object('{}.settings'.format(package))

    # Detect if were testing.
    testing = False
    for arg in sys.argv:
        if 'test' in arg:
            testing = True
            break

    if testing:
        # Change configuration if we're testing.
        context.config['DATABASE_URI'] = 'sqlite:///:memory:'
        context.config['DATABASE_ENGINE'] = sa.create_engine(
            context.config['DATABASE_URI'], echo=False)

        context.config['DATABASE_SESSION'].configure(
            bind=context.config['DATABASE_ENGINE'])

    # Apply site configuration.
    _apply_site_configuration(context)

    # Return the flask context.
    return context


def _add_package_context(application, package, context):
    with application.app_context():
        try:
            # Attempt to pull in this context.
            import_module('{}.{}'.format(package, context))

{'fraction_non_alphanumeric': 0.09875813128326434, 'fraction_numerical': 0.0005913660555884093, 'mean_word_length': 3.192069392812887, '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': '4484990', 'n_tokens_mistral': 940, 'n_tokens_neox': 908, 'n_words': 255}