# Path: src/formencode/api.py
# def get_localedir():
# def set_stdtranslation(domain="FormEncode", languages=None,
#                        localedir=get_localedir()):
# def deprecation_warning(old, new=None, stacklevel=3):
# def deprecated(old=None, new=None):
#     def outer(func):
#         def inner(*args, **kwargs):
# def is_empty(value):
# def is_validator(obj):
#     def __init__(self, msg,
#                  value, state, error_list=None, error_dict=None):
#     def __str__(self):
#         def __unicode__(self):
#     def unpack_errors(self, encode_variables=False, dict_char='.',
#                       list_char='-'):
#     def __classinit__(cls, new_attrs):
#     def __init__(self, *args, **kw):
#     def to_python(self, value, state=None):
#     def from_python(self, value, state=None):
#         def _message_vars_decode(self, message_vars):
#     def message(self, msgName, state, **kw):
#     def all_messages(self):
#     def subvalidators(self):
#     def _initialize_docstring(cls):
#     def __repr__(self):
#     def __classinit__(cls, new_attrs):
#     def to_python(self, value, state=None):
#     def from_python(self, value, state=None):
#     def is_empty(self, value):
#     def empty_value(self, value):
#     def assert_string(self, value, state):
#     def base64encode(self, value):
#     def _validate_noop(self, value, state=None):
# class NoDefault(object):
# class Invalid(Exception):
# class Validator(declarative.Declarative):
# class _Identity(Validator):
# class FancyValidator(Validator):


from .api import (FancyValidator, Identity, Invalid, NoDefault, Validator,
    is_validator)
import six
                value = validate(validator, value, state)
        except Invalid:
            if self.if_invalid is NoDefault:
                raise
            return self.if_invalid
        return value

    def with_validator(self, validator):
        """Add another validator.

        Adds the validator (or list of validators) to a copy of
        this validator.
        """
        new = self.validators[:]
        if isinstance(validator, (list, tuple)):
            new.extend(validator)
        else:
            new.append(validator)
        return self.__class__(*new, **dict(if_invalid=self.if_invalid))

    @classmethod
    def join(cls, *validators):
        """Join the specified validators.

        Joins several validators together as a single validator,
        filtering out None and trying to keep `All` validators from
        being nested (which isn't needed).
        """
        validators = [v for v in validators if v and v is not Identity]
        if not validators:

# Path: src/formencode/api.py
# def get_localedir():
# def set_stdtranslation(domain="FormEncode", languages=None,
#                        localedir=get_localedir()):
# def deprecation_warning(old, new=None, stacklevel=3):
# def deprecated(old=None, new=None):
#     def outer(func):
#         def inner(*args, **kwargs):
# def is_empty(value):
# def is_validator(obj):
#     def __init__(self, msg,
#                  value, state, error_list=None, error_dict=None):
#     def __str__(self):
#         def __unicode__(self):
#     def unpack_errors(self, encode_variables=False, dict_char='.',
#                       list_char='-'):
#     def __classinit__(cls, new_attrs):
#     def __init__(self, *args, **kw):
#     def to_python(self, value, state=None):
#     def from_python(self, value, state=None):
#         def _message_vars_decode(self, message_vars):
#     def message(self, msgName, state, **kw):
#     def all_messages(self):
#     def subvalidators(self):
#     def _initialize_docstring(cls):
#     def __repr__(self):
#     def __classinit__(cls, new_attrs):
#     def to_python(self, value, state=None):
#     def from_python(self, value, state=None):
#     def is_empty(self, value):
#     def empty_value(self, value):
#     def assert_string(self, value, state):
#     def base64encode(self, value):
#     def _validate_noop(self, value, state=None):
# class NoDefault(object):
# class Invalid(Exception):
# class Validator(declarative.Declarative):
# class _Identity(Validator):
# class FancyValidator(Validator):


# Path: src/formencode/compound.py
from .api import (FancyValidator, Identity, Invalid, NoDefault, Validator,
    is_validator)
import six

                value = validate(validator, value, state)
        except Invalid:
            if self.if_invalid is NoDefault:
                raise
            return self.if_invalid
        return value

    def with_validator(self, validator):
        """Add another validator.

        Adds the validator (or list of validators) to a copy of
        this validator.
        """
        new = self.validators[:]
        if isinstance(validator, (list, tuple)):
            new.extend(validator)
        else:
            new.append(validator)
        return self.__class__(*new, **dict(if_invalid=self.if_invalid))

    @classmethod
    def join(cls, *validators):
        """Join the specified validators.

        Joins several validators together as a single validator,
        filtering out None and trying to keep `All` validators from
        being nested (which isn't needed).
        """
        validators = [v for v in validators if v and v is not Identity]
        if not validators:

            return Identity