<commit_before>from django.db import models

from smart_fields.models.handlers import SmartFieldsHandler

__all__ = (
    "SmartFieldsBaseModel",
)

class SmartFieldsBaseModel(models.Model, SmartFieldsHandler):

    def __init__(self, *args, **kwargs):
        super(self.__class__, self).__init__(*args, **kwargs)
        self.smart_fields_init()

    def save(self, *args, **kwargs):
        old = None
        try:
            old = self.__class__.objects.get(pk=self.pk)
        except self.__class__.DoesNotExist: pass
        super(self.__class__, self).save(*args, **kwargs)
        self.smart_fields_save(old)

    def delete(self, *args, **kwargs):
        self.smart_fields_delete()
        super(self.__class__, self).delete(*args, **kwargs)

    class Meta:<commit_msg>changes to models<commit_after>from django.db import models

from smart_fields.models.handlers import SmartFieldsHandler

__all__ = (
    "SmartFieldsBaseModel",
)

class SmartFieldsBaseModel(models.Model, SmartFieldsHandler):

    def __init__(self, *args, **kwargs):
        super(self.__class__, self).__init__(*args, **kwargs)
        self.smart_fields_init()

    def save(self, old=None, *args, **kwargs):
        try:
            old = self.__class__.objects.get(pk=self.pk)
        except self.__class__.DoesNotExist: pass
        super(self.__class__, self).save(*args, **kwargs)
        self.smart_fields_save(old)

    def delete(self, *args, **kwargs):
        self.smart_fields_delete()
        super(self.__class__, self).delete(*args, **kwargs)

    class Meta:
{'fraction_non_alphanumeric': 0.1252408477842004, 'fraction_numerical': 0.0, 'mean_word_length': 3.388732394366197, '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': '5298821', 'n_tokens_mistral': 476, 'n_tokens_neox': 465, 'n_words': 94}