<commit_before>from datetime import datetime, timedelta
import uuid


from django.conf import settings
from django.db import models, connection


from prosodyauth.prosody import db


# Create your models here.

class Prosody(models.Model):
    host = models.TextField(default=settings.PROSODY_DEFAULT_DOMAIN)
    user = models.TextField(db_index=True)
    store = models.TextField(db_index=True)
    key = models.TextField(db_index=True)
    type = models.TextField()
    value = models.TextField()

    class Meta:
        db_table = 'prosody'

class User(models.Model):
    """
    User model

    This User model relies in part on the Prosody model for additional data
    about the user, including password and the XMPP domain.
    """

    #def __init__(self, *args, **kwargs):
    #    super().__init__(*args, **kwargs)
    #    try:
    #        self._lastlog_data = db.get_data_store(self.username, 'lastlog')
    #    except:
    #        self._lastlog_data = {}

    username = models.CharField(max_length=30, unique=True)
    email = models.EmailField(null=True)
    first_name = models.CharField(max_length=30, null=True)
    last_name = models.CharField(max_length=30, null=True)
    is_active = models.BooleanField(default=False)
    is_superuser = models.BooleanField(default=False)
    date_joined = models.DateTimeField(auto_now_add=True)
    timezone = models.CharField(max_length=30, null=True)

    _lastlog_data = None

    @property
    def full_name(self):
        return '{} {}'.format(self.first_name, self.last_name).strip()

    @property
    def xmpp_online(self):
        if self._get_lastlog('event') == 'login':
            return True
        else:
            return False

    @property
    def xmpp_last_login(self):
        return datetime.utcfromtimestamp(self._get_lastlog('timestamp'))

    @property
    def xmpp_last_ip(self):
        return self._get_lastlog('ip')
<commit_msg>Removed vestigial code<commit_after>from datetime import datetime, timedelta
import uuid


from django.conf import settings
from django.db import models, connection


from prosodyauth.prosody import db


# Create your models here.

class Prosody(models.Model):
    host = models.TextField(default=settings.PROSODY_DEFAULT_DOMAIN)
    user = models.TextField(db_index=True)
    store = models.TextField(db_index=True)
    key = models.TextField(db_index=True)
    type = models.TextField()
    value = models.TextField()

    class Meta:
        db_table = 'prosody'

class User(models.Model):
    """
    User model

    This User model relies in part on the Prosody model for additional data
    about the user, including password and the XMPP domain.
    """

    username = models.CharField(max_length=30, unique=True)
    email = models.EmailField(null=True)
    first_name = models.CharField(max_length=30, null=True)
    last_name = models.CharField(max_length=30, null=True)
    is_active = models.BooleanField(default=False)
    is_superuser = models.BooleanField(default=False)
    date_joined = models.DateTimeField(auto_now_add=True)
    timezone = models.CharField(max_length=30, null=True)

    _lastlog_data = None

    @property
    def full_name(self):
        return '{} {}'.format(self.first_name, self.last_name).strip()

    @property
    def xmpp_online(self):
        if self._get_lastlog('event') == 'login':
            return True
        else:
            return False

    @property
    def xmpp_last_login(self):
        return datetime.utcfromtimestamp(self._get_lastlog('timestamp'))

    @property
    def xmpp_last_ip(self):
        return self._get_lastlog('ip')

{'fraction_non_alphanumeric': 0.10069156293222684, 'fraction_numerical': 0.004426002766251729, 'mean_word_length': 3.4097560975609755, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6573687', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1106, 'n_words': 248}