Exemple #1
0
async def make_app():
    loop = asyncio.get_event_loop()
    app = web.Application(loop=loop)

    configure_settings(app)
    setup_routes(app)

    aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader(os.path.abspath('templates')))

    return app
Exemple #2
0
def merge(ctx, parent_dirs, output_dir):
    """
    Merges the best brains of the parent experment directories
    into a new directory, and initializes (but does not run)
    that experiment:

    \b
    The settings passed to this command will be used to initialize
    and perform the initial evaluation of the merged experiment.

    \b
    Arguments:
      parent_dirs - Directories of parent experiments to merge.
      output_dir  - Directory to place the merged experiment into.
    """
    # Remove all options from the directory arguments
    parent_dirs = [x for x in list(parent_dirs) if not x.startswith("--")]
    if output_dir.startswith("--"):
        output_dir = parent_dirs.pop() if len(parent_dirs) > 0 else ""
    # Configure settings, then actually merge the experiments
    settings.configure_settings()
    merge_experiments(parent_dirs, output_dir)
Exemple #3
0
"""
Provides the ability to run test on a standalone Django app.
"""
import sys
from optparse import OptionParser
from settings import configure_settings

# Configure the default settings
configure_settings()

# Django nose must be imported here since it depends on the settings being configured
from django_nose import NoseTestSuiteRunner


def run_tests(*test_args, **kwargs):
    if not test_args:
        test_args = ['smart_manager']

    kwargs.setdefault('interactive', False)

    test_runner = NoseTestSuiteRunner(**kwargs)

    failures = test_runner.run_tests(test_args)
    sys.exit(failures)


if __name__ == '__main__':
    parser = OptionParser()
    parser.add_option('--verbosity',
                      dest='verbosity',
                      action='store',
"""
Provides the ability to run test on a standalone Django app.
"""
import sys
from optparse import OptionParser

from django.conf import settings

from settings import configure_settings


# Configure the default settings
configure_settings()

# Django nose must be imported here since it depends on the settings being configured
from django_nose import NoseTestSuiteRunner


def run_tests(*test_args, **kwargs):
    if 'south' in settings.INSTALLED_APPS:
        from south.management.commands import patch_for_test_db_setup
        patch_for_test_db_setup()

    if not test_args:
        test_args = ['django_kmatch']

    kwargs.setdefault('interactive', False)

    test_runner = NoseTestSuiteRunner(**kwargs)

    failures = test_runner.run_tests(test_args)
Exemple #5
0
"""
Entry point for the Asteroids Game / AI.

Usage: python start.py [--help]
"""

from ai.ai_app import AI_App
from ai.experiment import run_experiment
from ai.utils import algorithm_id_to_ai_brain_class
from asteroids.app import App
import settings

if __name__ == "__main__":

    # Configure settings according to command line arguments
    settings.configure_settings()

    # Start the game if specified
    if settings.RUN_MODE == settings.GAME:
        if settings.PLAYER_MODE == settings.HUMAN:
            App().start_game()
        else:
            ai_brain_class = algorithm_id_to_ai_brain_class(
                settings.GAME_ALGORITHM_ID)
            ai_brain = ai_brain_class.load(settings.GAME_AI_BRAIN)
            AI_App().start_game(ai_brain)

    # Start experiment if specified
    elif settings.RUN_MODE == settings.EXPERIMENT:
        run_experiment()