<commit_before>from django.db import models
from django.core.urlresolvers import reverse

from picklefield.fields import PickledObjectField

from . import utils

class Channel(models.Model):
    name = models.SlugField(max_length=50, unique=True)
    updated = models.DateTimeField(auto_now=True)

    class Meta:
        ordering = ['name']

    def __unicode__(self):
        return u'#%s' % self.name

    def get_absolute_url(self):
        return reverse('irclogview_channel', args=[self.name])

class Log(models.Model):
    channel = models.ForeignKey(Channel)
    date = models.DateField()
    mtime = models.DateTimeField()
    updated = models.DateTimeField(auto_now=True)
    content = PickledObjectField()

    class Meta:
        ordering = ['-date']
        unique_together = ('channel', 'date')

    def get_absolute_url(self):
        date = self.date
        return reverse('irclogview_show',
                       args=[self.channel.name,
                             '%04d' % date.year,
                             '%02d' % date.month,
                             '%02d' % date.day])

    def content_dict(self):
        colors = utils.RainbowColor()
        for data in self.content:
            item = dict(zip(['time', 'type', 'name', 'text'], data))
            item['name_color'] = colors.get_color(item['name'])
            yield item

<commit_msg>Don't assign color to action message<commit_after>from django.db import models
from django.core.urlresolvers import reverse

from picklefield.fields import PickledObjectField

from . import utils

class Channel(models.Model):
    name = models.SlugField(max_length=50, unique=True)
    updated = models.DateTimeField(auto_now=True)

    class Meta:
        ordering = ['name']

    def __unicode__(self):
        return u'#%s' % self.name

    def get_absolute_url(self):
        return reverse('irclogview_channel', args=[self.name])

class Log(models.Model):
    channel = models.ForeignKey(Channel)
    date = models.DateField()
    mtime = models.DateTimeField()
    updated = models.DateTimeField(auto_now=True)
    content = PickledObjectField()

    class Meta:
        ordering = ['-date']
        unique_together = ('channel', 'date')

    def get_absolute_url(self):
        date = self.date
        return reverse('irclogview_show',
                       args=[self.channel.name,
                             '%04d' % date.year,
                             '%02d' % date.month,
                             '%02d' % date.day])

    def content_dict(self):
        colors = utils.RainbowColor()
        for data in self.content:
            item = dict(zip(['time', 'type', 'name', 'text'], data))
            item['name_color'] = item['type'] == 'act' \
                                 and 'inherit' \
                                 or colors.get_color(item['name'])
            yield item


{'fraction_non_alphanumeric': 0.11762664816099931, 'fraction_numerical': 0.005551700208188758, 'mean_word_length': 2.189159292035398, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2600740', 'n_tokens_mistral': 835, 'n_tokens_neox': 814, 'n_words': 182}