<commit_before>#!/usr/bin/env python
import os
from app import create_app, db
from app.models import (
    CsvBodyCell,
    CsvBodyRow,
    CsvContainer,
    CsvHeaderCell,
    CsvHeaderRow,
    Resource,
    ResourceBase,
    ResourceSuggestion,
    Role,
    User
)
from config import Config
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand


# Import settings from .env file. Must define FLASK_CONFIG
if os.path.exists('.env'):
    print('Importing environment from .env file')
    for line in open('.env'):
        var = line.strip().split('=')
        if len(var) == 2:
            os.environ[var[0]] = var[1]

app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)


def make_shell_context():
    return dict(app=app, db=db, User=User, Role=Role, CsvBodyCell=CsvBodyCell,
                CsvBodyRow=CsvBodyRow, CsvContainer=CsvContainer,
                CsvHeaderCell=CsvHeaderCell, CsvHeaderRow=CsvHeaderRow,
                Resource=Resource, ResourceBase=ResourceBase,
                ResourceSuggestion=ResourceSuggestion)


manager.add_command('shell', Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)


@manager.command
def test():
    """Run the unit tests."""
    import unittest

    tests = unittest.TestLoader().discover('tests')<commit_msg>Added more model classes to manager shell<commit_after>#!/usr/bin/env python
import os
from app import create_app, db
from app.models import (
    CsvBodyCell,
    CsvBodyRow,
    CsvContainer,
    CsvHeaderCell,
    CsvHeaderRow,
    Descriptor,
    OptionAssociation,
    Resource,
    ResourceBase,
    ResourceSuggestion,
    Role,
    TextAssociation,
    User
)
from config import Config
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand


# Import settings from .env file. Must define FLASK_CONFIG
if os.path.exists('.env'):
    print('Importing environment from .env file')
    for line in open('.env'):
        var = line.strip().split('=')
        if len(var) == 2:
            os.environ[var[0]] = var[1]

app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)


def make_shell_context():
    return dict(app=app, db=db, User=User, Role=Role, CsvBodyCell=CsvBodyCell,
                CsvBodyRow=CsvBodyRow, CsvContainer=CsvContainer,
                CsvHeaderCell=CsvHeaderCell, CsvHeaderRow=CsvHeaderRow,
                Resource=Resource, ResourceBase=ResourceBase,
                ResourceSuggestion=ResourceSuggestion, Descriptor=Descriptor,
                TextAssociation=TextAssociation,
                OptionAssociation=OptionAssociation)


manager.add_command('shell', Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)


@manager.command
def test():
    """Run the unit tests."""
    import unittest

    tests = unittest.TestLoader().discover('tests')
{'fraction_non_alphanumeric': 0.10510510510510511, 'fraction_numerical': 0.002002002002002002, 'mean_word_length': 3.549317147192716, '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': '6828618', 'n_tokens_mistral': 941, 'n_tokens_neox': 897, 'n_words': 213}