<commit_before>from ConfigParser import ConfigParser

from pyramid.config import Configurator

import pkg_resources


def main(global_config, **settings):

    cp = ConfigParser()
    cp.readfp(pkg_resources.resource_stream('springboard', 'defaults.ini'))
    defaults = dict(cp.items('springboard:pyramid'))
    defaults['jinja2.filters'] += (
        '\nrecent_pages = springboard_iogt.filters:recent_pages'
        '\ncategory_dict = springboard_iogt.filters:category_dict\n'
        'content_section = springboard_iogt.filters:content_section')
    defaults.update(settings)

    config = Configurator(settings=defaults)

    # add to springboard routes
    config.add_route('content_section', '/section/{slug}/')
    config.add_route('personae', '/persona/')
    config.add_route('skip_persona_selection', '/persona/skip/')
    config.add_route('select_persona', '/persona/{slug}/')
    config.add_tween('springboard_iogt.views.persona_tween_factory')
    config.scan('.views')
    config.scan('.events')

    config.include('springboard.config')
    config.override_asset(
        to_override='springboard:templates/',
        override_with='springboard_iogt:templates/')
    config.add_static_view(
        'static', 'springboard_iogt:static', cache_max_age=3600)

    return config.make_wsgi_app()<commit_msg>add filters in a slightly neater way<commit_after>from ConfigParser import ConfigParser

from pyramid.config import Configurator

import pkg_resources


def main(global_config, **settings):

    cp = ConfigParser()
    cp.readfp(pkg_resources.resource_stream('springboard', 'defaults.ini'))
    defaults = dict(cp.items('springboard:pyramid'))
    filters = [
        'recent_pages = springboard_iogt.filters:recent_pages',
        'category_dict = springboard_iogt.filters:category_dict',
        'content_section = springboard_iogt.filters:content_section'
    ]
    defaults['jinja2.filters'] += '\n%s' % '\n'.join(filters)
    defaults.update(settings)

    config = Configurator(settings=defaults)

    # add to springboard routes
    config.add_route('content_section', '/section/{slug}/')
    config.add_route('personae', '/persona/')
    config.add_route('skip_persona_selection', '/persona/skip/')
    config.add_route('select_persona', '/persona/{slug}/')
    config.add_tween('springboard_iogt.views.persona_tween_factory')
    config.scan('.views')
    config.scan('.events')

    config.include('springboard.config')
    config.override_asset(
        to_override='springboard:templates/',
        override_with='springboard_iogt:templates/')
    config.add_static_view(
        'static', 'springboard_iogt:static', cache_max_age=3600)

    return config.make_wsgi_app()
{'fraction_non_alphanumeric': 0.12925925925925927, 'fraction_numerical': 0.003703703703703704, 'mean_word_length': 4.546201232032854, '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': '5693978', 'n_tokens_mistral': 862, 'n_tokens_neox': 837, 'n_words': 116}