Call the primary validator for a quick test
329323
def _is_valid_collection_json(self, json_repr):
        """"""
        collection = self._coerce_json_to_collection(json_repr)
        if collection is None:
            # invalid JSON, definitely broken
            return False
        aa = validate_collection(collection)
        errors = aa[0]
        for e in errors:
            _LOG.debug('> invalid JSON: {m}'.format(m=e.encode('utf-8')))
        if len(errors) > 0:
            return False
        return True
167239
def primary(value = nil, options = {}, &block)
      add_css_class!(options, "btn-primary")
      submit(value, options, &block)
    end
1229653
def _call_validators(self):
        
        msg = []
        msg.extend(self._validate_keyfile())
        msg.extend(self._validate_dns_zone())
        msg.extend(self._validate_retries())
        msg.extend(self._validate_project())
        return msg
519826
def _validate_item(self, validator, data_item, position, includes):
        
        errors = []

        # Optional field with optional value? Who cares.
        if data_item is None and validator.is_optional and validator.can_be_none:
            return errors

        errors += self._validate_primitive(validator, data_item, position)

        if errors:
            return errors

        if isinstance(validator, val.Include):
            errors += self._validate_include(validator, data_item,
                                             includes, position)

        elif isinstance(validator, (val.Map, val.List)):
            errors += self._validate_map_list(validator, data_item,
                                              includes, position)

        elif isinstance(validator, val.Any):
            errors += self._validate_any(validator, data_item,
                                         includes, position)

        return errors
979780
function Validator() {
    this._roots = {
        stdlib: null,
        foreign: null,
        heap: null
    };
    this._globals = env(this);
    this._locals = null;
    this._src = null;
    this._result = null;
}
766938
def main(source):
    
    if source is None:
        click.echo(
            "You need to supply a file or url to a schema to a swagger schema, for"
            "the validator to work."
        )
        return 1
    try:
        load(source)
        click.echo("Validation passed")
        return 0
    except ValidationError as e:
        raise click.ClickException(str(e))
361850
def validate(self, *args, **kwargs):
        
        # Schemes validation interface
        if is_scheme(self.validator):
            params = getcallargs(self.function, *args, **kwargs)
            params.update(kwargs)
            validator = self.validator(data=params, request=None)
            if validator.is_valid():
                return
            raise self.exception(validator.errors)

        # Simple validation interface
        if hasattr(self.validator, 'is_valid'):
            validator = self.validator(*args, **kwargs)
            # is valid
            if validator.is_valid():
                return
            # is invalid
            if hasattr(validator, 'errors'):
                raise self.exception(validator.errors)
            if hasattr(validator, '_errors'):
                raise self.exception(validator._errors)
            raise self.exception

        validation_result = self.validator(*args, **kwargs)
        # is invalid (validator return error message)
        if isinstance(validation_result, string_types):
            raise self.exception(validation_result)
        # is valid (truely result)
        if validation_result:
            return
        # is invalid (falsy result)
        raise self.exception
342513
def __dump_validators(self):
        """"""
        if hasattr(self, '_validators'):
            validators_json = []
            for validator in self._validators:
                if isinstance(validator, PropertyValidator):
                    validators_json.append(validator.as_json())
                else:
                    raise APIError("validator is not a PropertyValidator: '{}'".format(validator))
            if self._options.get('validators', list()) == validators_json:
                # no change
                pass
            else:
                new_options = self._options.copy()  # make a copy
                new_options.update({'validators': validators_json})
                validate(new_options, options_json_schema)
                self._options = new_options
17445
def add_validate(subparsers):
    """"""
    validate_parser = subparsers.add_parser(
        'validate', help=add_validate.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    validate_parser.set_defaults(func=validate_parser.print_help)

    validate_subparsers = validate_parser.add_subparsers(title='Testers')

    validate_all_parser = validate_subparsers.add_parser(
        'all', help=validate.validate_all.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    validate_all_parser.set_defaults(func=validate.validate_all)

    validate_gate_parser = validate_subparsers.add_parser(
        'gate', help=validate.validate_gate.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    validate_gate_parser.set_defaults(func=validate.validate_gate)
1361406
def call(self, name, *a):
        """"""
        return callJavaFunc(self._sc, getattr(self._java_model, name), *a)
733699
def validate(self, key, value):
    """"""
    if self._validator is not None:
      self._validator(key, value)
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)
1218716
def validate(user_input, ret_errs=False, print_errs=False):
    

    errs = run_validator(user_input)
    passed = len(errs) == 0

    if print_errs:
        for err in errs:
            print(err)

    if ret_errs:
        return passed, errs

    return passed
1341884
def validate(self, arg=None):
        """"""
        if os.path.isdir(self.path):
            self.validator.object = None
        else:
            self.validator.object = ICONS['error']
1113914
def validate(self, value) :
        """"""
        for v in self.validators :
            v.validate(value)
        return True
449810
function addValidator(name, validator, params) {
    var _this = this;
    var validators = validator instanceof Array ? validator : [validator];
    var validate = void 0;

    if (typeof validator === 'string') {
        validate = function validate() /*value, arg, options*/{
            return _this[validator].apply({ alias: name, _this: _this }, arguments);
        };
    } else {
        validate = function validate(value /*arg, options*/) {
            var args = Array.prototype.slice.call(arguments, 2);
            var arg1 = arguments[1];
            var arg2 = arguments[2];
            var _this2 = this && this._this || _this;
            var isSimpleArgsFormat = _this2[name][SIMPLE_ARGS_FORMAT] || _this2[SIMPLE_ARGS_FORMAT];
            var isOneOptionsArg = _this2[name][ONE_OPTIONS_ARG] || _this2[ONE_OPTIONS_ARG];
            var options = !isOneOptionsArg && isPlainObject(arg2) ? arg2 : {};

            if (arg1 != null && typeof arg1 !== 'boolean') {
                if (isPlainObject(arg1)) {
                    options = arg1;
                } else {
                    options[_this2[name][ARG] || _this2[ARG]] = arg1;

                    if (!isSimpleArgsFormat) {
                        args.shift();
                    }
                }
            }

            for (var i = 0; i < validators.length; i++) {
                var base = validators[i];

                switch (typeof base === 'undefined' ? 'undefined' : _typeof(base)) {
                    case 'function':
                        validator = validatorWrapper(_this2, name, base);break;

                    case 'string':
                        validator = _this2[base];break;

                    case 'object':
                        validator = _this2[base[0]];
                        options = assign({}, options, base[1]);
                }

                var error = validator.apply(this, [value, options].concat(args));

                if (error) {
                    return error;
                }
            }
        };
    }

    assign(validate, params);

    validate.curry = function () /*arg, options*/{
        var _arguments = arguments;
        //Partial application
        return function (value) {
            return validate.apply(_this, [value].concat(Array.prototype.slice.call(_arguments)));
        };
    };

    _this[name] = validate;
}
238419
def validate_resource(self, value):
        """"""

        def do_backoff(*args, **kwargs):
            """Call self._test_connection with exponential backoff, for self._max_tries attempts"""
            attempts = 0
            while True:
                try:
                    self._test_connection(*args, **kwargs)
                    break
                except ValidationError:
                    wait_secs = min(self._max_wait, 2 ** attempts)
                    attempts += 1
                    if attempts < self._max_tries:
                        time.sleep(wait_secs)
                    else:
                        raise

        do_backoff(value)