<commit_before>from django.db import models
from django import forms
from django.core.validators import validate_email
from django.utils.translation import ugettext_lazy as _, ungettext_lazy
import ast


# Model fields
class ListField(models.TextField):
    description = "Stores a python list"

    def __init__(self, *args, **kwargs):
        self.delimiter = kwargs.pop('delimiter',',')
        super(ListField, self).__init__(*args, **kwargs)

    def from_db_value(self, value, expression, connection, context):
        if not value:
            return []
        else:
            return value.split(self.delimiter)

    def to_python(self, value):
        if not value:
            return []
        elif isinstance(value, list):
            return value
        else:
            try:
                val = ast.literal_eval(value)
                return val
            except SyntaxError,ValueError:
                return value.split(self.delimiter)

    def get_prep_value(self, value):
        if isinstance(value, list):<commit_msg>Multiple exceptions go in a tuple<commit_after>from django.db import models
from django import forms
from django.core.validators import validate_email
from django.utils.translation import ugettext_lazy as _, ungettext_lazy
import ast


# Model fields
class ListField(models.TextField):
    description = "Stores a python list"

    def __init__(self, *args, **kwargs):
        self.delimiter = kwargs.pop('delimiter',',')
        super(ListField, self).__init__(*args, **kwargs)

    def from_db_value(self, value, expression, connection, context):
        if not value:
            return []
        else:
            return value.split(self.delimiter)

    def to_python(self, value):
        if not value:
            return []
        elif isinstance(value, list):
            return value
        else:
            try:
                val = ast.literal_eval(value)
                return val
            except (SyntaxError, ValueError):
                return value.split(self.delimiter)

    def get_prep_value(self, value):
        if isinstance(value, list):
{'fraction_non_alphanumeric': 0.08802650260293422, 'fraction_numerical': 0.0, 'mean_word_length': 2.3824, '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': '3667037', 'n_tokens_mistral': 577, 'n_tokens_neox': 559, 'n_words': 163}