Validate the resources defined in the options.
489949
def _validate_resources(self):
        """"""
        resources = self.options.resources

        for key in ['num_machines', 'num_mpiprocs_per_machine', 'tot_num_mpiprocs']:
            if key in resources and resources[key] != 1:
                raise exceptions.FeatureNotAvailable(
                    "Cannot set resource '{}' to value '{}' for {}: parallelization is not supported, "
                    "only a value of '1' is accepted.".format(key, resources[key], self.__class__.__name__))
752246
def validate(resource)
      value = resource._attributes[attribute]

      if value && !types.any? { |type| value.is_a?(type) }
        short_name = type.to_s.split('::').last
        resource.errors.add(attribute, "must be a kind of #{short_name}")
      end
    end
726848
private void validateAll() throws OptionValidationException {
        boolean unattended = getBooleanValue(UNATTENDED, false);
        for (String optionId : getOptionNames()) {
            OptionDefinition opt = OptionDefinition.get(optionId, this);
            if (opt == null) {
                throw new OptionValidationException("Option is not defined", optionId);
            }
            opt.validateValue(getValue(optionId), unattended);
        }
    }
617452
def validate(self):
        """"""
        if self.error:
            return False

        for v in self.validators:
            self.error = v(self.value)
            if self.error:
                return False

        return True
1258390
def validate_options(self, k, v):
        """"""

        super().validate_options(k, v)
        if k == 'delimiters':
            for d in v:
                if not isinstance(d, (dict, OrderedDict)):
                    raise ValueError("{}: 'delimters' entries must be of dict type.".format(self.__class__.__name__))
                for key, value in d.items():
                    if key not in ('open', 'close', 'content'):
                        raise KeyError(
                            "{}: '{}' is not a valid key for a 'delimeters' entry.".format(self.__class__.__name__, key)
                        )
                    if not isinstance(value, str):
                        raise ValueError(
                            "{}: 'delimeters' '{}' key should have str values.".format(self.__class__.__name__, value)
                        )
816881
def _verify_validates(self, spec, path):
        """"""
        validates = spec['validates']

        if isinstance(validates, list):
            for validator in validates:
                self._verify_validator(validator, path)
        else:
            self._verify_validator(validates, path)
484179
function getValidOptions (options) {
  if (typeof options !== 'object') {
    return DEFAULT_OPTIONS
  }

  var validOptions = {}

  for (var prop in DEFAULT_OPTIONS) {
    if (DEFAULT_OPTIONS.hasOwnProperty(prop)) {
      validOptions[prop] = typeof options[prop] === 'string'
        ? options[prop] : DEFAULT_OPTIONS[prop]
    }
  }

  return validOptions
}
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()]) ))
35951
function validate(options) {
    const schema = joi.object().keys({
        config: joi.array().min(_.keys(options.models).length).required(),
        acl: joi.object().required(),
        models: joi.object().required()
    });
    joi.assert(options, schema, 'Invalid Shield Options:');
    return true;
}
678324
def validate_files_exist(self, folder, resources):
        
        for item in resources:
            file_name = item.get('path')
            full_path = os.path.join(folder, file_name)
            if not os.path.isfile(full_path):
                raise ValueError('%s does not exist' % full_path)
663211
protected static function validateOptions(array $options = []): void
    {
        if (empty($options)) {
            return;
        }

        $validOptions = [
            'save_path',
            'name',
            'save_handler',
            'auto_start',
            'gc_probability',
            'gc_divisor',
            'gc_maxlifetime',
            'serialize_handler',
            'cookie_lifetime',
            'cookie_path',
            'cookie_domain',
            'cookie_secure',
            'cookie_httponly',
            'use_strict_mode',
            'use_cookies',
            'use_only_cookies',
            'referer_check',
            'cache_limiter',
            'cache_expire',
            'use_trans_sid',
            'trans_sid_tags',
            'trans_sid_hosts',
            'sid_length',
            'sid_bits_per_character',
            'upload_progress.enabled',
            'upload_progress.cleanup',
            'upload_progress.prefix',
            'upload_progress.name',
            'upload_progress.freq',
            'upload_progress.min_freq',
            'lazy_write',
            'read_and_close'
        ];

        $keys = \array_keys($options);
        foreach ($keys as $key) {
            if (!\in_array($key, $validOptions, true)) {
                throw new SessionException('Incorrect option: ' . $key);
            }
        }
    }
371228
def perform_validations(options={}) # :nodoc:
      if options.is_a?(Hash)
        options[:validate] == false || valid?(options[:context])
      else
        valid?
      end
    end
1355657
def RunValidationOutputFromOptions(feed, options):
  """"""
  if options.output.upper() == "CONSOLE":
    return RunValidationOutputToConsole(feed, options)
  else:
    return RunValidationOutputToFilename(feed, options, options.output)
746344
function(options) {
      options = options || {};

      this.validateRunOptions(options);

      if (_.has(options, 'log') && this.logger.level && this.logger.level.toString() != options.log.toUpperCase()) {
        this.logger.setLevel(options.log.toUpperCase());
      }
    }
201358
def validate_options
      if @opts[:daemonize]
        fail 'Must specify PID file.' unless @opts[:pid_given]
      end
      @opts[:pid] = File.expand_path(@opts[:pid]) if @opts[:pid_given]
      @opts[:log] = File.expand_path(@opts[:log]) if @opts[:log_given]
      @opts[:error] = File.expand_path(@opts[:error]) if @opts[:error_given]
      @opts[:config] = File.expand_path(@opts[:config]) if @opts[:config_given]
    end
364530
def validate_options(options):
    """"""
    kwcase = options.get('keyword_case')
    if kwcase not in [None, 'upper', 'lower', 'capitalize']:
        raise SQLParseError('Invalid value for keyword_case: '
                            '{0!r}'.format(kwcase))

    idcase = options.get('identifier_case')
    if idcase not in [None, 'upper', 'lower', 'capitalize']:
        raise SQLParseError('Invalid value for identifier_case: '
                            '{0!r}'.format(idcase))

    ofrmt = options.get('output_format')
    if ofrmt not in [None, 'sql', 'python', 'php']:
        raise SQLParseError('Unknown output format: '
                            '{0!r}'.format(ofrmt))

    strip_comments = options.get('strip_comments', False)
    if strip_comments not in [True, False]:
        raise SQLParseError('Invalid value for strip_comments: '
                            '{0!r}'.format(strip_comments))

    space_around_operators = options.get('use_space_around_operators', False)
    if space_around_operators not in [True, False]:
        raise SQLParseError('Invalid value for use_space_around_operators: '
                            '{0!r}'.format(space_around_operators))

    strip_ws = options.get('strip_whitespace', False)
    if strip_ws not in [True, False]:
        raise SQLParseError('Invalid value for strip_whitespace: '
                            '{0!r}'.format(strip_ws))

    truncate_strings = options.get('truncate_strings')
    if truncate_strings is not None:
        try:
            truncate_strings = int(truncate_strings)
        except (ValueError, TypeError):
            raise SQLParseError('Invalid value for truncate_strings: '
                                '{0!r}'.format(truncate_strings))
        if truncate_strings <= 1:
            raise SQLParseError('Invalid value for truncate_strings: '
                                '{0!r}'.format(truncate_strings))
        options['truncate_strings'] = truncate_strings
        options['truncate_char'] = options.get('truncate_char', '[...]')

    indent_columns = options.get('indent_columns', False)
    if indent_columns not in [True, False]:
        raise SQLParseError('Invalid value for indent_columns: '
                            '{0!r}'.format(indent_columns))
    elif indent_columns:
        options['reindent'] = True  # enforce reindent
    options['indent_columns'] = indent_columns

    reindent = options.get('reindent', False)
    if reindent not in [True, False]:
        raise SQLParseError('Invalid value for reindent: '
                            '{0!r}'.format(reindent))
    elif reindent:
        options['strip_whitespace'] = True

    reindent_aligned = options.get('reindent_aligned', False)
    if reindent_aligned not in [True, False]:
        raise SQLParseError('Invalid value for reindent_aligned: '
                            '{0!r}'.format(reindent))
    elif reindent_aligned:
        options['strip_whitespace'] = True

    indent_after_first = options.get('indent_after_first', False)
    if indent_after_first not in [True, False]:
        raise SQLParseError('Invalid value for indent_after_first: '
                            '{0!r}'.format(indent_after_first))
    options['indent_after_first'] = indent_after_first

    indent_tabs = options.get('indent_tabs', False)
    if indent_tabs not in [True, False]:
        raise SQLParseError('Invalid value for indent_tabs: '
                            '{0!r}'.format(indent_tabs))
    elif indent_tabs:
        options['indent_char'] = '\t'
    else:
        options['indent_char'] = ' '

    indent_width = options.get('indent_width', 2)
    try:
        indent_width = int(indent_width)
    except (TypeError, ValueError):
        raise SQLParseError('indent_width requires an integer')
    if indent_width < 1:
        raise SQLParseError('indent_width requires a positive integer')
    options['indent_width'] = indent_width

    wrap_after = options.get('wrap_after', 0)
    try:
        wrap_after = int(wrap_after)
    except (TypeError, ValueError):
        raise SQLParseError('wrap_after requires an integer')
    if wrap_after < 0:
        raise SQLParseError('wrap_after requires a positive integer')
    options['wrap_after'] = wrap_after

    comma_first = options.get('comma_first', False)
    if comma_first not in [True, False]:
        raise SQLParseError('comma_first requires a boolean value')
    options['comma_first'] = comma_first

    right_margin = options.get('right_margin')
    if right_margin is not None:
        try:
            right_margin = int(right_margin)
        except (TypeError, ValueError):
            raise SQLParseError('right_margin requires an integer')
        if right_margin < 10:
            raise SQLParseError('right_margin requires an integer > 10')
    options['right_margin'] = right_margin

    return options
778305
def _validate_and_get_value(options, options_name, key, _type):
  
  if isinstance(options, dict):
    has = lambda k: k in options
    get = lambda k: options[k]
  elif isinstance(options, object):
    has = lambda k: hasattr(options, k)
    get = lambda k: getattr(options, k)
  else:
    raise ImproperlyConfigured(
        '`{}` must be a dictionary-like object.'.format(options_name))

  if not has(key):
    raise ImproperlyConfigured(
        '`{}` must be specified in `{}`'.format(key, options_name))

  value = get(key)
  if not isinstance(value, _type):
    raise ImproperlyConfigured(
        '`{}` in `{}` must be a {}'.format(key, options_name, repr(_type)))

  return value