<commit_before># -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-09-04 17:24
from __future__ import unicode_literals

from django.db import migrations

location_data = {
    'Boston': {'street_address': '21 Drydock Avenue 610E',
               'city': 'Boston',
               'state': 'MA',
               'country': 'USA',
               'postcode': '02210',
               'timezone': 'America/New_York'},

    'UK': {'street_address': 'International House, 24 Holborn Viaduct',
           'city': 'London',
           'country': "England",
           'postcode': 'EC1A 2BN',
           'timezone': 'UTC'},

    'Israel': {'street_address': 'c/o Kiach St. 5 (Beit Alliance)',
               'city': 'Jerusalem',
               'country': 'Israel',
               'timezone': 'Israel'},

    'Mexico': {'city': 'Mexico City',
               'country': 'Mexico',
               'timezone': 'America/Mexico_City'},
    'Switzerland': {'street_address': 'Lausanne',
                    'country': 'Switzerland',
                    'timezone': 'Europe/Zurich'},

    'Texas - Austin': {'street_address': 'c/o WeWork, 801 Barton Springs Road',
                       'city': 'Austin',
                       'state': 'Texas',
                       'postcode': '78702',
                       'country': 'USA',
                       'timezone': 'America/Chicago'},
    'Rhode Island': {'street_address': '225 Dyer Street, 2nd Floor',
                     'city': 'Providence',
                     'state': 'RI',
                     'country': 'USA',
                     'postcode': '02903',
                     'timezone': 'America/New_York'},
    'FIA Smart Cities': {'street_address': '5 Chemin du Closel',
                         'city': 'Renens',
                         'country': 'Switzerland',
                         'timezone': 'UTC'},
    'Texas - Houston': {'street_address': '1313 Main Street Suite 210',
                        'city': 'Houston',
                        'state': 'TX',
                        'country': 'USA',
                        'postcode': '77002',
                        'timezone': 'America/Chicago'},
    }


program_family_locations = {
    'Boston': 'Boston',
    'MADE': 'Boston',
    'Mexico': 'Mexico',
    'Switzerland': 'Switzerland',
    'Texas - Austin': 'Texas - Austin',
    'HealthTech': 'Boston',
    'Bridge to MassChallenge Biscay': 'Boston',
    'Rhode Island': 'Rhode Island',
    'EIT Food Accelerator': "Switzerland",
    'Startup HUB CDMX from Facebook by MassChallenge Mexico': 'Mexico',
    'FinTech': 'Boston',
    'Global Alumni Program': 'Boston',
    'Comet (Boston)': 'Boston',
    'Comet (Texas)': "Texas - Austin",
    'Comet (Israel)': 'Israel',
    'FIA Smart Cities': 'FIA Smart Cities',
    'Innovation Bridge Mexico - Boston': 'Mexico',
    'Bridge to MassChallenge Taiwan': 'Boston',
    'Texas - Houston': 'Texas - Houston',
    'Impulse Accelerator Africa': 'Boston',
}


def migrate_program_family_location_info(apps, schema_editor):
    Location = apps.get_model('accelerator',
                              'Location')
    for name, values in location_data.items():
        Location.objects.create(name=name, **values)

    ProgramFamily = apps.get_model('accelerator',
                                   'ProgramFamily')
    ProgramFamilyLocation = apps.get_model('accelerator',
                                           'ProgramFamilyLocation')
    items = program_family_locations.items()
    for program_family_name, location_name in items:
        try:
            program_family = ProgramFamily.objects.get(
                name=program_family_name)
            location = Location.objects.get(name=location_name)
            ProgramFamilyLocation.objects.create(location=location,
                                                 program_family=program_family,
                                                 primary=True)
        except ProgramFamily.DoesNotExist:
            pass  # ignore
    boston = Location.objects.get(name="Boston")
    for program_family in ProgramFamily.objects.filter(
            programfamilylocation__isnull=True):
        ProgramFamilyLocation.objects.create(location=boston,
                                             program_family=program_family,
                                             primary=True)


class Migration(migrations.Migration):

    dependencies = [
        ('accelerator', '0003_add_street_address_to_location')
    ]

    operations = [
        migrations.RunPython(
            migrate_program_family_location_info,
            migrations.RunPython.noop)
    ]<commit_msg>[AC-6976] Update migration<commit_after># -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-09-04 17:24
from __future__ import unicode_literals

from django.db import migrations

location_data = {
    'Boston': {'name': 'MassChallenge Boston',
               'street_address': '21 Drydock Avenue 610E',
               'city': 'Boston',
               'state': 'MA',
               'country': 'USA',
               'postcode': '02210',
               'timezone': 'America/New_York'},

    'UK': {'name': 'MassChallenge UK',
           'street_address': 'International House, 24 Holborn Viaduct',
           'city': 'London',
           'country': "England",
           'postcode': 'EC1A 2BN',
           'timezone': 'UTC'},

    'Israel': {'name': 'MassChallenge Israel',
               'street_address': 'c/o Kiach St. 5 (Beit Alliance)',
               'city': 'Jerusalem',
               'country': 'Israel',
               'timezone': 'Israel'},

    'Mexico': {'name': 'MassChallenge Mexico',
               'city': 'Mexico City',
               'country': 'Mexico',
               'timezone': 'America/Mexico_City'},
    
    'Switzerland': {'name': 'MassChallenge Switzerland',
                    'street_address': 'Lausanne',
                    'country': 'Switzerland',
                    'timezone': 'Europe/Zurich'},

    'Texas - Austin': {'name': '<NAME>',
                       'street_address': 'c/o WeWork, 801 Barton Springs Road',
                       'city': 'Austin',
                       'state': 'Texas',
                       'postcode': '78702',
                       'country': 'USA',
                       'timezone': 'America/Chicago'},
    
    'Rhode Island': {'name': 'MassChallenge Rhode Island',
                     'street_address': '225 Dyer Street, 2nd Floor',
                     'city': 'Providence',
                     'state': 'RI',
                     'country': 'USA',
                     'postcode': '02903',
                     'timezone': 'America/New_York'},
    'FIA Smart Cities': {'name': 'FIA Smart Cities',
                         'street_address': '5 Chemin du Closel',
                         'city': 'Renens',
                         'country': 'Switzerland',
                         'timezone': 'UTC'},
    'Texas - Houston': {'name': 'MassChallenge Houston',
                        'street_address': '1313 Main Street Suite 210',
                        'city': 'Houston',
                        'state': 'TX',
                        'country': 'USA',
                        'postcode': '77002',
                        'timezone': 'America/Chicago'},
    }


program_family_locations = {
    'Boston': 'MassChallenge Boston',
    'MADE': 'MassChallenge Boston',
    'Mexico': 'MassChallenge Mexico',
    'Switzerland': 'MassChallenge Switzerland',
    'Texas - Austin': 'MassChallenge Austin',
    'HealthTech': 'MassChallenge Boston',
    'Bridge to MassChallenge Biscay': 'MassChallenge Boston',
    'Rhode Island': 'MassChallenge Rhode Island',
    'EIT Food Accelerator': "MassChallenge Switzerland",
    'Startup HUB CDMX from Facebook by MassChallenge Mexico': 'MassChallenge Mexico',
    'FinTech': 'MassChallenge Boston',
    'Global Alumni Program': 'MassChallenge Boston',
    'Comet (MassChallenge Boston)': 'MassChallenge Boston',
    'Comet (Texas)': "MassChallenge Austin",
    'Comet (MassChallenge Israel)': 'MassChallenge Israel',
    'FIA Smart Cities': 'FIA Smart Cities',
    'Innovation Bridge Mexico - MassChallenge Boston': 'MassChallenge Mexico',
    'Bridge to MassChallenge Taiwan': 'MassChallenge Boston',
    'Texas - Houston': 'MassChallenge Houston',
    'Impulse Accelerator Africa': 'MassChallenge Boston',
}


def migrate_program_family_location_info(apps, schema_editor):
    Location = apps.get_model('accelerator',
                              'Location')
    for name, values in location_data.items():
        Location.objects.create(**values)

    ProgramFamily = apps.get_model('accelerator',
                                   'ProgramFamily')
    ProgramFamilyLocation = apps.get_model('accelerator',
                                           'ProgramFamilyLocation')
    items = program_family_locations.items()
    for program_family_name, location_name in items:
        try:
            program_family = ProgramFamily.objects.get(
                name=program_family_name)
            location = Location.objects.get(name=location_name)
            ProgramFamilyLocation.objects.create(location=location,
                                                 program_family=program_family,
                                                 primary=True)
        except ProgramFamily.DoesNotExist:
            pass  # ignore
    boston = Location.objects.get(name="MassChallenge Boston")
    for program_family in ProgramFamily.objects.filter(
            programfamilylocation__isnull=True):
        ProgramFamilyLocation.objects.create(location=boston,
                                             program_family=program_family,
                                             primary=True)


class Migration(migrations.Migration):

    dependencies = [
        ('accelerator', '0003_add_street_address_to_location')
    ]

    operations = [
        migrations.RunPython(
            migrate_program_family_location_info,
            migrations.RunPython.noop)
    ]
{'fraction_non_alphanumeric': 0.12433994221380891, 'fraction_numerical': 0.013749128225565408, 'mean_word_length': 1.8614595210946407, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2015279', 'n_tokens_mistral': 2894, 'n_tokens_neox': 2559, 'n_words': 617}