<commit_before>from django.db import models
from django.utils.translation import ugettext_lazy as _
try:
    from django.utils.timezone import now
except ImportError:
    from datetime import datetime
    now = datetime.now

from admin_sso import settings

try:
    User = settings.AUTH_PROFILE_MODULE
except AttributeError:
    from django.contrib.auth.models import User


class Assignment(models.Model):
    username_mode = models.IntegerField(choices=settings.ASSIGNMENT_CHOICES)
    username = models.CharField(max_length=255, blank=True)
    domain = models.CharField(max_length=255)
    copy = models.BooleanField(default=False)
    weight = models.PositiveIntegerField(default=0)
    user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True)

    class Meta:
        verbose_name = _('Assignment')
        verbose_name_plural = _('Assignments')
        ordering = ('-weight',)

    def __unicode__(self):
        return u"%s(%s) @%s" % (dict(settings.ASSIGNMENT_CHOICES)[self.username_mode], self.username, self.domain)


class OpenIDUser(models.Model):
    claimed_id = models.TextField(max_length=2047)
    email = models.EmailField()
    fullname = models.CharField(max_length=255)
    user = models.ForeignKey(settings.AUTH_USER_MODEL)
    last_login = models.DateTimeField(_('last login'), default=now)

    class Meta:
        verbose_name = _('OpenIDUser')
        verbose_name_plural = _('OpenIDUsers')

    def __unicode__(self):
        return self.claimed_id

    def update_last_login(self):
        self.last_login = now()
        self.save()


class Nonce(models.Model):
    server_url = models.CharField(max_length=2047)<commit_msg>stay compatible with django < 1.5<commit_after>from django.db import models
from django.utils.translation import ugettext_lazy as _
try:
    from django.utils.timezone import now
except ImportError:
    from datetime import datetime
    now = datetime.now

from admin_sso import settings

User = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')


class Assignment(models.Model):
    username_mode = models.IntegerField(choices=settings.ASSIGNMENT_CHOICES)
    username = models.CharField(max_length=255, blank=True)
    domain = models.CharField(max_length=255)
    copy = models.BooleanField(default=False)
    weight = models.PositiveIntegerField(default=0)
    user = models.ForeignKey(User, null=True, blank=True)

    class Meta:
        verbose_name = _('Assignment')
        verbose_name_plural = _('Assignments')
        ordering = ('-weight',)

    def __unicode__(self):
        return u"%s(%s) @%s" % (dict(settings.ASSIGNMENT_CHOICES)[self.username_mode], self.username, self.domain)


class OpenIDUser(models.Model):
    claimed_id = models.TextField(max_length=2047)
    email = models.EmailField()
    fullname = models.CharField(max_length=255)
    user = models.ForeignKey(User)
    last_login = models.DateTimeField(_('last login'), default=now)

    class Meta:
        verbose_name = _('OpenIDUser')
        verbose_name_plural = _('OpenIDUsers')

    def __unicode__(self):
        return self.claimed_id

    def update_last_login(self):
        self.last_login = now()
        self.save()


class Nonce(models.Model):
    server_url = models.CharField(max_length=2047)
{'fraction_non_alphanumeric': 0.10450505669629176, 'fraction_numerical': 0.011645724793135151, 'mean_word_length': 4.013824884792626, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4358570', 'n_tokens_mistral': 1045, 'n_tokens_neox': 991, 'n_words': 200}