<commit_before>import hmac

from django.db import models
from django.conf import settings
from django import dispatch
from django.utils.translation import ugettext as _
from django.db.models.signals import post_save
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
from django.template.loader import render_to_string
from django.contrib.auth.models import User

from mailer import send_mail


@dispatch.receiver(post_save, sender=User)
def create_profile(sender, instance=None, created=False, **kwargs):
    if created or instance.get_profile() is None:
        Profile.objects.create(user=instance)

user_activated_signal = dispatch.Signal(providing_args=[])


class Profile(models.Model):
    user = models.OneToOneField(User)


class AccountManager(object):
    def __init__(self, user):
        self.user = user

    @classmethod
    def get_username_base(self, firstname, lastname):
        base = u""
        first = slugify(firstname)
        last = slugify(lastname)
        if first and last:
            base = u"%s.%s" % (first[0], last)
        elif last:
            base = last
        elif first:
            base = first
        else:
            base = u"user"
        return base

    def confirm_account(self, secret, request_id=None):<commit_msg>Add Unicode representation of Profile<commit_after>import hmac

from django.db import models
from django.conf import settings
from django import dispatch
from django.utils.translation import ugettext as _
from django.db.models.signals import post_save
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
from django.template.loader import render_to_string
from django.contrib.auth.models import User

from mailer import send_mail


@dispatch.receiver(post_save, sender=User)
def create_profile(sender, instance=None, created=False, **kwargs):
    if created or instance.get_profile() is None:
        Profile.objects.create(user=instance)

user_activated_signal = dispatch.Signal(providing_args=[])


class Profile(models.Model):
    user = models.OneToOneField(User)

    def __unicode__(self):
        return _(u"Profile of <%(user)s>") % {"user": self.user}


class AccountManager(object):
    def __init__(self, user):
        self.user = user

    @classmethod
    def get_username_base(self, firstname, lastname):
        base = u""
        first = slugify(firstname)
        last = slugify(lastname)
        if first and last:
            base = u"%s.%s" % (first[0], last)
        elif last:
            base = last
        elif first:
            base = first
        else:
            base = u"user"
        return base

    def confirm_account(self, secret, request_id=None):
{'fraction_non_alphanumeric': 0.08713087860007292, 'fraction_numerical': 0.0007291286912139992, 'mean_word_length': 3.300940438871473, 'pattern_counts': {'":': 1, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5866611', 'n_tokens_mistral': 791, 'n_tokens_neox': 769, 'n_words': 223}