def List(validator):
@wraps(List)<EOL>def built(value):<EOL><INDENT>if not hasattr(value, '<STR_LIT>'):<EOL><INDENT>raise Error("<STR_LIT>")<EOL><DEDENT>invalid = Invalid()<EOL>for i, item in enumerate(value):<EOL><INDENT>try:<EOL><INDENT>value[i] = validator(item)<EOL><DEDENT>except Invalid as e:<EOL><INDENT>for error in e:<EOL><INDENT>error.path.insert(<NUM_LIT:0>, i)<EOL>invalid.append(error)<EOL><DEDENT><DEDENT>except Error as e:<EOL><INDENT>e.path.insert(<NUM_LIT:0>, i)<EOL>invalid.append(e)<EOL><DEDENT><DEDENT>if len(invalid):<EOL><INDENT>raise invalid<EOL><DEDENT>return value<EOL><DEDENT>return built<EOL>
Creates a validator that runs the given validator on every item in a list
or other collection. The validator can mutate the values.

Any raised errors will be collected into a single ``Invalid`` error. Their
paths will be replaced with the index of the item. Will raise an error if
the input value is not iterable.