<commit_before># -*- coding: utf-8 -*-
"""Exception classes for marshmallow-related errors."""
import warnings

from marshmallow.compat import basestring

class MarshmallowError(Exception):
    """Base class for all marshmallow-related errors."""
    pass


class ValidationError(MarshmallowError):
    """Raised when validation fails on a field.

    :param message: An error message, list of error messages, or dict of
        error messages.
    :param str field: Field name (or list of field names) to store the error on.
        If `None`, the error is stored in its default location.
    """

    def __init__(self, message, fields=None, field_names=None):
        if not isinstance(message, dict) and not isinstance(message, list):
            messages = [message]
        else:
            messages = message
        self.messages = messages
        self.fields = fields
        self.field_names = field_names
        if isinstance(fields, basestring):
            self.fields = [fields]
        else:  # fields is a list or None
            self.fields = fields
        MarshmallowError.__init__(self, message)


class RegistryError(NameError):
    """Raised when an invalid operation is performed on the serializer
    class registry.<commit_msg>Update docstring and clean up constructor<commit_after># -*- coding: utf-8 -*-
"""Exception classes for marshmallow-related errors."""
import warnings

from marshmallow.compat import basestring

class MarshmallowError(Exception):
    """Base class for all marshmallow-related errors."""
    pass


class ValidationError(MarshmallowError):
    """Raised when validation fails on a field.

    :param message: An error message, list of error messages, or dict of
        error messages.
    :param str fields: `Field` objects to which the error applies.
    :param str field_names: Field names to store the error on.
        If `None`, the error is stored in its default location.
    """

    def __init__(self, message, fields=None, field_names=None):
        if not isinstance(message, dict) and not isinstance(message, list):
            messages = [message]
        else:
            messages = message
        self.messages = messages
        self.field_names = field_names
        if isinstance(fields, basestring):
            self.fields = [fields]
        else:  # fields is a list or None
            self.fields = fields
        MarshmallowError.__init__(self, message)


class RegistryError(NameError):
    """Raised when an invalid operation is performed on the serializer
    class registry.
{'fraction_non_alphanumeric': 0.082421875, 'fraction_numerical': 0.00078125, 'mean_word_length': 2.8685800604229605, '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': '2455453', 'n_tokens_mistral': 671, 'n_tokens_neox': 646, 'n_words': 257}