<commit_before># -*- coding: utf-8 -*-
from __future__ import absolute_import, division,\
       print_function, unicode_literals

from pyramid.config import *

class TetAppFactory(object):
    def __init__(self, *args, **kwargs):
        super(TetAppFactory, self).__init__(*args, **kwargs)

    def _dummy(self, *a, **kw):
        pass

    def init_app_factory(self, global_config, settings):
        self.settings = settings
        self.global_config = global_config
        self.config = self.make_configurator()

    def make_configurator(self):
        return Configurator(settings=self.settings)

    pre_configure_app = _dummy
    configure_db = _dummy

    def configure_app(self, config):
        self.configure_db(config)
        self.configure_routes(config)

    def configure_routes(self, config):
        pass

    def post_configure_app(self, config):
        pass

    def do_scan(self):
        self.config.scan(self.scan)

    def construct_app(self):
        if self.scan:
            self.do_scan()

        self.pre_configure_app(self.config)
        self.configure_app(self.config)
        self.post_configure_app(self.config)
        return self.config.make_wsgi_app()

    def __call__(self, global_config, **settings):
        self.init_app_factory(global_config, settings)
        return self.construct_app()

    @classmethod
    def main(cls, global_config, **settings):
        instance = cls()
        return instance(global_config, **settings)<commit_msg>allow setting includes as a nice list<commit_after># -*- coding: utf-8 -*-
from __future__ import absolute_import, division,\
       print_function, unicode_literals

from pyramid.config import *

class TetAppFactory(object):
    scan = None
    includes = None

    def __init__(self, *args, **kwargs):
        super(TetAppFactory, self).__init__(*args, **kwargs)

    def _dummy(self, *a, **kw):
        pass

    def init_app_factory(self, global_config, settings):
        self.settings = settings
        self.global_config = global_config
        self.config = self.make_configurator()

    def make_configurator(self):
        return Configurator(settings=self.settings)

    pre_configure_app = _dummy
    configure_db = _dummy

    def configure_app(self, config):
        self.configure_db(config)
        self.configure_routes(config)

    def configure_routes(self, config):
        pass

    def post_configure_app(self, config):
        pass

    def do_scan(self):
        self.config.scan(self.scan)


    def do_include(self):
        for i in self.includes:
            self.config.include(i)

    def construct_app(self):
        if self.includes:
            self.do_include()
        if self.scan:
            self.do_scan()

        self.pre_configure_app(self.config)
        self.configure_app(self.config)
        self.post_configure_app(self.config)
        return self.config.make_wsgi_app()

    def __call__(self, global_config, **settings):
        self.init_app_factory(global_config, settings)
        return self.construct_app()

    @classmethod
    def main(cls, global_config, **settings):
        instance = cls()
        return instance(global_config, **settings)
{'fraction_non_alphanumeric': 0.09905956112852665, 'fraction_numerical': 0.0006269592476489029, 'mean_word_length': 2.821556886227545, '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': '6164281', 'n_tokens_mistral': 965, 'n_tokens_neox': 932, 'n_words': 197}