<commit_before>from django.db.models import TextField, ForeignKey, FloatField, DateTimeField, ManyToManyField
from yunity.models.utils import BaseModel, MaxLengthCharField
from yunity.utils.decorators import classproperty


class Versionable(BaseModel):
    pass


class Metadata(BaseModel):
    key = MaxLengthCharField()
    value = TextField()


class Category(BaseModel):
    name = MaxLengthCharField()
    parent = ForeignKey('yunity.Category', null=True, related_name='children')


class Contact(BaseModel):
    @classproperty
    def TYPE(cls):
        return cls.create_constants('type', 'EMAIL', 'DIRECT')

    value = MaxLengthCharField()
    type = MaxLengthCharField()


class Location(BaseModel):
    latitude = FloatField()
    longitude = FloatField()


class User(BaseModel):
    name = TextField()
    contact = ManyToManyField(Contact)
    location = ManyToManyField(Location, null=True, through='yunity.UserLocation')


class Message(BaseModel):
    @classproperty
    def TYPE(cls):
        return cls.create_constants('type', 'TEXT')

    content = TextField()
    type = MaxLengthCharField()
    createdAt = DateTimeField(auto_now=True)


class Mappable(Versionable):
    provenance = MaxLengthCharField()
    name = TextField()
    metadata = ForeignKey(Metadata, null=True)
    category = ForeignKey(Category)
    location = ManyToManyField(Location, through='yunity.MappableLocation')
    contact = ManyToManyField(Contact)
    wall = ManyToManyField(Message, null=True)
    responsible = ManyToManyField(User, through='yunity.MappableResponsibility')


class Event(BaseModel):
    type = MaxLengthCharField()
    time = DateTimeField(auto_now=True)
    initiator = ForeignKey(User)
    target = ForeignKey(Versionable)<commit_msg>Add back-reference to User table to Message<commit_after>from django.db.models import TextField, ForeignKey, FloatField, DateTimeField, ManyToManyField
from yunity.models.utils import BaseModel, MaxLengthCharField
from yunity.utils.decorators import classproperty


class Versionable(BaseModel):
    pass


class Metadata(BaseModel):
    key = MaxLengthCharField()
    value = TextField()


class Category(BaseModel):
    name = MaxLengthCharField()
    parent = ForeignKey('yunity.Category', null=True, related_name='children')


class Contact(BaseModel):
    @classproperty
    def TYPE(cls):
        return cls.create_constants('type', 'EMAIL', 'DIRECT')

    value = MaxLengthCharField()
    type = MaxLengthCharField()


class Location(BaseModel):
    latitude = FloatField()
    longitude = FloatField()


class User(BaseModel):
    name = TextField()
    contact = ManyToManyField(Contact)
    location = ManyToManyField(Location, null=True, through='yunity.UserLocation')


class Message(BaseModel):
    @classproperty
    def TYPE(cls):
        return cls.create_constants('type', 'TEXT')

    sender = ForeignKey(User)
    content = TextField()
    type = MaxLengthCharField()
    createdAt = DateTimeField(auto_now=True)


class Mappable(Versionable):
    provenance = MaxLengthCharField()
    name = TextField()
    metadata = ForeignKey(Metadata, null=True)
    category = ForeignKey(Category)
    location = ManyToManyField(Location, through='yunity.MappableLocation')
    contact = ManyToManyField(Contact)
    wall = ManyToManyField(Message, null=True)
    responsible = ManyToManyField(User, through='yunity.MappableResponsibility')


class Event(BaseModel):
    type = MaxLengthCharField()
    time = DateTimeField(auto_now=True)
    initiator = ForeignKey(User)
    target = ForeignKey(Versionable)
{'fraction_non_alphanumeric': 0.10072747621712368, 'fraction_numerical': 0.0, 'mean_word_length': 4.701754385964913, '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': '6581231', 'n_tokens_mistral': 1034, 'n_tokens_neox': 1020, 'n_words': 225}