Run the validators found in self._defaults on all the corresponding values.

        Raises:
            ValueError: If the configuration contains an invalid configuration value.
762064
def _validate(self):
        
        errors = []
        for k in self._defaults.keys():
            try:
                validator = self._defaults[k]['validator']
                if validator is not None:
                    self[k] = validator(self[k])
            except ValueError as e:
                errors.append('\t{}: {}'.format(k, six.text_type(e)))

        if errors:
            raise ValueError(
                'Invalid configuration values were set: \n{}'.format('\n'.join(errors)))
590038
def validate(self, config):
        
        if not isinstance(config, dict):
            raise errors.SchemeValidationError(
                'Scheme can only validate a dictionary config, but was given '
                '{} (type: {})'.format(config, type(config))
            )

        for arg in self.args:
            # the option exists in the config
            if arg.name in config:
                arg.validate(config[arg.name])

            # the option does not exist in the config
            else:
                # if the option is not required, then it is fine to omit.
                # otherwise, its omission constitutes a validation error.
                if arg.required:
                    raise errors.SchemeValidationError(
                        'Option "{}" is required, but not found.'.format(arg.name)
                    )
1289921
def configure(defaults, metadata, loader):
    
    config = Configuration(defaults)
    config.merge(loader(metadata))
    validate(defaults, metadata, config)
    return config
204543
def _run_validators(self, value):
        
        errors = []
        for v in self.validators:
            try:
                v(value)
            except ValidationError, e:
                errors.extend(e.messages)
        if errors:
            raise ValidationError(errors)
362046
def validate(self, value):
        
        for validate in self.validates:
            value = validate(value)
        return value
492901
def validate_config(conf_dict):
    
    # TASK improve validation
    if APPLICATIONS not in conf_dict.keys():
        raise InvalidConfigurationError('Missing application configuration.')
    if SEED_FILES not in conf_dict.keys():
        raise InvalidConfigurationError('Missing seed file configuration.')
    if RUNS not in conf_dict.keys():
        conf_dict[RUNS] = DEFAULT_RUNS
    if PROCESSES not in conf_dict.keys():
        conf_dict[PROCESSES] = DEFAULT_PROCESSES
    if PROCESSORS not in conf_dict.keys():
        conf_dict[PROCESSORS] = DEFAULT_PROCESSORS
    return
397545
def config(self, value: dict) -> None:
        

        self._config = value or {}
        validate_config('verifier', self._config)
1070894
def run_validators(self, value):
        """"""
        if value is self.Empty:
            return

        return super(OpaqueKeyField, self).run_validators(value)
116987
def run_validators(self, value):
        
        errors = []
        for validator in self.validators:
            if hasattr(validator, 'set_context'):
                validator.set_context(self)

            try:
                validator(value)
            except ValidationError as exc:
                # If the validation error contains a mapping of fields to
                # errors then simply raise it immediately rather than
                # attempting to accumulate a list of errors.
                if isinstance(exc.detail, dict):
                    raise
                errors.extend(exc.detail)
            except DjangoValidationError as exc:
                errors.extend(exc.messages)
        if errors:
            raise ValidationError(errors)
1358228
def All(*validators):
    
    @wraps(All)
    def built(value):
        for validator in validators:
            value = validator(value)
        return value
    return built
1015728
def compute_optional_conf(conf_name, default_value, **all_config):
    
    conf_value = all_config.get(conf_name)
    if conf_value is not None:
        # Validate configuration value.
        conf_value = get_validator(conf_name)(conf_value)
    else:
        conf_value = default_value
    return conf_value
146148
def _update_defaults(self, defaults):
        """"""

        # Accumulate complex default state.
        self.values = optparse.Values(self.defaults)
        late_eval = set()
        # Then set the options with those values
        for key, val in self._get_ordered_configuration_items():
            # '--' because configuration supports only long names
            option = self.get_option('--' + key)

            # Ignore options not present in this parser. E.g. non-globals put
            # in [global] by users that want them to apply to all applicable
            # commands.
            if option is None:
                continue

            if option.action in ('store_true', 'store_false', 'count'):
                try:
                    val = strtobool(val)
                except ValueError:
                    error_msg = invalid_config_error_message(
                        option.action, key, val
                    )
                    self.error(error_msg)

            elif option.action == 'append':
                val = val.split()
                val = [self.check_default(option, key, v) for v in val]
            elif option.action == 'callback':
                late_eval.add(option.dest)
                opt_str = option.get_opt_string()
                val = option.convert_value(opt_str, val)
                # From take_action
                args = option.callback_args or ()
                kwargs = option.callback_kwargs or {}
                option.callback(option, opt_str, val, self, *args, **kwargs)
            else:
                val = self.check_default(option, key, val)

            defaults[option.dest] = val

        for key in late_eval:
            defaults[key] = getattr(self.values, key)
        self.values = None
        return defaults
949405
def validate(self):
        """"""
        missing = []
        for k, v in self._map.items():
            attr = getattr(self, k, False)
            if not attr or attr == CONFIG_PLACEHOLDER:
                missing.append(v)
        if missing:
            return "Missing or invalid config values: {}".format(
                ", ".join(sorted(missing))
            )
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
591004
def validate(self, config):
        
        if not isinstance(config, ConfigObject):
            raise Exception("Config object expected")

        if config["output"]["componants"] not in ("local", "remote", "embedded", "without"):
            raise ValueError("Unknown componant \"%s\"." % config["output"]["componants"])

        if config["output"]["layout"] not in ("default", "content-only"):
            raise ValueError("Unknown layout \"%s\"." % config["output"]["layout"])

        if config["input"]["locations"] is not None:
            unknown_locations = [x for x in config["input"]["locations"] if not os.path.exists(x)]
            if len(unknown_locations) > 0:
                raise ValueError(
                    "Location%s \"%s\" does not exists"
                    % ("s" if len(unknown_locations) > 1 else "", ("\" and \"").join(unknown_locations))
                )

            config["input"]["locations"] = [os.path.realpath(x) for x in config["input"]["locations"]]

        if config["input"]["arguments"] is not None:
            if not isinstance(config["input"]["arguments"], dict):
                raise ValueError(
                    "Sources arguments \"%s\" are not a dict" % config["input"]["arguments"]
                )
1302363
def run_validators(self, values):
        """"""
        for val in values:
            super(CommaSepFloatField, self).run_validators(val)
52065
def validate(self, value=None, model=None, context=None):
        
        errors = []
        for validator in self.validators:
            if value is None and not isinstance(validator, Required):
                continue

            error = validator.run(
                value=value,
                model=model,
                context=context if self.use_context else None
            )
            if error:
                errors.append(error)

        return errors