<commit_before>from __future__ import unicode_literals

import importlib

from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.utils.functional import cached_property

from model_utils import Choices
from autoslug import AutoSlugField
from positions import PositionField

from formulator.conf import settings


if settings.FORMULATOR_CRISPY_ENABLED:
    from crispy_forms.helper import FormHelper
    from crispy_forms import layout


class Form(settings.FORMULATOR_BASE_MODEL):

    ENCTYPES = Choices((0, 'urlencoded', 'application/x-www-form-urlencoded'),
                       (1, 'multipart', 'multipart/form-data'),
                       (2, 'plain', 'text/plain'))

    METHODS = Choices((0, 'get', 'GET'), (1, 'post', 'POST'))

    name = models.CharField(max_length=100, help_text='Name of the Form type')

    # common HTML form attributes
    form_name = models.CharField(max_length=100, blank=True)
    form_action = models.CharField(max_length=250, blank=True)
    form_method = models.IntegerField(max_length=10, choices=METHODS, default=METHODS.post)
    form_id = AutoSlugField(populate_from='name')
    form_class = models.CharField(max_length=250, blank=True)

    form_accept_charset = models.CharField(max_length=100, blank=True)
    form_autocomplete = models.BooleanField(default=False)
    form_novalidate = models.BooleanField(default=False)
    form_enctype = models.IntegerField(choices=ENCTYPES, default=ENCTYPES.urlencoded)
    form_target = models.CharField(max_length=50, blank=True)

    @cached_property
    def fieldsets(self):
        return self.fieldset_set.all().prefetch_related('field_set')<commit_msg>fields.W122 removing max_length from integerfield<commit_after>from __future__ import unicode_literals

import importlib

from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.utils.functional import cached_property

from model_utils import Choices
from autoslug import AutoSlugField
from positions import PositionField

from formulator.conf import settings


if settings.FORMULATOR_CRISPY_ENABLED:
    from crispy_forms.helper import FormHelper
    from crispy_forms import layout


class Form(settings.FORMULATOR_BASE_MODEL):

    ENCTYPES = Choices((0, 'urlencoded', 'application/x-www-form-urlencoded'),
                       (1, 'multipart', 'multipart/form-data'),
                       (2, 'plain', 'text/plain'))

    METHODS = Choices((0, 'get', 'GET'), (1, 'post', 'POST'))

    name = models.CharField(max_length=100, help_text='Name of the Form type')

    # common HTML form attributes
    form_name = models.CharField(max_length=100, blank=True)
    form_action = models.CharField(max_length=250, blank=True)
    form_method = models.IntegerField(choices=METHODS, default=METHODS.post)
    form_id = AutoSlugField(populate_from='name')
    form_class = models.CharField(max_length=250, blank=True)

    form_accept_charset = models.CharField(max_length=100, blank=True)
    form_autocomplete = models.BooleanField(default=False)
    form_novalidate = models.BooleanField(default=False)
    form_enctype = models.IntegerField(choices=ENCTYPES, default=ENCTYPES.urlencoded)
    form_target = models.CharField(max_length=50, blank=True)

    @cached_property
    def fieldsets(self):
        return self.fieldset_set.all().prefetch_related('field_set')
{'fraction_non_alphanumeric': 0.09631811487481591, 'fraction_numerical': 0.01443298969072165, 'mean_word_length': 4.746192893401015, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1637658', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1033, 'n_words': 218}