<commit_before># encoding: utf-8
import datetime
import random
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.auth.models import User
from apps.social.models import MSocialProfile

class Migration(DataMigration):

    def forwards(self, orm):
        "Write your forwards methods here."
        user = User.objects.create(username='popular', email='<EMAIL>')
        user.set_password("%<PASSWORD>" % (random.random(), random.random()))
        user.save()
        profile, _ = MSocialProfile.objects.get_or_create(user_id=user.pk)
        profile.save()

    def backwards(self, orm):
        "Write your backwards methods here."<commit_msg>Error checking in profile migration.<commit_after># encoding: utf-8
import datetime
import random
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.auth.models import User
from apps.social.models import MSocialProfile
from mongoengine.queryset import OperationError

class Migration(DataMigration):

    def forwards(self, orm):
        "Write your forwards methods here."
        user = User.objects.create(username='popular', email='<EMAIL>')
        user.set_password("<PASSWORD>" % (random.random(), random.random()))
        user.save()
        try:
            profile, _ = MSocialProfile.objects.get_or_create(user_id=user.pk)
            profile.save()
        except OperationError:
            print " ---> Whoops, already have a popular user."

    def backwards(self, orm):
        "Write your backwards methods here."
{'fraction_non_alphanumeric': 0.10370835952231301, 'fraction_numerical': 0.00251414204902577, 'mean_word_length': 3.484507042253521, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '4221000', 'n_tokens_mistral': 436, 'n_tokens_neox': 427, 'n_words': 127}