<commit_before>from django.db import models
from django.utils.translation import pgettext_lazy
from django.utils.encoding import python_2_unicode_compatible


@python_2_unicode_compatible
class Setting(models.Model):
    INTEGER = 'i'
    STRING = 's'
    BOOLEAN = 'b'
    VALUE_TYPE_CHOICES = (
        (INTEGER, pgettext_lazy('Settings', 'Integer')),
        (STRING, pgettext_lazy('Settings', 'String')),
        (BOOLEAN, pgettext_lazy('Settings', 'Boolean')),
    )
    name = models.CharField(
        pgettext_lazy('Settings field', 'name'), max_length=128)
    value_type = models.CharField(pgettext_lazy('Settings field', 'value type'),
                                  max_length=1, choices=VALUE_TYPE_CHOICES)
    value = models.CharField(
        pgettext_lazy('Settings field', 'value'), max_length=256)

    def convert_value(self):
        if self.value_type == self.INTEGER:
            return int(self.value)
        elif self.value_type == self.BOOLEAN:<commit_msg>Move choices outside of model class<commit_after>from django.db import models
from django.utils.translation import pgettext_lazy
from django.utils.encoding import python_2_unicode_compatible


INTEGER = 'i'
STRING = 's'
BOOLEAN = 'b'


@python_2_unicode_compatible
class Setting(models.Model):
    VALUE_TYPE_CHOICES = (
        (INTEGER, pgettext_lazy('Settings', 'Integer')),
        (STRING, pgettext_lazy('Settings', 'String')),
        (BOOLEAN, pgettext_lazy('Settings', 'Boolean')),
    )
    name = models.CharField(
        pgettext_lazy('Settings field', 'name'), max_length=128)
    value_type = models.CharField(pgettext_lazy('Settings field', 'value type'),
                                  max_length=1, choices=VALUE_TYPE_CHOICES)
    value = models.CharField(
        pgettext_lazy('Settings field', 'value'), max_length=256)

    def convert_value(self):
        if self.value_type == self.INTEGER:
            return int(self.value)
        elif self.value_type == self.BOOLEAN:
{'fraction_non_alphanumeric': 0.11604439959636731, 'fraction_numerical': 0.009081735620585268, 'mean_word_length': 3.4461883408071747, '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': '1511032', 'n_tokens_mistral': 641, 'n_tokens_neox': 619, 'n_words': 124}