<commit_before>from django import forms
from django.contrib.auth.models import User

class SearchForm(forms.Form):
    q = forms.CharField(required=False)
    page = forms.IntegerField(required=False, initial=1)
    type = forms.ChoiceField(required=False,
            choices=(('l', 'Libraries'),('a', 'Add-ons')))
    author = forms.ModelChoiceField(required=False, queryset=User.objects.all())
    copies = forms.IntegerField(required=False, initial=0)<commit_msg>changing SearchForm's full_clean to not delete cleaned_data just because a field errored. it just isnt clean.<commit_after>from django import forms
from django.forms.utils import ErrorDict
from django.contrib.auth.models import User

TYPE_CHOICES = (
    ('l', 'Libraries'),
    ('a', 'Add-ons'),
)

class SearchForm(forms.Form):
    q = forms.CharField(required=False)
    page = forms.IntegerField(required=False, initial=1)
    type = forms.ChoiceField(required=False, choices=TYPE_CHOICES)
    author = forms.ModelChoiceField(required=False, queryset=User.objects.all())
    copies = forms.IntegerField(required=False, initial=0)

    def full_clean(self):
        """
        Cleans self.data and populates self._errors and self.cleaned_data.

        Does not remove cleaned_data if there are errors.
        """
        self._errors = ErrorDict()
        if not self.is_bound: # Stop further processing.
            return

        self.cleaned_data = {}
        # If the form is permitted to be empty, and none of the form data
        # has changed from the initial data, short circuit any validation.
        if self.empty_permitted and not self.has_changed():
            return
        self._clean_fields()
        self._clean_form()
        self._post_clean()
{'fraction_non_alphanumeric': 0.1046578493387004, 'fraction_numerical': 0.0023001725129384704, 'mean_word_length': 3.4050632911392404, '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': '4078321', 'n_tokens_mistral': 493, 'n_tokens_neox': 487, 'n_words': 133}