Unwind `MultipleErrors` to have a plain list of `Invalid`

        :type errors: list[Invalid|MultipleInvalid]
        :rtype: list[Invalid]
336785
def flatten(cls, errors):
        
        ers = []
        for e in errors:
            if isinstance(e, MultipleInvalid):
                ers.extend(cls.flatten(e.errors))
            else:
                ers.append(e)
        return ers
909576
def clean(self, value, initial=None):
        
        if initial is None:
            initial = [None for x in range(0, len(value))]
        else:
            if not isinstance(initial, list):
                initial = self.widget.decompress(initial)

        clean_data = []
        errors = []
        if not value or isinstance(value, (list, tuple)):
            if (not value or not [v for v in value if
                                  v not in self.empty_values]) \
                    and (not initial or not [v for v in initial if
                                             v not in self.empty_values]):
                if self.required:
                    raise ValidationError(self.error_messages['required'],
                                          code='required')
        else:
            raise ValidationError(self.error_messages['invalid'],
                                  code='invalid')
        for i, field in enumerate(self.fields):
            try:
                field_value = value[i]
            except IndexError:
                field_value = None
            try:
                field_initial = initial[i]
            except IndexError:
                field_initial = None

            if field_value in self.empty_values and \
                    field_initial in self.empty_values:
                if self.require_all_fields:
                    # Raise a 'required' error if the MultiValueField is
                    # required and any field is empty.
                    if self.required:
                        raise ValidationError(self.error_messages['required'],
                                              code='required')
                elif field.required:
                    # Otherwise, add an 'incomplete' error to the list of
                    # collected errors and skip field cleaning, if a required
                    # field is empty.
                    if field.error_messages['incomplete'] not in errors:
                        errors.append(field.error_messages['incomplete'])
                    continue
            try:
                clean_data.append(field.clean(field_value, field_initial))
            except ValidationError as e:
                # Collect all validation errors in a single list, which we'll
                # raise at the end of clean(), rather than raising a single
                # exception for the first error we encounter. Skip duplicates.
                errors.extend(m for m in e.error_list if m not in errors)
        if errors:
            raise ValidationError(errors)

        out = self.compress(clean_data)
        self.validate(out)
        self.run_validators(out)
        return out
1334542
def validate(cls, partial=True, **kwargs):
        
        data = kwargs
        if not partial:
            data = dict(**kwargs, **{col.name: None for col in cls.__table__.c
                                     if col.name not in kwargs})

        errors = defaultdict(list)
        for name, value in data.items():
            for validator in cls._get_validators(name):
                try:
                    validator(value)
                except ValidationError as e:
                    e.model = cls
                    e.column = name
                    errors[name].append(str(e))

        if errors:
            raise ValidationErrors(errors)
1337017
def throw_invalid_quad_params(quad, QUADS, nparams):
    
    raise InvalidICError(str(quad),
                         "Invalid quad code params for '%s' (expected %i, but got %i)" %
                         (quad, QUADS[quad][0], nparams)
                         )
953760
function(errors, options) {
      errors = v.pruneEmptyErrors(errors, options);
      errors = v.expandMultipleErrors(errors, options);
      errors = v.convertErrorMessages(errors, options);

      var format = options.format || "grouped";

      if (typeof v.formatters[format] === 'function') {
        errors = v.formatters[format](errors);
      } else {
        throw new Error(v.format("Unknown format %{format}", options));
      }

      return v.isEmpty(errors) ? undefined : errors;
    }
239235
def clean_fails(self):
        
        for item in self.data:
            if item.failure and not item.retries_left > 0:
                return True
        return False
935568
def check_list_errors(self, checkFunc, lst):
        """"""
        # check for errors on each subitem, filter only subitems with errors
        results = (checkFunc(i) for i in lst)
        return [err for err in results if err]
1265839
def validate_items(self, input_list):
        """"""
        output_list = []
        for item in input_list:
            valid = self.list_item_type.validate(item, self.item_name)
            output_list.append(valid)

            # this might lead to confusing error messages.  tbh, we need to
            # figure out a better way to do validation and error handling here,
            # but i'm brute forcing this a bit so that we have something
            # workable
        return output_list
135492
function multipleErrors(errors) {
  var messages = errors.map(function(e) { return e.message; });
  return createError(
      ['Errors:'].concat(messages).join('\n- '),
      errors[0].interval);
}
1159237
def format_errors(self, errors, many):
        """"""
        if not errors:
            return {}
        if isinstance(errors, (list, tuple)):
            return {'errors': errors}

        formatted_errors = []
        if many:
            for index, errors in iteritems(errors):
                for field_name, field_errors in iteritems(errors):
                    formatted_errors.extend([
                        self.format_error(field_name, message, index=index)
                        for message in field_errors
                    ])
        else:
            for field_name, field_errors in iteritems(errors):
                formatted_errors.extend([
                    self.format_error(field_name, message)
                    for message in field_errors
                ])
        return {'errors': formatted_errors}
628647
def filter_errors(errors, select=None, ignore=None, **params):
    
    select = select or []
    ignore = ignore or []

    for e in errors:
        for s in select:
            if e.number.startswith(s):
                yield e
                break
        else:
            for s in ignore:
                if e.number.startswith(s):
                    break
            else:
                yield e
145747
public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) {

		// No error code to filter? => errorCodes is an empty array (not null)
		List<ErrorCode> codesToSkip = new ArrayList<> ();
		codesToSkip.addAll( Arrays.asList( errorCodes ));

		Collection<RoboconfError> toRemove = new ArrayList<> ();
		for( RoboconfError error : errors ) {
			if( codesToSkip.contains( error.getErrorCode()))
				toRemove.add( error );
		}

		errors.removeAll( toRemove );
	}
41476
def _raise_on_error(data):
    """"""
    if isinstance(data, list):
        data = data[0]

    if isinstance(data, dict) and 'error' in data:
        raise_error(data['error'])
940484
def _handle_exclude(self, state, sls, saltenv, errors):
        '''
        
        '''
        if 'exclude' in state:
            exc = state.pop('exclude')
            if not isinstance(exc, list):
                err = ('Exclude Declaration in SLS {0} is not formed '
                       'as a list'.format(sls))
                errors.append(err)
            state.setdefault('__exclude__', []).extend(exc)
1084137
def _validate_allowed(self, allowed_values, field, value):
        
        if isinstance(value, Iterable) and not isinstance(value, _str_type):
            unallowed = set(value) - set(allowed_values)
            if unallowed:
                self._error(field, errors.UNALLOWED_VALUES, list(unallowed))
        else:
            if value not in allowed_values:
                self._error(field, errors.UNALLOWED_VALUE, value)
1111910
def fail(self, reason, obj, pointer=None):
        
        pointer = pointer_join(pointer)
        err = ValidationError(reason, obj, pointer)
        if self.fail_fast:
            raise err
        else:
            self.errors.append(err)
        return err
23264
def validate_list(self, value):
        
        if len(value) > self.max_items:
            raise ValidationError(
                u'list must not contain more than {max_items} items.'.format(max_items=self.max_items)
            )

        if all(isinstance(item, six.string_types) for item in value) is False:
            raise ValidationError(u'list must only contain strings.')

        return value