<commit_before>import re

from django.core.exceptions import ValidationError
from django.core.validators import validate_ipv4_address, validate_ipv6_address


RE_NAME = re.compile(r'^([\w]{1,2}|[\w][\w-]{0,61}[\w])'
                     r'([.]([\w]{1,2}|[\w][\w-]{0,61}[\w]))*[.]?$')


def validate_parameters(type, parameters):
    parameters_validators = RECORD_TYPES.get(type)
    if parameters is None:
        return parameters
    new_parameters = {}
    for name, validator in parameters_validators.iteritems():
        if name not in parameters:
            raise ValidationError({'parameters': 'Missing type parameter: %r' % name})
        else:
            try:
                validated = validator(parameters[name])
                if validated is not None:
                    new_parameters[name] = validated
                else:
                    new_parameters[name] = parameters[name]
            except ValidationError as err:
                raise ValidationError({'parameters.%s' % name: err.message})
    return new_parameters

<commit_msg>Fixed validate_parameters error re-wrapping<commit_after>import re

from django.core.exceptions import ValidationError
from django.core.validators import validate_ipv4_address, validate_ipv6_address


RE_NAME = re.compile(r'^([\w]{1,2}|[\w][\w-]{0,61}[\w])'
                     r'([.]([\w]{1,2}|[\w][\w-]{0,61}[\w]))*[.]?$')


def validate_parameters(type, parameters):
    parameters_validators = RECORD_TYPES.get(type)
    if parameters is None:
        return parameters
    new_parameters = {}
    for name, validator in parameters_validators.iteritems():
        if name not in parameters:
            raise ValidationError({'parameters': ['Missing type parameter: %r' % name]})
        else:
            try:
                validated = validator(parameters[name])
                if validated is not None:
                    new_parameters[name] = validated
                else:
                    new_parameters[name] = parameters[name]
            except ValidationError as err:
                raise ValidationError({'parameters.%s' % name: err.messages})
    return new_parameters


{'fraction_non_alphanumeric': 0.12262841277186488, 'fraction_numerical': 0.011105969458583989, 'mean_word_length': 2.4814814814814814, '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': '4703913', 'n_tokens_mistral': 634, 'n_tokens_neox': 593, 'n_words': 137}