<commit_before>from django.db import models
from django.utils.safestring import mark_safe

from cyder.base.utils import classproperty


class BaseModel(models.Model):
    """
    Base class for models to abstract some common features.

    * Adds automatic created and modified fields to the model.
    """
    created = models.DateTimeField(auto_now_add=True, null=True)
    modified = models.DateTimeField(auto_now=True, null=True)

    class Meta:
        abstract = True
        get_latest_by = 'created'

    @classproperty
    @classmethod
    def pretty_type(cls):
        return cls.__name__.lower()

    @property
    def pretty_name(self):
        return unicode(self)

    def unique_error_message(self, model_class, unique_check):
        error = super(BaseModel, self).unique_error_message(
            model_class, unique_check)
        kwargs = {}
        for field in unique_check:
            kwargs[field] = getattr(self, field)

        obj = model_class.objects.filter(**kwargs)
        if obj and hasattr(obj.get(), 'get_detail_url'):
            error = error[:-1] + ' at <a href={0}>{1}.</a>'.format(
                obj.get().get_detail_url(), obj.get())
            error = mark_safe(error)
        return error


class ExpirableMixin(models.Model):
    expire = models.DateTimeField(null=True, blank=True)
<commit_msg>Add help_text to interface 'expire' field<commit_after>from django.db import models
from django.utils.safestring import mark_safe

from cyder.base.utils import classproperty


class BaseModel(models.Model):
    """
    Base class for models to abstract some common features.

    * Adds automatic created and modified fields to the model.
    """
    created = models.DateTimeField(auto_now_add=True, null=True)
    modified = models.DateTimeField(auto_now=True, null=True)

    class Meta:
        abstract = True
        get_latest_by = 'created'

    @classproperty
    @classmethod
    def pretty_type(cls):
        return cls.__name__.lower()

    @property
    def pretty_name(self):
        return unicode(self)

    def unique_error_message(self, model_class, unique_check):
        error = super(BaseModel, self).unique_error_message(
            model_class, unique_check)
        kwargs = {}
        for field in unique_check:
            kwargs[field] = getattr(self, field)

        obj = model_class.objects.filter(**kwargs)
        if obj and hasattr(obj.get(), 'get_detail_url'):
            error = error[:-1] + ' at <a href={0}>{1}.</a>'.format(
                obj.get().get_detail_url(), obj.get())
            error = mark_safe(error)
        return error


class ExpirableMixin(models.Model):
    expire = models.DateTimeField(null=True, blank=True,
                                  help_text='Format: MM/DD/YYYY')

{'fraction_non_alphanumeric': 0.10388209920920201, 'fraction_numerical': 0.002156721782890007, 'mean_word_length': 2.7608108108108107, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2840277', 'n_tokens_mistral': 823, 'n_tokens_neox': 802, 'n_words': 197}