<commit_before>from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User

class Vote(models.Model):
    content_type    = models.ForeignKey(ContentType)
    object_id       = models.PositiveIntegerField()
    key             = models.CharField(max_length=32)
    score           = models.IntegerField()
    user            = models.ForeignKey(User, blank=True, null=True)
    ip_address      = models.IPAddressField()

    class Meta:
        unique_together = (('content_type', 'object_id', 'key', 'user', 'ip_address'))

class Score(models.Model):
    content_type    = models.ForeignKey(ContentType)
    object_id       = models.PositiveIntegerField()
    key             = models.CharField(max_length=32)
    score           = models.IntegerField()
    votes           = models.PositiveIntegerField()
    
    class Meta:
        unique_together = (('content_type', 'object_id', 'key'),)<commit_msg>Added partial_ip_address property to Vote model<commit_after>from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User

class Vote(models.Model):
    content_type    = models.ForeignKey(ContentType)
    object_id       = models.PositiveIntegerField()
    key             = models.CharField(max_length=32)
    score           = models.IntegerField()
    user            = models.ForeignKey(User, blank=True, null=True)
    ip_address      = models.IPAddressField()

    class Meta:
        unique_together = (('content_type', 'object_id', 'key', 'user', 'ip_address'))

    def partial_ip_address(self):
        ip = self.ip_address.split('.')
        ip[-1] = 'xxx'
        return '.'.join(ip)
    partial_ip_address = property(partial_ip_address)

class Score(models.Model):
    content_type    = models.ForeignKey(ContentType)
    object_id       = models.PositiveIntegerField()
    key             = models.CharField(max_length=32)
    score           = models.IntegerField()
    votes           = models.PositiveIntegerField()
    
    class Meta:
        unique_together = (('content_type', 'object_id', 'key'),)
{'fraction_non_alphanumeric': 0.1070110701107011, 'fraction_numerical': 0.004151291512915129, 'mean_word_length': 2.8870967741935485, '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': '6308298', 'n_tokens_mistral': 628, 'n_tokens_neox': 609, 'n_words': 122}