<commit_before>import json

from directory_validators import enrolment as shared_validators
from directory_validators.constants import choices

from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe

from enrolment import helpers, validators


class IndentedInvalidFieldsMixin:
    error_css_class = 'input-field-container has-error'


class CompanyForm(IndentedInvalidFieldsMixin, forms.Form):
    company_number = forms.CharField(
        label='Company number:',
        help_text=mark_safe(
            'This is the 8-digit number on the company certificate of '
            'incorporation. Find your company number from '
            '<a href="{url}" target="_blank">Companies House'
            '</a>'.format(url=settings.COMPANIES_HOUSE_SEARCH_URL)
        ),
        validators=helpers.halt_validation_on_failure(
            shared_validators.company_number,
            validators.company_number,
        )
    )


class CompanyNameForm(IndentedInvalidFieldsMixin, forms.Form):
    company_name = forms.CharField(
        label='Company Name:',
        help_text=(
            "Click next if this is your company. If it is not your company "
            "then click back in your browser and re-enter your company's "
            "number."
        ),
        widget=forms.TextInput(attrs={'readonly': 'readonly'}),
    )


class CompanyExportStatusForm(IndentedInvalidFieldsMixin, forms.Form):
    export_status = forms.ChoiceField(
        label=(
            'Has your company sold products or services to overseas customers?'
        ),
        choices=choices.EXPORT_STATUSES,
        validators=[shared_validators.export_status_intention]
    )


class CompanyBasicInfoForm(IndentedInvalidFieldsMixin, forms.Form):
    company_name = forms.CharField(
        help_text=(
            'You can change this from the Companies House listing to '
            'better fit your profile.'
        ),
        max_length=255,
    )
    website = forms.URLField(max_length=255)
    keywords = forms.CharField(
        label='Enter up to 10 keywords that describe your company:',
        help_text=(
            'Keywords should be separated with commas. These keywords will be '
            'used to help potential overseas buyers find your company.'
        ),
        widget=forms.Textarea,
        max_length=1000,
    )


class CompanyDescriptionForm(IndentedInvalidFieldsMixin, forms.Form):
    description = forms.CharField(
        widget=forms.Textarea,
        label='Describe your business to overseas buyers:',
        help_text='Maximum 1,000 characters.',
        max_length=1000,
    )


class CompanyLogoForm(IndentedInvalidFieldsMixin, forms.Form):
    logo = forms.FileField(
        help_text=(
            'For best results this should be a transparent PNG file of 600 x '
            '600 pixels and more than {0}MB'.format(
                int(settings.VALIDATOR_MAX_LOGO_SIZE_BYTES / 1024 / 1014)
            )
        ),
        required=False,
        validators=[shared_validators.logo_filesize]
    )


class CompanyEmailAddressForm(IndentedInvalidFieldsMixin, forms.Form):
    company_email = forms.EmailField(
        label='Email address:',
        help_text=(
            'Please enter a company email address rather than personal email '
            'address. This will not replace your username.'
        ),
        validators=[
            shared_validators.email_domain_free,
            shared_validators.email_domain_disposable,
        ]
    )
    email_confirmed = forms.EmailField(
        label='Please confirm your email address:',
    )

    def clean_email_confirmed(self):
        email = self.cleaned_data.get('company_email')
        confirmed = self.cleaned_data.get('email_confirmed')
        if (email and confirmed and email != confirmed):
            raise forms.ValidationError('Your emails do not match')
        return confirmed


class UserForm(IndentedInvalidFieldsMixin, forms.Form):
    mobile_number = forms.CharField(
        label='Mobile number:',
        help_text='We will use this to send you a verification code.',
    )
    mobile_confirmed = forms.CharField(
        label='Mobile number confirmed:'
    )
    terms_agreed = forms.BooleanField(
        label=(
            'Tick this box to accept the terms and conditions of the Great '
            'Trade Index.'
        )
    )
    referrer = forms.CharField(required=False, widget=forms.HiddenInput())

    def clean_mobile_confirmed(self):<commit_msg>Make lables for user details more human friendly<commit_after>import json

from directory_validators import enrolment as shared_validators
from directory_validators.constants import choices

from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe

from enrolment import helpers, validators


class IndentedInvalidFieldsMixin:
    error_css_class = 'input-field-container has-error'


class CompanyForm(IndentedInvalidFieldsMixin, forms.Form):
    company_number = forms.CharField(
        label='Company number:',
        help_text=mark_safe(
            'This is the 8-digit number on the company certificate of '
            'incorporation. Find your company number from '
            '<a href="{url}" target="_blank">Companies House'
            '</a>'.format(url=settings.COMPANIES_HOUSE_SEARCH_URL)
        ),
        validators=helpers.halt_validation_on_failure(
            shared_validators.company_number,
            validators.company_number,
        )
    )


class CompanyNameForm(IndentedInvalidFieldsMixin, forms.Form):
    company_name = forms.CharField(
        label='Company Name:',
        help_text=(
            "Click next if this is your company. If it is not your company "
            "then click back in your browser and re-enter your company's "
            "number."
        ),
        widget=forms.TextInput(attrs={'readonly': 'readonly'}),
    )


class CompanyExportStatusForm(IndentedInvalidFieldsMixin, forms.Form):
    export_status = forms.ChoiceField(
        label=(
            'Has your company sold products or services to overseas customers?'
        ),
        choices=choices.EXPORT_STATUSES,
        validators=[shared_validators.export_status_intention]
    )


class CompanyBasicInfoForm(IndentedInvalidFieldsMixin, forms.Form):
    company_name = forms.CharField(
        help_text=(
            'You can change this from the Companies House listing to '
            'better fit your profile.'
        ),
        max_length=255,
    )
    website = forms.URLField(max_length=255)
    keywords = forms.CharField(
        label='Enter up to 10 keywords that describe your company:',
        help_text=(
            'Keywords should be separated with commas. These keywords will be '
            'used to help potential overseas buyers find your company.'
        ),
        widget=forms.Textarea,
        max_length=1000,
    )


class CompanyDescriptionForm(IndentedInvalidFieldsMixin, forms.Form):
    description = forms.CharField(
        widget=forms.Textarea,
        label='Describe your business to overseas buyers:',
        help_text='Maximum 1,000 characters.',
        max_length=1000,
    )


class CompanyLogoForm(IndentedInvalidFieldsMixin, forms.Form):
    logo = forms.FileField(
        help_text=(
            'For best results this should be a transparent PNG file of 600 x '
            '600 pixels and more than {0}MB'.format(
                int(settings.VALIDATOR_MAX_LOGO_SIZE_BYTES / 1024 / 1014)
            )
        ),
        required=False,
        validators=[shared_validators.logo_filesize]
    )


class CompanyEmailAddressForm(IndentedInvalidFieldsMixin, forms.Form):
    company_email = forms.EmailField(
        label='Email address:',
        help_text=(
            'Please enter a company email address rather than personal email '
            'address. This will not replace your username.'
        ),
        validators=[
            shared_validators.email_domain_free,
            shared_validators.email_domain_disposable,
        ]
    )
    email_confirmed = forms.EmailField(
        label='Please confirm your email address:',
    )

    def clean_email_confirmed(self):
        email = self.cleaned_data.get('company_email')
        confirmed = self.cleaned_data.get('email_confirmed')
        if (email and confirmed and email != confirmed):
            raise forms.ValidationError('Your emails do not match')
        return confirmed


class UserForm(IndentedInvalidFieldsMixin, forms.Form):
    mobile_number = forms.CharField(
        label='Your mobile phone number:',
        help_text='We will use this to send you a verification code.',
    )
    mobile_confirmed = forms.CharField(
        label='Please confirm your mobile phone number:'
    )
    terms_agreed = forms.BooleanField(
        label=mark_safe(
            'Tick this box to accept the '
            '<a href="/terms_and_conditions" target="_blank">terms and '
            'conditions</a> of the Find a Buyer service.'
        )
    )
    referrer = forms.CharField(required=False, widget=forms.HiddenInput())

    def clean_mobile_confirmed(self):
{'fraction_non_alphanumeric': 0.07962580224083542, 'fraction_numerical': 0.007832046122049385, 'mean_word_length': 2.6849699398797595, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1258640', 'n_tokens_mistral': 2513, 'n_tokens_neox': 2407, 'n_words': 654}