Validates a data dict against this schema.

        Args:
            data (dict): The data to be validated.

        Raises:
            ValidationError: If the data is invalid.
547546
def validate(self, data):
        '''
        '''
        try:
            self._validator.validate(data)
        except jsonschema.ValidationError as e:
            six.raise_from(ValidationError.create_from(e), e)
412968
def _validate(self, data: Any, schema: AnyMapping) -> Any:
        
        try:
            return self.validate_func(schema, self._pure_data(data))
        except self.validation_error_class as err:
            logger.error(
                'Schema validation error',
                exc_info=True,
                extra={'schema': schema, 'schema_module': self.module})
            if self.error_class is None:
                raise
            raise self.make_error('Validation Error', error=err) from err
148705
def validate(data)
      JSON::Validator.validate!(self, data)
    rescue JSON::Schema::ValidationError => e
      raise DataPackage::ValidationError.new(e.message)
    end
73830
def set_data(self, data):
        
        # Make sure a dict got passed it
        if not isinstance(data, type({})):
            raise TypeError("This attribute must be a dictionary.")
        # Set the attribute
        self.__dict__['data'] = DocumentDataDict(data)
485038
def validate(self, data):
        
        if 'start' in data and 'end' in data and data['start'] >= data['end']:
            raise serializers.ValidationError(_('End must occur after start.'))
        return data
418059
def validate(self, raw_data, **kwargs):
        
        try:
            converted_data = int(raw_data)
            return super(IntegerField, self).validate(converted_data)
        except ValueError:
            raise ValidationException(self.messages['invalid'], repr(raw_data))
55991
def validate(self, data, all_data=None):
        '''
        
        '''
        if data is None:
            return True, False
        else:
            return super(BooleanField, self).validate(data, all_data)
465460
def loads(data, validate=False, **kwargs):
    
    d = json.loads(data, **kwargs)
    content_spec = d["content-spec"]
    Payload = CONTENT_SPECS[content_spec]
    payload = Payload.load(d)
    if validate:
        errors = payload.problems()
        if errors:
            raise ValidationError(errors)
    return payload
1008058
def validate(self, data):
        
        video_id = self.context.get('video_id')
        video = Video.get_or_none(edx_video_id=video_id)
        if not video:
            raise serializers.ValidationError('Video "{video_id}" is not valid.'.format(video_id=video_id))

        data.update(video=video)
        return data
653169
def validate(schema, data, owner=None):
    
    schema._validate(data=data, owner=owner)
1012075
def perform_index_validation(self, data):
        
        # Build a list of dict containing query values for each unique index.
        index_data = []
        for columns, unique in self.instance._meta.indexes:
            if not unique:
                continue
            index_data.append({col: data.get(col, None) for col in columns})

        # Then query for each unique index to see if the value is unique.
        for index in index_data:
            query = self.instance.filter(**index)
            # If we have a primary key, need to exclude the current record from the check.
            if self.pk_field and self.pk_value:
                query = query.where(~(self.pk_field == self.pk_value))
            if query.count():
                err = ValidationError('index', fields=str.join(', ', index.keys()))
                for col in index.keys():
                    self.add_error(col, err)
240426
def validate(cls, data, name, **kwargs):
        """"""
        required = kwargs.get('required', False)
        if required and data is None:
            raise ValidationError("required", name, True)
        elif data is None:
            return
        elif kwargs.get('readonly'):
            return

        try:
            for key, value in kwargs.items():
                validator = cls.validation.get(key, lambda x, y: False)
                if validator(data, value):
                    raise ValidationError(key, name, value)
        except TypeError:
            raise ValidationError("unknown", name, "unknown")
        else:
            return data
427612
def validate(cls, **kwargs):
        '''  '''
        # errors can store multiple errors
        # obj is an instance in case validation succeeds
        # redis is needed for database validation
        errors = ValidationErrors()
        obj = cls()
        redis = cls.get_redis()

        # Check the fields
        for fieldname, field in obj.proxy:
            if not field.fillable:
                value = field.default
            else:
                try:
                    value = field.validate(kwargs.get(fieldname), redis)
                except BadField as e:
                    errors.append(e)
                    continue

            setattr(
                obj,
                fieldname,
                value
            )

        # Check for custom validation rules
        for fieldname in dir(cls):
            rule = getattr(cls, fieldname)

            if hasattr(rule, '_is_validation_rule') and rule._is_validation_rule:
                try:
                    rule(obj)
                except BadField as e:
                    errors.append(e)

        # Trigger errors if any
        if errors.has_errors():
            raise errors

        # Return the object with the new data set
        return obj
694382
def validate(self, model, data_access=None, *, fail_fast=None):
    
    if fail_fast is None:
      fail_fast = self.fail_fast

    self.model = model
    self.data_access = data_access
    is_valid = True
    for validation in self.validations:
      if not validation.validate(model, self):
        is_valid = False
        if fail_fast:
          break
    return is_valid
931440
def validate(self):
        

        validate_properties(self._data_map, self._metadata_props)

        for prop in self._data_map:
            validate_any(prop, getattr(self, prop), self._data_structures.get(prop))

        return self
672785
def _validate_features(self, data):
        
        if self.feature_names is None:
            self.feature_names = data.feature_names
            self.feature_types = data.feature_types
        else:
            # Booster can't accept data with different feature names
            if self.feature_names != data.feature_names:
                dat_missing = set(self.feature_names) - set(data.feature_names)
                my_missing = set(data.feature_names) - set(self.feature_names)

                msg = 'feature_names mismatch: {0} {1}'

                if dat_missing:
                    msg += ('\nexpected ' + ', '.join(str(s) for s in dat_missing) +
                            ' in input data')

                if my_missing:
                    msg += ('\ntraining data did not have the following fields: ' +
                            ', '.join(str(s) for s in my_missing))

                raise ValueError(msg.format(self.feature_names,
                                            data.feature_names))
1179865
def update(self, data):
        
        try:
            self.verifier.update(data)
        except TypeError:
            log.error("Invalid data: {} ({})".format(type(data), data))
            raise