def array(_object):
    """
    Validates a given input is of type list.

    Example usage::

        data = {'a' : [1,2]}
        schema = ('a', array)

    You can also use this as a decorator, as a way to check for the
    input before it even hits a validator you may be writing.

    .. note::
        If the argument is a callable, the decorating behavior will be
        triggered, otherwise it will act as a normal function.

    """
    if is_callable(_object):
        _validator = _object

        @wraps(_validator)
        def decorated(value):
            ensure(isinstance(value, list), "not of type array")
            return _validator(value)
        return decorated
    ensure(isinstance(_object, list), "not of type array")
def array ( _object ) : if is_callable ( _object ) : _validator = _object @ wraps ( _validator ) def decorated ( value ) : ensure ( isinstance ( value , list ) , "not of type array" ) return _validator ( value ) return decorated ensure ( isinstance ( _object , list ) , "not of type array" )
Validates a given input is of type list.

    Example usage::

        data = {'a' : [1,2]}
        schema = ('a', array)

    You can also use this as a decorator, as a way to check for the
    input before it even hits a validator you may be writing.

    .. note::
        If the argument is a callable, the decorating behavior will be
        triggered, otherwise it will act as a normal function.