Ensures that options passed to the backend are valid.
494645
def parse_swag_config_options(config):
    """"""
    options = {}
    for key, val in config.items():
        if key.startswith('swag.backend.'):
            options[key[12:]] = val
        if key.startswith('swag.'):
            options[key[5:]] = val

    if options.get('type') == 's3':
        return S3OptionsSchema(strict=True).load(options).data
    elif options.get('type') == 'dynamodb':
        return DynamoDBOptionsSchema(strict=True).load(options).data
    else:
        return FileOptionsSchema(strict=True).load(options).data
581152
def _validate_opts(opts):
    '''
    
    '''
    def format_multi_opt(valid_type):
        try:
            num_types = len(valid_type)
        except TypeError:
            # Bare type name won't have a length, return the name of the type
            # passed.
            return valid_type.__name__
        else:
            def get_types(types, type_tuple):
                for item in type_tuple:
                    if isinstance(item, tuple):
                        get_types(types, item)
                    else:
                        try:
                            types.append(item.__name__)
                        except AttributeError:
                            log.warning(
                                'Unable to interpret type %s while validating '
                                'configuration', item
                            )
            types = []
            get_types(types, valid_type)

            ret = ', '.join(types[:-1])
            ret += ' or ' + types[-1]
            return ret

    errors = []

    err = (
        'Config option \'{0}\' with value {1} has an invalid type of {2}, a '
        '{3} is required for this option'
    )
    for key, val in six.iteritems(opts):
        if key in VALID_OPTS:
            if val is None:
                if VALID_OPTS[key] is None:
                    continue
                else:
                    try:
                        if None in VALID_OPTS[key]:
                            continue
                    except TypeError:
                        # VALID_OPTS[key] is not iterable and not None
                        pass

            if isinstance(val, VALID_OPTS[key]):
                continue

            # We don't know what data type sdb will return at run-time so we
            # simply cannot check it for correctness here at start-time.
            if isinstance(val, six.string_types) and val.startswith('sdb://'):
                continue

            if hasattr(VALID_OPTS[key], '__call__'):
                try:
                    VALID_OPTS[key](val)
                    if isinstance(val, (list, dict)):
                        # We'll only get here if VALID_OPTS[key] is str or
                        # bool, and the passed value is a list/dict. Attempting
                        # to run int() or float() on a list/dict will raise an
                        # exception, but running str() or bool() on it will
                        # pass despite not being the correct type.
                        errors.append(
                            err.format(
                                key,
                                val,
                                type(val).__name__,
                                VALID_OPTS[key].__name__
                            )
                        )
                except (TypeError, ValueError):
                    errors.append(
                        err.format(key,
                                   val,
                                   type(val).__name__,
                                   VALID_OPTS[key].__name__)
                    )
                continue

            errors.append(
                err.format(key,
                           val,
                           type(val).__name__,
                           format_multi_opt(VALID_OPTS[key]))
            )

    # Convert list to comma-delimited string for 'return' config option
    if isinstance(opts.get('return'), list):
        opts['return'] = ','.join(opts['return'])

    for error in errors:
        log.warning(error)
    if errors:
        return False
    return True
807100
protected void validate() {
        Assert.checkNotNullParam("endpoint", endpoint);
        Assert.checkNotNullParam("optionMap", optionMap);
        Assert.checkNotNullParam("uri", uri);
    }
167872
def validate_config
      message = 'bad path in config'

      # Checks the option in the asset key.
      def validate_asset_options(opts)
        opts.each do |k, v|
          fail 'bad option in config' if k == :sprockets_options
          fail message if k == :output && !Utils.safe_path?(v)
        end
      end

      @config[:excludes].each do |v|
        fail message unless Utils.safe_path? v
      end unless @config[:excludes].nil?

      @config[:external].each do |k, v|
        next if k == :server

        v.each do |repo|
          fail message unless Utils.safe_path? repo[1]
        end unless v.nil?
      end unless @config[:external].nil?

      @config[:components].each do |k, v|
        # process @config[:components][:base] then go to the next option
        if k == :base
          fail message unless Utils.safe_path? v
          next
        end unless v.nil?

        # process @config[:components][:paths]
        if k == :paths
          v.each do |path|
            fail message unless Utils.safe_path? path[0]
            fail message unless Utils.safe_path? path[1]
          end
        end
      end unless @config[:components].nil?

      @config[:assets].each do |k, v|
        # process @config[:assets][:options] then go to the next option
        if k == :options
          validate_asset_options v
          next
        end unless v.nil?

        # process @config[:assets][:sources] then go to the next option
        if k == :sources
          v.each_with_index do |source, _|
            fail message unless Utils.safe_path? source
          end
          next
        end

        # process each asset type in @config[:assets]
        v.each do |asset_key, asset_value|
          # process :options
          if asset_key == :options
            validate_asset_options asset_value
            next
          end unless asset_value.nil?

          # process each asset path
          asset_value.each_with_index do |path, _|
            fail message unless Utils.safe_path? path
          end if asset_key == :paths
        end
      end unless @config[:assets].nil?

      @config
    end
521696
def valid(self, value, include_name=True):
		

		# Call the parent valid method and return the result
		return super(Tree, self).valid(value, include_name and [self._name] or [])
190562
def _validate_options(cls, options):
        
        for opt1, opt2 in \
                itertools.permutations(cls.BASE_ERROR_SELECTION_OPTIONS, 2):
            if getattr(options, opt1) and getattr(options, opt2):
                log.error('Cannot pass both {} and {}. They are '
                          'mutually exclusive.'.format(opt1, opt2))
                return False

        if options.convention and options.convention not in conventions:
            log.error("Illegal convention '{}'. Possible conventions: {}"
                      .format(options.convention,
                              ', '.join(conventions.keys())))
            return False
        return True
668428
def valid(*things):
	''''''
	for thing in things:
		if type(thing) is str and not os.path.exists(thing):
			return False
		if thing.valid is None:
			return False
	return True
1050396
function verifyOptions(options) {
	if (!pa11y.allowedStandards.includes(options.standard)) {
		throw new Error(`Standard must be one of ${pa11y.allowedStandards.join(', ')}`);
	}
	if (options.page && !options.browser) {
		throw new Error('The page option must only be set alongside the browser option');
	}
}
1313775
def validate_options(self):
        
        for option in self._option_list:
            # validate options
            if option.required and option.key not in self._results:
                raise RuntimeError('Option %s is required.' % option.name)
597001
def _validate_options(options, service_name, add_error):
    
    if options is None:
        return
    if not isdict(options):
        add_error('service {} has malformed options'.format(service_name))
1069155
function checkOptions(options) {
                // @TODO: should we throw an error if there are incorrect options provided?
                options = _.pick(options, permittedOptions);

                let validationErrors = utils.validateOptions(options);

                if (_.isEmpty(validationErrors)) {
                    return Promise.resolve(options);
                }

                // For now, we can only handle showing the first validation error
                return Promise.reject(validationErrors[0]);
            }
986043
def form_valid(self, post_form, attachment_formset, poll_option_formset, **kwargs):
        
        save_poll_option_formset = poll_option_formset is not None \
            and not self.preview

        valid = super().form_valid(
            post_form, attachment_formset, poll_option_formset=poll_option_formset, **kwargs)

        if save_poll_option_formset:
            poll_option_formset.topic = self.forum_post.topic
            poll_option_formset.save(
                poll_question=post_form.cleaned_data.pop('poll_question', None),
                poll_max_options=post_form.cleaned_data.pop('poll_max_options', None),
                poll_duration=post_form.cleaned_data.pop('poll_duration', None),
                poll_user_changes=post_form.cleaned_data.pop('poll_user_changes', None),
            )

        return valid
373811
function validateOptions(options) {
  const {
    lifecycleExperimental,
    disableLifecycleMethods,
    enableComponentDidUpdateOnSetState,
    supportPrevContextArgumentOfComponentDidUpdate,
    lifecycles,
  } = options;
  if (typeof lifecycleExperimental !== 'undefined' && typeof lifecycleExperimental !== 'boolean') {
    throw new Error('lifecycleExperimental must be either true or false if provided');
  }

  if (typeof disableLifecycleMethods !== 'undefined' && typeof disableLifecycleMethods !== 'boolean') {
    throw new Error('disableLifecycleMethods must be either true or false if provided');
  }

  if (
    lifecycleExperimental != null
    && disableLifecycleMethods != null
    && lifecycleExperimental === disableLifecycleMethods
  ) {
    throw new Error('lifecycleExperimental and disableLifecycleMethods cannot be set to the same value');
  }

  if (
    typeof enableComponentDidUpdateOnSetState !== 'undefined'
    && lifecycles.componentDidUpdate
    && lifecycles.componentDidUpdate.onSetState !== enableComponentDidUpdateOnSetState
  ) {
    throw new TypeError('the legacy enableComponentDidUpdateOnSetState option should be matched by `lifecycles: { componentDidUpdate: { onSetState: true } }`, for compatibility');
  }

  if (
    typeof supportPrevContextArgumentOfComponentDidUpdate !== 'undefined'
    && lifecycles.componentDidUpdate
    && lifecycles.componentDidUpdate.prevContext !== supportPrevContextArgumentOfComponentDidUpdate
  ) {
    throw new TypeError('the legacy supportPrevContextArgumentOfComponentDidUpdate option should be matched by `lifecycles: { componentDidUpdate: { prevContext: true } }`, for compatibility');
  }
}
631218
def validate(config):
    '''
    
    '''
    if not isinstance(config, list):
        return False, ('Configuration for haproxy beacon must '
                       'be a list.')
    else:
        _config = {}
        list(map(_config.update, config))

        if 'backends' not in _config:
            return False, ('Configuration for haproxy beacon '
                           'requires backends.')
        else:
            if not isinstance(_config['backends'], dict):
                return False, ('Backends for haproxy beacon '
                               'must be a dictionary.')
            else:
                for backend in _config['backends']:
                    log.debug('_config %s', _config['backends'][backend])
                    if 'servers' not in _config['backends'][backend]:
                        return False, ('Backends for haproxy beacon '
                                       'require servers.')
                    else:
                        _servers = _config['backends'][backend]['servers']
                        if not isinstance(_servers, list):
                            return False, ('Servers for haproxy beacon '
                                           'must be a list.')
    return True, 'Valid beacon configuration'
531705
function validateParams (params) {
  if (!params) {
    throw new Error('Transloadit: The `params` option is required.')
  }

  if (typeof params === 'string') {
    try {
      params = JSON.parse(params)
    } catch (err) {
      // Tell the user that this is not an Uppy bug!
      err.message = 'Transloadit: The `params` option is a malformed JSON string: ' +
        err.message
      throw err
    }
  }

  if (!params.auth || !params.auth.key) {
    throw new Error('Transloadit: The `params.auth.key` option is required. ' +
      'You can find your Transloadit API key at https://transloadit.com/account/api-settings.')
  }
}
1161286
def assert_valid_options(options)
      options = options.to_hash

      options.each do |attribute, value|
        case attribute
          when :fields                         then assert_valid_fields(value, options[:unique])
          when :links                          then assert_valid_links(value)
          when :conditions                     then assert_valid_conditions(value)
          when :offset                         then assert_valid_offset(value, options[:limit])
          when :limit                          then assert_valid_limit(value)
          when :order                          then assert_valid_order(value, options[:fields])
          when :unique, :add_reversed, :reload then assert_valid_boolean("options[:#{attribute}]", value)
          else
            assert_valid_conditions(attribute => value)
        end
      end
    end
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()]) ))