Validate an object against the __validates__ class variable.
        Returns True if valid, and False if any validations fail. If passed
        (as a dict), +attrs+ will be populated with the invalid attributes.
420185
def is_valid(self, attrs = None):
        
        if attrs is None:
            reason = {}
        else:
            reason = attrs
        valid = True
        for attr, validation in self.__class__.__validates__.items():
            if validation.__class__ == validators.validation:
                validation.name = attr
            if not validation(self):
                reason[attr] = getattr(self, attr)
                valid = False
        return valid
913527
def _validate(self,val):
        """"""
        if isinstance(self.class_, tuple):
            class_name = ('(%s)' % ', '.join(cl.__name__ for cl in self.class_))
        else:
            class_name = self.class_.__name__
        if self.is_instance:
            if not (isinstance(val,self.class_)) and not (val is None and self.allow_None):
                raise ValueError(
                    "Parameter '%s' value must be an instance of %s, not '%s'" %
                    (self.name, class_name, val))
        else:
            if not (val is None and self.allow_None) and not (issubclass(val,self.class_)):
                raise ValueError(
                    "Parameter '%s' must be a subclass of %s, not '%s'" %
                    (val.__name__, class_name, val.__class__.__name__))
385831
def validate(inst):
    
    if _config._run_validators is False:
        return

    for a in fields(inst.__class__):
        v = a.validator
        if v is not None:
            v(inst, a, getattr(inst, a.name))
698155
def validate(self, value):
        
        if value is None:
            return
        if len(self.classes) and not isinstance(value, self.classes):
            msg = '"%s" must be: %s' % (self.name, self.classes)
            raise AttributeError(msg)
1065178
def __validate(data, classes, labels):
        ""

        if not isinstance(data, dict):
            raise TypeError(
                'data must be a dict! keys: sample ID or any unique identifier')
        if not isinstance(labels, dict):
            raise TypeError(
                'labels must be a dict! keys: sample ID or any unique identifier')
        if classes is not None:
            if not isinstance(classes, dict):
                raise TypeError(
                    'labels must be a dict! keys: sample ID or any unique identifier')

        if not len(data) == len(labels) == len(classes):
            raise ValueError('Lengths of data, labels and classes do not match!')
        if not set(list(data)) == set(list(labels)) == set(list(classes)):
            raise ValueError(
                'data, classes and labels dictionaries must have the same keys!')

        num_features_in_elements = np.unique([sample.size for sample in data.values()])
        if len(num_features_in_elements) > 1:
            raise ValueError(
                'different samples have different number of features - invalid!')

        return True
16524
def validate(self, value, attribute_filter=None, minified=False):
        

        if not self._required and value is None:
            return None
        elif self._required and value is None:
            raise exception.RequiredAttributeError()

        _validated_value = self.__class__(
            element_template=self._element_template,
            min_length=self._min_length,
            max_length=self._max_length
        )

        if not isinstance(value, (list, tuple)):
            raise TypeError(value)

        for array_element in value:

            if isinstance(self._element_template, DataCollection):
                validated_array_element = self._element_template.validate(array_element, attribute_filter, minified)
            else:
                validated_array_element = self._element_template.validate(array_element)

            _validated_value.append(validated_array_element)

        if self._min_length is not None and len(_validated_value) < self._min_length:
            raise exception.LessThanMinimumError(value, self._min_length)

        if self._max_length is not None and len(_validated_value) > self._max_length:
            raise exception.MoreThanMaximumError(value, self._max_length)

        return _validated_value
532486
def check_valid(self):
		
		for k,input in self.inputs.items():
			if k in self.valid_opts:
				for param in self.valid_opts[k]:
					if param is None or input is None:
						return True
					elif type(param) is str and '+' in param:
						if re.search(r'^'+param,str(input)):
							return True
					elif type(param) is bool and type(input) is bool:
						return True
					elif type(param) is list and type(input) is list:
						return True
					else:
						if str(input).lower() == str(param):
							return True
				raise ValueError("Invalid input for '%s' parameter. Options are: %s" % (k,' '.join(["'%s'," % str(o) for o in self.valid_opts[k]]) ))
			else:
				raise ValueError("Invalid parameter for '%s'. Params are: %s" % (self.__class__.__name__,', '.join(["'%s'" % p for p in self.valid_opts.keys()]) ))
705723
def validate(self):
        
        validation_result = []
        for attr_name, value in [(attr, getattr(self, attr)) for attr in self._attribute_map]:
            attr_desc = self._attribute_map[attr_name]
            if attr_name == "additional_properties" and attr_desc["key"] == '':
                # Do NOT validate additional_properties
                continue
            attr_type = attr_desc['type']

            try:
                debug_name = "{}.{}".format(self.__class__.__name__, attr_name)
                Serializer.validate(value, debug_name, **self._validation.get(attr_name, {}))
            except ValidationError as validation_error:
                validation_result.append(validation_error)

            validation_result += _recursive_validate(attr_name, attr_type, value)
        return validation_result
587367
def validate (properties):
    
    if isinstance(properties, Property):
        properties = [properties]
    assert is_iterable_typed(properties, Property)
    for p in properties:
        __validate1(p)
1059004
def _validate(self, obj):
        
        report = ValidationReport()
        if not self.validator.is_valid(obj):
            for v in self.validator.iter_errors(obj):
                report.add_error("[%s] %s" % ('.'.join(str(vv) for vv in v.path), v.message))
        return report
50235
def validate(self):
        
        # it is important to have the validator applied in a fixed order
        valids = [getattr(self, valid)
                  for valid in sorted(dir(self.__class__))
                  if valid.startswith('is_valid_')]
        for is_valid in valids:
            if not is_valid():
                docstring = '\n'.join(
                    line.strip() for line in is_valid.__doc__.splitlines())
                doc = docstring.format(**vars(self))
                raise ValueError(doc)
1352059
def valid(input)
      return true unless @validation
      _, method = VALIDATIONS.find { |klass, _| @validation.is_a? klass }
      return @validation.send(method, input) if method
      raise "Supported validation type not provided #{@validation.class}"
    end
1263892
def validate(self, *args):
        
        super(self.__class__, self).validate(*args)
        if not self.name:
            raise ValidationError('name is required for Data')
767966
def validate(self, value):
        
        # check object type
        if not isinstance(value, list):
            raise tldap.exceptions.ValidationError(
                "is not a list and max_instances is %s" %
                self._max_instances)
        # check maximum instances
        if (self._max_instances is not None and
                len(value) > self._max_instances):
            raise tldap.exceptions.ValidationError(
                "exceeds max_instances of %d" %
                self._max_instances)
        # check this required value is given
        if self._required:
            if len(value) == 0:
                raise tldap.exceptions.ValidationError(
                    "is required")
        # validate the value
        for i, v in enumerate(value):
            self.value_validate(v)
853800
def validate(self):
        
        if getattr(self, '_getting_validated', False):
            return True
        self._getting_validated = True
        self._validation_error_tuples = []
        self._non_validation_error = None
        try:
            for val in itervalues(self._class_validators):
                try:
                    if isinstance(val.func, string_types):
                        valid = getattr(self, val.func)()
                    else:
                        valid = val.func(self)
                    if valid is False:
                        raise utils.ValidationError(
                            'Validation failed', None, None, self
                        )
                except utils.ValidationError as val_err:
                    self._validation_error_tuples += val_err.error_tuples
                except GENERIC_ERRORS as err:
                    if not self._non_validation_error:
                        self._non_validation_error = err
            if self._validation_error_tuples:
                self._error_hook(self._validation_error_tuples)
                msgs = ['Validation failed:']
                msgs += [val.message for val in self._validation_error_tuples]
                raise utils.ValidationError(
                    message='\n- '.join(msgs),
                    _error_tuples=self._validation_error_tuples,
                )
            if self._non_validation_error:
                raise self._non_validation_error                               #pylint: disable=raising-bad-type
            return True
        finally:
            self._getting_validated = False
            self._validation_error_tuples = None
            self._non_validation_error = None
373287
def validate(self, obj, pointer=None):
        

        pointer = pointer or '#'

        validator = deepcopy(self)
        validator.errors = []
        validator.fail_fast = False

        obj = deepcopy(obj)
        obj = validator.validate_enum(obj, pointer)
        obj = validator.validate_type(obj, pointer)
        obj = validator.validate_not(obj, pointer)
        obj = validator.validate_all_of(obj, pointer)
        obj = validator.validate_any_of(obj, pointer)
        obj = validator.validate_one_of(obj, pointer)

        if self.is_array(obj):
            obj = validator.validate_items(obj, pointer)
            obj = validator.validate_max_items(obj, pointer)
            obj = validator.validate_min_items(obj, pointer)
            obj = validator.validate_unique_items(obj, pointer)
        elif self.is_number(obj):
            obj = validator.validate_maximum(obj, pointer)
            obj = validator.validate_minimum(obj, pointer)
            obj = validator.validate_multiple_of(obj, pointer)
        elif self.is_object(obj):
            obj = validator.validate_required(obj, pointer)
            obj = validator.validate_max_properties(obj, pointer)
            obj = validator.validate_min_properties(obj, pointer)
            obj = validator.validate_dependencies(obj, pointer)
            obj = validator.validate_properties(obj, pointer)
            obj = validator.validate_default_properties(obj, pointer)
        elif self.is_string(obj):
            obj = validator.validate_max_length(obj, pointer)
            obj = validator.validate_min_length(obj, pointer)
            obj = validator.validate_pattern(obj, pointer)
            obj = validator.validate_format(obj, pointer)

        if validator.errors:
            raise ValidationError('multiple errors',
                                  obj,
                                  errors=validator.errors)

        return obj
1289076
def validate(input)
      (check_exists(required_inputs, input) &&
        check_format(input_formats, input)) || 
      (raise Errors::InvalidInput, "Invalid input for #{self.class.name}")
    end