<commit_before>from sqlalchemy import *
from migrate import *

from migrate.changeset import schema

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, object_mapper

from db.models import Adventures, Nodes, Roles, Tasks, Clusters
from db import api as api


# Base = declarative_base()
meta = MetaData()


def upgrade(migrate_engine):
    meta = MetaData(bind=migrate_engine)

    adventures = [
        {'name': 'install chef',
         'dsl': '{"start_state": "s1", "states": { "s1": { "action": "run_task", "parameters": {"action": "install_chef"}, "on_success": "s2"}, "s2": {"action": "set_backend", "parameters": {"backend": "chef-client", "backend_state": "installed"}}}}',
         'language': 'json',
         'backend': 'unprovisioned',
         'backend_state': 'unknown'},
        {'name': 'run chef',
         'dsl': '{"start_state": "s1", "states": {"s1": {
             "action": "run_task", "parameters": {"action": "run_chef"}}}}',
         'language': 'json',
         'backend': 'chef-client',
         'backend_state': 'installed'},
        {'name': 'install chef server',
         'dsl':  '{"start_state": "s1", "states": { "s1": { "action": "run_task", "parameters": {"action": "install_chef_server"}, "on_success": "s2"}, "s2": {"action": "set_backend", "parameters": {"backend": "chef-server", "backend_state": "installed"}}}}',
         'language': 'json',
         'backend': 'unprovisioned',
         'backend_state': 'unknown'}]

    for adventure in adventures:
        adv = api.adventure_create(adventure)


def downgrade(migrate_engine):
    meta = MetaData(bind=migrate_engine)

    types = Table('types', meta, autoload=True)<commit_msg>get some pep8 up in here<commit_after>import json

from sqlalchemy import *
from migrate import *

from migrate.changeset import schema

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, object_mapper

from db.models import Adventures, Nodes, Roles, Tasks, Clusters
from db import api as api


# Base = declarative_base()
meta = MetaData()


def upgrade(migrate_engine):
    meta = MetaData(bind=migrate_engine)

    adventures = [
        {'name': 'install chef',
         'dsl': json.dumps(
                {'start_state': 's1',
                 'states': {
                        's1': {'action': 'run_task',
                               'parameters': {'action': 'install_chef'},
                               'on_success': 's2' }
                        's2': {'action': 'set_backend',
                               'parameters': {'backend': 'chef-client',
                                              'backend_state': 'installed'}}}}),
         'language': 'json',
         'backend': 'unprovisioned',
         'backend_state': 'unknown'},
        {'name': 'run chef',
         'dsl': json.dumps(
                {'start_state': 's1',
                 'states': {
                        's1': {'action': 'run_task',
                               'parameters': {'action': 'run_chef'}}}}),
         'language': 'json',
         'backend': 'chef-client',
         'backend_state': 'installed'},
        {'name': 'install chef server',
         'dsl':  json.dumps(
                {'start_state': 's1',
                 'states': {
                        's1': {'action': 'run_task',
                               'parameters': {'action': 'install_chef_server'},
                               'on_success': 's2'},
                        's2': {'action': 'set_backend',
                               'parameters': {'backend': 'chef-server',
                                              'backend_state': 'installed'}}}}),
         'language': 'json',
         'backend': 'unprovisioned',
         'backend_state': 'unknown'}]

    for adventure in adventures:
        adv = api.adventure_create(adventure)


def downgrade(migrate_engine):
    meta = MetaData(bind=migrate_engine)

    types = Table('types', meta, autoload=True)
{'fraction_non_alphanumeric': 0.1602596105841238, 'fraction_numerical': 0.005242136794807789, 'mean_word_length': 2.2925225965488907, 'pattern_counts': {'":': 30, '<': 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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5516478', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1144, 'n_words': 277}