Validate that the ContextFieldExistence is correctly representable.
546159
def validate(self):
        """"""
        if not isinstance(self.location, Location):
            raise TypeError(u'Expected Location location, got: {} {}'.format(
                type(self.location).__name__, self.location))

        if self.location.field:
            raise ValueError(u'Expected location to point to a vertex, '
                             u'but found a field: {}'.format(self.location))
858430
def _validate_contains(self, expected_values, field, value):
        
        if not isinstance(value, Iterable):
            return

        if not isinstance(expected_values, Iterable) or isinstance(
            expected_values, _str_type
        ):
            expected_values = set((expected_values,))
        else:
            expected_values = set(expected_values)

        missing_values = expected_values - set(value)
        if missing_values:
            self._error(field, errors.MISSING_MEMBERS, missing_values)
1355984
def assert_valid(self, instance, value=None):
        """"""
        valid = super(Dictionary, self).assert_valid(instance, value)
        if not valid:
            return False
        if value is None:
            value = instance._get(self.name)
        if value is None:
            return True
        if self.key_prop or self.value_prop:
            for key, val in iteritems(value):
                if self.key_prop:
                    self.key_prop.assert_valid(instance, key)
                if self.value_prop:
                    self.value_prop.assert_valid(instance, val)
        return True
146758
def is_valid(self):
        
        if not isinstance(self._expiration, datetime.datetime):
            raise InvalidArgumentError('Expiration datetime must be specified.')

        if 'key' not in self.form_data:
            raise InvalidArgumentError('object key must be specified.')

        if 'bucket' not in self.form_data:
            raise InvalidArgumentError('bucket name must be specified.')
15534
def _TemplateExists(unused_value, context, args):
    """"""
    try:
        name = args[0]
    except IndexError:
        raise EvaluationError('The "template" predicate requires an argument.')
    return context.HasTemplate(name)
989824
def _verify_validator(self, validator, path):
        """"""

        # Validator should be a function
        if not callable(validator):
            raise SchemaFormatException("Invalid validations for {}", path)

        # Validator should accept a single argument
        (args, varargs, keywords, defaults) = getargspec(validator)
        if len(args) != 1:
            raise SchemaFormatException("Invalid validations for {}", path)
118132
private boolean checkCondition(TestContext context) {
        if (conditionExpression != null) {
            return conditionExpression.evaluate(context);
        }

        // replace dynamic content with each iteration
        String conditionString = context.replaceDynamicContentInString(condition);
        if (ValidationMatcherUtils.isValidationMatcherExpression(conditionString)) {
            try {
                ValidationMatcherUtils.resolveValidationMatcher("iteratingCondition", "", conditionString, context);
                return true;
            } catch (AssertionError e) {
                return false;
            }
        }

        return BooleanExpressionParser.evaluate(conditionString);
    }
976333
def validate(self):
        """"""
        # Literals representing boolean values or None are correctly representable and supported.
        if self.value is None or self.value is True or self.value is False:
            return

        # Literal safe strings are correctly representable and supported.
        if isinstance(self.value, six.string_types):
            validate_safe_string(self.value)
            return

        # Literal ints are correctly representable and supported.
        if isinstance(self.value, int):
            return

        # Literal empty lists, and non-empty lists of safe strings, are
        # correctly representable and supported.
        if isinstance(self.value, list):
            if len(self.value) > 0:
                for x in self.value:
                    validate_safe_string(x)
            return

        raise GraphQLCompilationError(u'Cannot represent literal: {}'.format(self.value))
1342984
def validate(self, value):
        
        if value == '':
            if self.kwargs.get('nullable', __nullable__):
                value = None
            else:
                value = 0
            
        if not isinstance(value, Model):
            return super(ReferenceProperty, self).validate(value)

        if not value.is_saved():
            raise BadValueError(
                    '%s instance must be saved before it can be stored as a '
                    'reference' % self.reference_class.__class__.__name__)
        if not isinstance(value, self.reference_class):
            raise KindError('Property %s must be an instance of %s' %
                    (self.name, self.reference_class.__class__.__name__))

        return value
989594
def validate(self):
        """"""
        # check if required_fields aren't present
        for field in set(self.required_fields) - set(self.request_data):
            if not isinstance(field, string_types):
                # field was a collection, iterate over it and check by OR
                return bool(set(field) & set(self.request_data))
            return False
        return True
1252972
def is_valid(self, context):
        
        if self.requires:
            for r in self.requires:
                if not r in context.executed_actions:
                    raise RequirementMissingError("Action '%s' requires '%s'" % (self.name, r))
        return True
273053
def validate(self):
        """"""
        if not isinstance(self.fold_scope_location, FoldScopeLocation):
            raise TypeError(u'Expected FoldScopeLocation fold_scope_location, got: {} {}'.format(
                type(self.fold_scope_location), self.fold_scope_location))

        if self.fold_scope_location.field is None:
            raise ValueError(u'Expected FoldScopeLocation at a field, but got: {}'
                             .format(self.fold_scope_location))

        if self.fold_scope_location.field == COUNT_META_FIELD_NAME:
            if not GraphQLInt.is_same_type(self.field_type):
                raise TypeError(u'Expected the _x_count meta-field to be of GraphQLInt type, but '
                                u'encountered type {} instead: {}'
                                .format(self.field_type, self.fold_scope_location))
        else:
            if not isinstance(self.field_type, GraphQLList):
                raise ValueError(u'Invalid value of "field_type" for a field that is not '
                                 u'a meta-field, expected a list type but got: {} {}'
                                 .format(self.field_type, self.fold_scope_location))

            inner_type = strip_non_null_from_type(self.field_type.of_type)
            if isinstance(inner_type, GraphQLList):
                raise GraphQLCompilationError(
                    u'Outputting list-valued fields in a @fold context is currently not supported: '
                    u'{} {}'.format(self.fold_scope_location, self.field_type.of_type))
549402
public void checkValidity() throws ACMValidationException {
                if (context == null) {
                        throw new ACMValidationException("Invalid state of AC model: No context assigned");
                }
                if (!getContext().containsActivities()) {
                        return;
                }
                for (String activity : getContext().getActivities()) {
                        try {
                                if (!isExecutable(activity)) {
                                        throw new ACMValidationException("Model contains non-executable transactions: " + activity);
                                }
                        } catch (CompatibilityException e) {
                                throw new ACMValidationException("Error during validation check: " + e.getMessage());
                        }
                }
        }
756785
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    if (pvalue == null) {
      return true;
    }
    try {
      final Object field1Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field1Name);
      final Object field2Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field2Name);
      if ((field1Value == null
          || field1Value instanceof String && StringUtils.isEmpty((String) field1Value))
          && (field2Value == null
              || field2Value instanceof String && StringUtils.isEmpty((String) field2Value))) {
        return true;
      }
      if (Objects.equals(field1Value, field2Value)) {
        switchContext(pcontext);
        return false;
      }
      return true;
    } catch (final Exception ignore) {
      switchContext(pcontext);
      return false;
    }
  }
165444
def validate(self, value):
        """"""
        if value is not None and not isinstance(value, str):
            raise ValidationError("field must be a string")

        super().validate(value)
1043609
private static void validateEnvironment(SessionContext context, Executor executor) {
		System.out.print("Validating current environment...");
		try {
			executor.validateSession(context);
			System.out.println("done.");
		} catch (SqlExecutionException e) {
			throw new SqlClientException(
				"The configured environment is invalid. Please check your environment files again.", e);
		}
	}
786273
def _validate_model(model):
    """"""
    if not hasattr(model, "as_search_document"):
        raise ImproperlyConfigured("'%s' must implement `as_search_document`." % model)
    if not hasattr(model.objects, "get_search_queryset"):
        raise ImproperlyConfigured(
            "'%s.objects must implement `get_search_queryset`." % model
        )