Validate that if max is set, the data type is text or blob
161055
private void validateMax() {

		if (max != null) {
			if (dataType == null) {
				throw new GeoPackageException(
						"Column max is only supported for data typed columns. column: "
								+ name + ", max: " + max);
			} else if (dataType != GeoPackageDataType.TEXT
					&& dataType != GeoPackageDataType.BLOB) {
				throw new GeoPackageException(
						"Column max is only supported for "
								+ GeoPackageDataType.TEXT.name() + " and "
								+ GeoPackageDataType.BLOB.name()
								+ " columns. column: " + name + ", max: " + max
								+ ", type: " + dataType.name());
			}
		}

	}
1227217
def validate_wrap(self, value):
        ''' '''
        if (not isinstance(value, ObjectId)
                and not isinstance(value, basestring)
                and not isinstance(value, bytes)
            ):
            self._fail_validation_type(value, ObjectId)
        if isinstance(value, ObjectId):
            return
        #: bytes
        if len(value) == 12:
            return
        # hex
        if len(value) != 24:
            self._fail_validation(value, 'hex object ID is the wrong length')
833087
function validateFloatHTTPInput( $data, $contentObjectAttribute, $classAttribute )
    {
        $min = $classAttribute->attribute( self::MIN_FIELD );
        $max = $classAttribute->attribute( self::MAX_FIELD );
        $inputState = $classAttribute->attribute( self::INPUT_STATE_FIELD );
        switch( $inputState )
        {
            case self::NO_MIN_MAX_VALUE:
                $state = $this->FloatValidator->validate( $data );
                if ( $state === eZInputValidator::STATE_ACCEPTED )
                {
                    return eZInputValidator::STATE_ACCEPTED;
                }
                else
                {
                    $contentObjectAttribute->setValidationError(
                        ezpI18n::tr(
                            'kernel/classes/datatypes',
                            'The given input is not a floating point number.'
                        )
                    );
                }
                break;
            case self::HAS_MIN_VALUE:
                $this->FloatValidator->setRange( $min, false );
                $state = $this->FloatValidator->validate( $data );
                if ( $state === eZInputValidator::STATE_ACCEPTED )
                {
                    return eZInputValidator::STATE_ACCEPTED;
                }
                else
                {
                    $contentObjectAttribute->setValidationError(
                        ezpI18n::tr(
                            'kernel/classes/datatypes',
                            'The input must be greater than %1'
                        ),
                        $min
                    );
                }
                break;
            case self::HAS_MAX_VALUE:
                $this->FloatValidator->setRange( false, $max );
                $state = $this->FloatValidator->validate( $data );
                if ( $state === eZInputValidator::STATE_ACCEPTED )
                {
                    return eZInputValidator::STATE_ACCEPTED;
                }
                else
                {
                    $contentObjectAttribute->setValidationError(
                        ezpI18n::tr(
                            'kernel/classes/datatypes',
                            'The input must be less than %1'
                        ),
                        $max
                    );
                }
                break;
            case self::HAS_MIN_MAX_VALUE:
                $this->FloatValidator->setRange( $min, $max );
                $state = $this->FloatValidator->validate( $data );
                if ( $state === eZInputValidator::STATE_ACCEPTED )
                {
                    return eZInputValidator::STATE_ACCEPTED;
                }
                else
                {
                    $contentObjectAttribute->setValidationError(
                        ezpI18n::tr(
                            'kernel/classes/datatypes',
                            'The input is not in defined range %1 - %2'
                        ),
                        $min, $max
                    );
                }
                break;
        }
        return eZInputValidator::STATE_INVALID;
    }
305692
def _validate(data_type, parent_path):
    """"""
    if isinstance(data_type, _CLASS_TYPES):
        raise TypeError(
            "The data type is expected to be an instance object, but got the "
            "type '%s' instead." % (_format_type(data_type),))

    base = _find_base_type(data_type)
    if not base:
        raise TypeError(
            "Objects of type '%s' aren't supported as data types. Use any "
            "type from %s instead."
            % (_format_type(type(data_type)), _join_types(_ALL, "or ")))

    name = getattr(data_type, 'name', None)
    if not name:
        name = type(data_type).__name__

    full_path = '%s.%s' % (parent_path, name) if parent_path else name

    # Generic checks for each attribute.
    for check in _TYPE_ATTR_CHECKS[base]:
        attribute = getattr(data_type, check.name)
        if attribute is None:
            if check.allow_none:
                continue
            else:
                raise TypeError("The attribute '%s.%s' cannot be 'None'."
                                % (full_path, check.name))

        if isinstance(check, _FieldInstanceCheck):
            check_function = isinstance
        elif isinstance(check, _FieldSubclassCheck):
            if not isinstance(attribute, _CLASS_TYPES):
                raise TypeError(
                    "The attribute '%s.%s' is expected to be a type "
                    "object%s." % (full_path, check.name,
                                   " or 'None'" if check.allow_none else ''))

            check_function = issubclass

        if not check_function(attribute, check.type):
            if isinstance(check, _FieldInstanceCheck):
                glue_1 = "an instance object of type"
                glue_2 = "not"
                glue_3 = ""
                type_name = _format_type(type(attribute))
            elif isinstance(check, _FieldSubclassCheck):
                glue_1 = "a subclass of"
                glue_2 = "but got"
                glue_3 = " instead"
                type_name = _format_type(attribute)

            raise TypeError(
                "The attribute '%s.%s' is expected to be %s %s, %s '%s'%s."
                % (full_path, check.name, glue_1,
                   _join_types(check.type, "or "), glue_2, type_name, glue_3))

    # Additional and/or recursive checks for specific attributes.
    if isinstance(data_type, Array):
        _validate(data_type.element_type, full_path)
    elif isinstance(data_type, Structure):
        for field in data_type.fields:
            if not isinstance(field, _SEQUENCE_TYPES):
                raise TypeError(
                    "Each field from the attribute '%s.fields' is expected "
                    "to be an instance object of type %s, not '%s'."
                    % (full_path,
                       _join_types(_SEQUENCE_TYPES + (Field,), "or "),
                       _format_type(type(field))))

            if len(field) not in _FIELD_REQUIRED_ARG_RANGE:
                raise TypeError(
                    "Each field from the attribute '%s.fields' is expected "
                    "to be an instance object of type %s, and compatible with "
                    "the '%s' structure, but got %r instead."
                    % (full_path,
                       _join_types(_SEQUENCE_TYPES + (Field,), "or "),
                       _format_type(Field), field))

            field = Field(*field)
            if not isinstance(field.name, _STRING_TYPES):
                raise TypeError(
                    "The first element of each field from the attribute "
                    "'%s.fields', that is the 'name' attribute, is expected "
                    "to be an instance object of type %s, not '%s'."
                    % (full_path, _join_types(_STRING_TYPES, "or "),
                       _format_type(type(field.name))))

            if not isinstance(field.type, _ALL):
                raise TypeError(
                    "The second element of each field from the attribute "
                    "'%s.fields', that is the 'type' attribute, is expected "
                    "to be an instance object of type %s, not '%s'."
                    % (full_path, _join_types(_ALL, "or "),
                       _format_type(type(field.type))))

            if not isinstance(field.read_only, bool):
                raise TypeError(
                    "The third element of each field from the attribute "
                    "'%s.fields', that is the 'read_only' attribute, is "
                    "expected to be an instance object of type 'bool', "
                    "not '%s'." % (full_path,
                                   _format_type(type(field.read_only))))

            field_path = '%s.%s' % (full_path, field.name)
            _validate(field.type, field_path)

        fields = [field[_FIELD_NAME_IDX] for field in data_type.fields]
        duplicates = _find_duplicates(fields)
        if duplicates:
            if len(duplicates) > 1:
                raise ValueError(
                    "The structure fields %s, were provided multiple times."
                    % (_join_sequence(duplicates, "and ")),)
            else:
                raise ValueError(
                    "The structure field '%s' was provided multiple times."
                    % (duplicates[0]),)

    return True
1068439
def validate(data):
    
    if not isinstance(data, dict):
        error('Data must be a dictionary.')
    for value in data.values():
        if not isinstance(value, basestring):
            error('Values must be strings.')
198262
def is_valid(self, qstr=None):
        """"""
        if qstr is None:
            qstr = self.currentText()
        return osp.isfile(to_text_string(qstr))
477998
def validate_range_values(request, label, kwargs):
    """"""
    value = kwargs.get(label, request.query.get(label))
    if value:
        kwargs[label] = int(value)
        if kwargs[label] < 0 or kwargs[label] > MAX_PAGE_SIZE:
            raise ValueError
5531
function validateMaxFileSize(pluginDir) {
  return (maxBytes, filePath) => {
    try {
      const stat = fs.statSync(path.join(pluginDir, filePath));
      return stat.size <= maxBytes;
    } catch (e) {
      return false;
    }
  };
}
1144370
def validate(self, val):
        """"""
        if self.validation:
            self.type.validate(val)

            if self.custom_validator is not None:
                self.custom_validator(val)

        return True
1201983
def _validate_range(self, max_, min_, max_ex, min_ex, value, path, prefix):
        
        if not isinstance(value, int) and not isinstance(value, float):
            raise CoreError("Value must be a integer type")

        log.debug(
            u"Validate range : %s : %s : %s : %s : %s : %s",
            max_,
            min_,
            max_ex,
            min_ex,
            value,
            path,
        )

        if max_ is not None and max_ < value:
                self.errors.append(SchemaError.SchemaErrorEntry(
                    msg=u"Type '{prefix}' has size of '{value}', greater than max limit '{max_}'. Path: '{path}'",
                    path=path,
                    value=nativestr(value) if tt['str'](value) else value,
                    prefix=prefix,
                    max_=max_))

        if min_ is not None and min_ > value:
                self.errors.append(SchemaError.SchemaErrorEntry(
                    msg=u"Type '{prefix}' has size of '{value}', less than min limit '{min_}'. Path: '{path}'",
                    path=path,
                    value=nativestr(value) if tt['str'](value) else value,
                    prefix=prefix,
                    min_=min_))

        if max_ex is not None and max_ex <= value:
                self.errors.append(SchemaError.SchemaErrorEntry(
                    msg=u"Type '{prefix}' has size of '{value}', greater than or equals to max limit(exclusive) '{max_ex}'. Path: '{path}'",
                    path=path,
                    value=nativestr(value) if tt['str'](value) else value,
                    prefix=prefix,
                    max_ex=max_ex))

        if min_ex is not None and min_ex >= value:
                self.errors.append(SchemaError.SchemaErrorEntry(
                    msg=u"Type '{prefix}' has size of '{value}', less than or equals to min limit(exclusive) '{min_ex}'. Path: '{path}'",
                    path=path,
                    value=nativestr(value) if tt['str'](value) else value,
                    prefix=prefix,
                    min_ex=min_ex))
886709
def _validate_maxlength(self, max_length, field, value):
        
        if isinstance(value, Iterable) and len(value) > max_length:
            self._error(field, errors.MAX_LENGTH, len(value))
679134
def validatePushCData(self, data, len):
        
        ret = libxml2mod.xmlValidatePushCData(self._o, data, len)
        return ret
642688
def _validated(self, value):
        """"""
        if value is None:
            return None
        if isinstance(value, uuid.UUID):
            return value
        try:
            if isinstance(value, bytes) and len(value) == 16:
                return uuid.UUID(bytes=value)
            else:
                return uuid.UUID(value)
        except (ValueError, AttributeError, TypeError):
            self.fail('invalid_uuid')
347445
def validate_wrap(self, value, *types):
        '''  '''
        for type in types:
            if isinstance(value, type):
                break
        else:
            self._fail_validation_type(value, *types)

        if self.min is not None and value < self.min:
            self._fail_validation(value, 'Value too small')
        if self.max is not None and value > self.max:
            self._fail_validation(value, 'Value too large')
1011941
def _isvalid(self, datatype):
        ''''''
        if datatype in self.meta:
            return bool(Dap._meta_valid[datatype].match(self.meta[datatype]))
        else:
            return datatype in Dap._optional_meta
819673
def validate(self, data):
        '''
        
        '''
        for prop in self.properties:
            if prop.id in data:
                if prop.type == 'string':
                    if not isinstance(data[prop.id], basestring):
                        raise PresetFieldTypeException("property '{}' must be of type string".format(prop.id))
                elif prop.type == 'enum':
                    if not isinstance(data[prop.id], basestring):
                        raise PresetFieldTypeException("property '{}' must be of type string".format(prop.id))
                    if data[prop.id] not in prop.values:
                        raise PresetException("property '{}' can be one of {}".format(prop.id, prop.values))
            else:
                if prop.required:
                    raise PresetMissingFieldException("missing required property: '{}'".format(prop.id))
133633
def validate(self, instance, value):
        """"""
        if not isinstance(value, (tuple, list, np.ndarray)):
            self.error(instance, value)
        if self.coerce:
            value = self.wrapper(value)
        valid_class = (
            self.wrapper if isinstance(self.wrapper, type) else np.ndarray
        )
        if not isinstance(value, valid_class):
            self.error(instance, value)
        allowed_kinds = ''.join(TYPE_MAPPINGS[typ] for typ in self.dtype)
        if value.dtype.kind not in allowed_kinds:
            self.error(instance, value, extra='Invalid dtype.')
        if self.shape is None:
            return value
        for shape in self.shape:
            if len(shape) != value.ndim:
                continue
            for i, shp in enumerate(shape):
                if shp not in ('*', value.shape[i]):
                    break
            else:
                return value
        self.error(instance, value, extra='Invalid shape.')