<commit_before>
import datetime

import mongoengine as me

class IntVector(me.EmbeddedDocument):
    '''A document for holding documents with three integer vectors: 
        x, y and z.'''
    x = me.IntField(default=0)
    y = me.IntField(default=0)
    z = me.IntField(default=0)

class FloatVector(me.EmbeddedDocument):
    '''A document for holding documents with three float vectors:
        x, y and z.'''
    x = me.FloatField(default=0)
    y = me.FloatField(default=0)
    z = me.FloatField(default=0)

class Object(me.Document):
    '''In-world objects.'''
    name = me.StringField(default="")
    resource = me.StringField(default="")

    loc = me.EmbeddedDocumentField(IntVector) # FIXME: Make this a floatvector.
    rot = me.EmbeddedDocumentField(FloatVector)
    scale = me.EmbeddedDocumentField(FloatVector)
    vel = me.EmbeddedDocumentField(FloatVector)

    states = me.ListField(me.StringField())
    physical = me.BooleanField(default=True)
    last_modified = me.DateTimeField(default=datetime.datetime.now)

    meta = {'indexes': ['last_modified',
                        'loc.x', 'loc.y', 'loc.z',
                        'states',
                        'physical',
                        ]}

    def set_modified(self, date_time=None):
        if date_time is None:
            date_time = datetime.datetime.now()
        self.last_modified = date_time
        self.save()

class ScriptedObject(Object):
    scripts = me.ListField(me.StringField())

class Character(ScriptedObject):
    '''Players' characters.'''
    speed = me.FloatField(default=5)

class Message(me.Document):
    '''A message said and displayed as if it were in world.
    Used only for zone-local messages.'''
    sent = me.DateTimeField(default=datetime.datetime.now)
    sender = me.StringField(default="")
    body = me.StringField(default="")
    loc = me.EmbeddedDocumentField(IntVector)
    player_generated = me.BooleanField(default=False)
<commit_msg>Updating more mongoengine models to allow inheritance in the future.<commit_after>
import datetime

import mongoengine as me

class IntVector(me.EmbeddedDocument):
    '''A document for holding documents with three integer vectors: 
        x, y and z.'''
    x = me.IntField(default=0)
    y = me.IntField(default=0)
    z = me.IntField(default=0)

class FloatVector(me.EmbeddedDocument):
    '''A document for holding documents with three float vectors:
        x, y and z.'''
    x = me.FloatField(default=0)
    y = me.FloatField(default=0)
    z = me.FloatField(default=0)

class Object(me.Document):
    '''In-world objects.'''
    name = me.StringField(default="")
    resource = me.StringField(default="")

    loc = me.EmbeddedDocumentField(IntVector) # FIXME: Make this a floatvector.
    rot = me.EmbeddedDocumentField(FloatVector)
    scale = me.EmbeddedDocumentField(FloatVector)
    vel = me.EmbeddedDocumentField(FloatVector)

    states = me.ListField(me.StringField())
    physical = me.BooleanField(default=True)
    last_modified = me.DateTimeField(default=datetime.datetime.now)

    meta = {'indexes': ['last_modified',
                        'loc.x', 'loc.y', 'loc.z',
                        'states',
                        'physical'],
            'allow_inheritance': True,
            }

    def set_modified(self, date_time=None):
        if date_time is None:
            date_time = datetime.datetime.now()
        self.last_modified = date_time
        self.save()

class ScriptedObject(Object):
    scripts = me.ListField(me.StringField())
    meta = {'allow_inheritance': True}

class Character(ScriptedObject):
    '''Players' characters.'''
    speed = me.FloatField(default=5)
    meta = {'allow_inheritance': True}

class Message(me.Document):
    '''A message said and displayed as if it were in world.
    Used only for zone-local messages.'''
    sent = me.DateTimeField(default=datetime.datetime.now)
    sender = me.StringField(default="")
    body = me.StringField(default="")
    loc = me.EmbeddedDocumentField(IntVector)
    player_generated = me.BooleanField(default=False)

{'fraction_non_alphanumeric': 0.12022526934378061, 'fraction_numerical': 0.0034280117531831538, 'mean_word_length': 3.056603773584906, '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': '6052985', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1196, 'n_words': 285}