Validates that the input can be converted to a list of decimals.
492016
def clean(self, value):
        """"""
        if not value:
            return None

        # if any value exists, then add "0" as a placeholder to the remaining
        # values.
        if isinstance(value, list) and any(value):
            for i, item in enumerate(value):
                if not item:
                    value[i] = '0'

        return super(MultipleDecimalField, self).clean(value)
1056241
def validate(self, value):
        """"""
        if self.type is not None:
            value = coerce(self.type, value)

        if self.min is not None and value < self.min:
            raise ValueError('%s=%s is less than %s' % (self.name, value,
                                                        self.min))
        if self.max is not None and value > self.max:
            raise ValueError('%s=%s is greater than %s' % (
                self.name, value, self.max))
        if self.allowed is not None and value not in self.allowed:
            raise ValueError('%s=%s is not one of the allowed values: %s' % (
                self.name, value, ','.join(map(str, self.allowed))))

        return value
934128
function validate ( inputOptions ) {

		var i, optionName, optionValue,
			filteredOptions = {};

		for ( i = 0; i < FormatOptions.length; i+=1 ) {

			optionName = FormatOptions[i];
			optionValue = inputOptions[optionName];

			if ( optionValue === undefined ) {

				// Only default if negativeBefore isn't set.
				if ( optionName === 'negative' && !filteredOptions.negativeBefore ) {
					filteredOptions[optionName] = '-';
				// Don't set a default for mark when 'thousand' is set.
				} else if ( optionName === 'mark' && filteredOptions.thousand !== '.' ) {
					filteredOptions[optionName] = '.';
				} else {
					filteredOptions[optionName] = false;
				}

			// Floating points in JS are stable up to 7 decimals.
			} else if ( optionName === 'decimals' ) {
				if ( optionValue >= 0 && optionValue < 8 ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}

			// These options, when provided, must be functions.
			} else if ( optionName === 'encoder' || optionName === 'decoder' || optionName === 'edit' || optionName === 'undo' ) {
				if ( typeof optionValue === 'function' ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}

			// Other options are strings.
			} else {

				if ( typeof optionValue === 'string' ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}
			}
		}

		// Some values can't be extracted from a
		// string if certain combinations are present.
		throwEqualError(filteredOptions, 'mark', 'thousand');
		throwEqualError(filteredOptions, 'prefix', 'negative');
		throwEqualError(filteredOptions, 'prefix', 'negativeBefore');

		return filteredOptions;
	}
1289076
def validate(input)
      (check_exists(required_inputs, input) &&
        check_format(input_formats, input)) || 
      (raise Errors::InvalidInput, "Invalid input for #{self.class.name}")
    end
514217
def validate_float(cls, value):
        
        if not isinstance(value, (int, float)):
            raise TypeError(
                "value must be a number, got %s" % type(value)
            )
866754
private void getNumerics(String input, UnicodeSet result) {
        result.clear();

        for (int utf16Offset = 0; utf16Offset < input.length();) {
            int codePoint = Character.codePointAt(input, utf16Offset);
            utf16Offset += Character.charCount(codePoint);

            // Store a representative character for each kind of decimal digit
            if (UCharacter.getType(codePoint) == UCharacterCategory.DECIMAL_DIGIT_NUMBER) {
                // Store the zero character as a representative for comparison.
                // Unicode guarantees it is codePoint - value
                result.add(codePoint - UCharacter.getNumericValue(codePoint));
            }
        }
    }
834124
def validate_multiple_of(value, divisor, **kwargs):
    
    if not decimal.Decimal(str(value)) % decimal.Decimal(str(divisor)) == 0:
        raise ValidationError(
            MESSAGES['multiple_of']['invalid'].format(divisor, value),
        )
1236688
def is_valid_input_array(x, ndim=None):
    """"""
    x = np.asarray(x)

    if ndim is None or ndim == 1:
        return x.ndim == 1 and x.size > 1 or x.ndim == 2 and x.shape[0] == 1
    else:
        return x.ndim == 2 and x.shape[0] == ndim
1063853
public static BigDecimal validate(BigDecimal zahl, CurrencyUnit currency) {
        if (zahl.scale() == 0) {
            return zahl.setScale(currency.getDefaultFractionDigits(), RoundingMode.HALF_UP);
        }
        return zahl;
    }
584973
def validate_digit(value, start, end):
    ''''''
    if not str(value).isdigit() or int(value) < start or int(value) > end:
        raise ValueError('%s must be a digit from %s to %s' % (value, start, end))
93208
def validate(self, value):
        
        try:
            # trap blank fields here
            if value:
                v = float(value)
                if (v != 0 and v < self.fmin) or v > self.fmax:
                    return None
                if abs(round(100000*v)-100000*v) > 1.e-12:
                    return None
            return value
        except ValueError:
            return None
314681
static final void validateValues(final float[] values) {
    for (int i = 0; i < values.length ; i++) {
      if (Float.isNaN(values[i])) {
        throw new SketchesArgumentException("Values must not be NaN");
      }
      if ((i < (values.length - 1)) && (values[i] >= values[i + 1])) {
        throw new SketchesArgumentException(
          "Values must be unique and monotonically increasing");
      }
    }
  }
758071
def validate_SUMTO(in_value, restriction):
    
    #Sometimes restriction values can accidentally be put in the template <item>100</items>,
    #Making them a list, not a number. Rather than blowing up, just get value 1 from the list.
    if type(restriction) is list:
        restriction = restriction[0]

    value = _get_val(in_value, full=True)

    if len(value) == 0:
        return

    flat_list = _flatten_value(value)

    try:
        sum(flat_list)
    except:
        raise ValidationError("List cannot be summed: %s"%(flat_list,))

    if sum(flat_list) != restriction:
        raise ValidationError("SUMTO: %s"%(restriction))
1104417
def validate_bool(b):
    """"""
    if isinstance(b, six.string_types):
        b = b.lower()
    if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
        return True
    elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False):
        return False
    else:
        raise ValueError('Could not convert "%s" to boolean' % b)
1258390
def validate_options(self, k, v):
        """"""

        super().validate_options(k, v)
        if k == 'delimiters':
            for d in v:
                if not isinstance(d, (dict, OrderedDict)):
                    raise ValueError("{}: 'delimters' entries must be of dict type.".format(self.__class__.__name__))
                for key, value in d.items():
                    if key not in ('open', 'close', 'content'):
                        raise KeyError(
                            "{}: '{}' is not a valid key for a 'delimeters' entry.".format(self.__class__.__name__, key)
                        )
                    if not isinstance(value, str):
                        raise ValueError(
                            "{}: 'delimeters' '{}' key should have str values.".format(self.__class__.__name__, value)
                        )
586311
def _validated(self, value):
        """"""
        if value is None:
            return None
        try:
            return self._format_num(value)
        except (TypeError, ValueError):
            self.fail('invalid', input=value)
        except OverflowError:
            self.fail('too_large', input=value)
1324278
def converts_values(self):
        """"""
        return self.convert_value is not Formatter.convert_value or \
               self.convert_column is not Formatter.convert_column