<commit_before>"""Chat related models"""
import django.utils.timezone
from django.db import models
from django.db.models.signals import post_save
from django.dispatch.dispatcher import receiver

from .manager import MessageManager


class Room(models.Model):
    """A class describing a chat room"""
    name = models.CharField(max_length=255, null=False, blank=False,
                            verbose_name='Room name')
    created_at = models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='Created date')
    created_by = models.ForeignKey('auth.User', db_column='created_by',
                                   null=False, blank=True,
                                   related_name='my_chat_rooms')
    users = models.ManyToManyField('auth.User', null=False, blank=False,
                                   related_name='chat_rooms')


class Message(models.Model):
    """A class describing a chat message"""
    room = models.ForeignKey('chat.Room', null=False, blank=False,
                             on_delete=models.CASCADE, related_name='messages')
    sender = models.ForeignKey('auth.User', null=False, blank=False)
    message = models.TextField()
    created_at = models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='Created date')

    objects = MessageManager()


class MessageDelivery(models.Model):
    """A class describing a message delivery status"""
    message = models.ForeignKey('chat.Message', null=False, blank=False,
                                on_delete=models.CASCADE,
                                related_name='deliveries')
    receiver = models.ForeignKey('auth.User', null=False, blank=False)
    delivered_at = models.DateTimeField(null=True, blank=True)
<commit_msg>fix python3 support<commit_after>"""Chat related models"""
from __future__ import unicode_literals

import django.utils.timezone
from django.db import models
from django.db.models.signals import post_save
from django.dispatch.dispatcher import receiver

from .manager import MessageManager


class Room(models.Model):
    """A class describing a chat room"""
    name = models.CharField(max_length=255, null=False, blank=False,
                            verbose_name='Room name')
    created_at = models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='Created date')
    created_by = models.ForeignKey('auth.User', db_column='created_by',
                                   null=False, blank=True,
                                   related_name='my_chat_rooms')
    users = models.ManyToManyField('auth.User', blank=False,
                                   related_name='chat_rooms')


class Message(models.Model):
    """A class describing a chat message"""
    room = models.ForeignKey('chat.Room', null=False, blank=False,
                             on_delete=models.CASCADE, related_name='messages')
    sender = models.ForeignKey('auth.User', null=False, blank=False)
    message = models.TextField()
    created_at = models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='Created date')

    objects = MessageManager()


class MessageDelivery(models.Model):
    """A class describing a message delivery status"""
    message = models.ForeignKey('chat.Message', null=False, blank=False,
                                on_delete=models.CASCADE,
                                related_name='deliveries')
    receiver = models.ForeignKey('auth.User', null=False, blank=False)
    delivered_at = models.DateTimeField(null=True, blank=True)

{'fraction_non_alphanumeric': 0.10340136054421768, 'fraction_numerical': 0.0019047619047619048, 'mean_word_length': 2.531219980787704, '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': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1146442', 'n_tokens_mistral': 968, 'n_tokens_neox': 934, 'n_words': 201}