Validate options.
778141
def validate_options(self, k, v):
        """"""

        super().validate_options(k, v)
        if k == 'errors' and v.lower() not in ('strict', 'replace', 'ignore', 'backslashreplace'):
            raise ValueError("{}: '{}' is not a valid value for '{}'".format(self.__class__.__name, v, k))
        if k == 'normalize' and v.upper() not in ('NFC', 'NFKC', 'NFD', 'NFKD'):
            raise ValueError("{}: '{}' is not a valid value for '{}'".format(self.__class__.__name, v, k))
151754
def _validate_options(self):
        '''
        
        '''
        if self.obfuscate_hostname and not self.obfuscate:
            raise ValueError(
                'Option `obfuscate_hostname` requires `obfuscate`')
        if self.analyze_image_id is not None and len(self.analyze_image_id) < 12:
            raise ValueError(
                'Image/Container ID must be at least twelve characters long.')
        if self.enable_schedule and self.disable_schedule:
            raise ValueError(
                'Conflicting options: --enable-schedule and --disable-schedule')
        if self.analyze_container and (self.register or self.unregister):
            raise ValueError('Registration not supported with '
                             'image or container analysis.')
        if self.to_json and self.to_stdout:
            raise ValueError(
                'Conflicting options: --to-stdout and --to-json')
        if self.payload and not self.content_type:
            raise ValueError(
                '--payload requires --content-type')
        if not self.legacy_upload:
            if self.group:
                raise ValueError(
                    '--group is not supported at this time.')
            if self.analyze_image_id:
                raise ValueError(
                    '--analyze-image-id is not supported at this time.')
            if self.analyze_file:
                raise ValueError(
                    '--analyze-file is not supported at this time.')
            if self.analyze_mountpoint:
                raise ValueError(
                    '--analyze-mountpoint is not supported at this time.')
            if self.analyze_container:
                raise ValueError(
                    '--analyze-container is not supported at this time.')
930838
def validate(self, model, checks=[]):
        """"""
        custom = [
            check_partial(reaction_id_check,
                          frozenset(r.id for r in model.reactions))
        ]
        super(Medium, self).validate(model=model, checks=checks + custom)
1207816
public function validate(string $value)
    {
        if (!$value || in_array($value, $this->values, true)) {
            return;
        }

        $this->error['options'] = [$this->values];
    }
216304
def validate(self):
        """"""
        if not isinstance(self.direction, six.string_types):
            raise TypeError(u'Expected string direction, got: {} {}'.format(
                type(self.direction).__name__, self.direction))

        validate_edge_direction(self.direction)
        validate_safe_string(self.edge_name)

        if not isinstance(self.optional, bool):
            raise TypeError(u'Expected bool optional, got: {} {}'.format(
                type(self.optional).__name__, self.optional))

        if not isinstance(self.within_optional_scope, bool):
            raise TypeError(u'Expected bool within_optional_scope, got: {} '
                            u'{}'.format(type(self.within_optional_scope).__name__,
                                         self.within_optional_scope))
1142101
def validate_args(args):
    """"""
    if not any([args.environment, args.stage, args.account]):
        sys.exit(NO_ACCT_OR_ENV_ERROR)
    if args.environment and args.account:
        sys.exit(ENV_AND_ACCT_ERROR)
    if args.environment and args.role:
        sys.exit(ENV_AND_ROLE_ERROR)
1307028
protected function validateOptionsFields()
    {
        if ($this->submittedValues['optionsAllOn1Line'] == PHP_INT_MAX && $this->submittedValues['optionsAllOnOwnLine'] == 1) {
            $this->errorMessages['optionsAllOnOwnLine'] = $this->t('message_validate_options_0');
        }
        if ($this->submittedValues['optionsAllOn1Line'] > $this->submittedValues['optionsAllOnOwnLine'] && $this->submittedValues['optionsAllOnOwnLine'] > 1) {
            $this->errorMessages['optionsAllOnOwnLine'] = $this->t('message_validate_options_1');
        }

        if (isset($this->submittedValues['optionsMaxLength']) && !ctype_digit($this->submittedValues['optionsMaxLength'])) {
            $this->errorMessages['optionsMaxLength'] = $this->t('message_validate_options_2');
        }
    }
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))
648003
function validate(config, source) {

  if (typeof config.rules === 'object') {
    Object.keys(config.rules).forEach(function(id) {
      validateRuleOptions(id, config.rules[id], source);
    });
  }
}
1021429
function validateOptions(options) {
  if (!options) {
    return;
  }

  utils.each(['varControls', 'tagControls', 'cmtControls'], function (key) {
    if (!options.hasOwnProperty(key)) {
      return;
    }
    if (!utils.isArray(options[key]) || options[key].length !== 2) {
      throw new Error('Option "' + key + '" must be an array containing 2 different control strings.');
    }
    if (options[key][0] === options[key][1]) {
      throw new Error('Option "' + key + '" open and close controls must not be the same.');
    }
    utils.each(options[key], function (a, i) {
      if (a.length < 2) {
        throw new Error('Option "' + key + '" ' + ((i) ? 'open ' : 'close ') + 'control must be at least 2 characters. Saw "' + a + '" instead.');
      }
    });
  });

  if (options.hasOwnProperty('cache')) {
    if (options.cache && options.cache !== 'memory') {
      if (!options.cache.get || !options.cache.set) {
        throw new Error('Invalid cache option ' + JSON.stringify(options.cache) + ' found. Expected "memory" or { get: function (key) { ... }, set: function (key, value) { ... } }.');
      }
    }
  }
  if (options.hasOwnProperty('loader')) {
    if (options.loader) {
      if (!options.loader.load || !options.loader.resolve) {
        throw new Error('Invalid loader option ' + JSON.stringify(options.loader) + ' found. Expected { load: function (pathname, cb) { ... }, resolve: function (to, from) { ... } }.');
      }
    }
  }

}
381067
def validate(self, settings):
        """"""

        if self.envs is None:
            self.envs = [settings.current_env]

        if self.when is not None:
            try:
                # inherit env if not defined
                if self.when.envs is None:
                    self.when.envs = self.envs

                self.when.validate(settings)
            except ValidationError:
                # if when is invalid, return canceling validation flow
                return

        # If only using current_env, skip using_env decoration (reload)
        if (
            len(self.envs) == 1
            and self.envs[0].upper() == settings.current_env.upper()
        ):
            self._validate_items(settings, settings.current_env)
            return

        for env in self.envs:
            with settings.using_env(env):
                self._validate_items(settings, env)
1275562
private void validateOptions() {
        // No validation if we found a help parameter
        if (helpWasSpecified) {
            return;
        }

        if (!requiredFields.isEmpty()) {
            List<String> missingFields = new ArrayList<>();
            for (ParameterDescription pd : requiredFields.values()) {
                missingFields.add("[" + Strings.join(" | ", pd.getParameter().names()) + "]");
            }
            String message = Strings.join(", ", missingFields);
            throw new ParameterException("The following "
                    + pluralize(requiredFields.size(), "option is required: ", "options are required: ")
                    + message);
        }

        if (mainParameter != null && mainParameter.description != null) {
            ParameterDescription mainParameterDescription = mainParameter.description;
            // Make sure we have a main parameter if it was required
            if (mainParameterDescription.getParameter().required() &&
                    !mainParameterDescription.isAssigned()) {
                throw new ParameterException("Main parameters are required (\""
                        + mainParameterDescription.getDescription() + "\")");
            }

            // If the main parameter has an arity, make sure the correct number of parameters was passed
            int arity = mainParameterDescription.getParameter().arity();
            if (arity != Parameter.DEFAULT_ARITY) {
                Object value = mainParameterDescription.getParameterized().get(mainParameter.object);
                if (List.class.isAssignableFrom(value.getClass())) {
                    int size = ((List<?>) value).size();
                    if (size != arity) {
                        throw new ParameterException("There should be exactly " + arity + " main parameters but "
                                + size + " were found");
                    }
                }

            }
        }
    }
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)
                        )
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)
1161239
def validate_options(self, k, v):
        """"""

        args = [self.__class__.__name__, k]
        # Booleans
        if isinstance(self.config[k], bool) and not isinstance(v, bool):
            raise ValueError("{}: option '{}' must be a bool type.".format(*args))
        # Strings
        elif isinstance(self.config[k], str) and not isinstance(v, str):
            raise ValueError("{}: option '{}' must be a str type.".format(*args))
        # Integers (whole floats allowed)
        elif (
            isinstance(self.config[k], int) and
            (not isinstance(v, int) and not (isinstance(v, float) and v.is_integer()))
        ):
            raise ValueError("{}: option '{}' must be a int type.".format(*args))
        # Floats (integers allowed)
        elif isinstance(self.config[k], float) and not isinstance(v, (int, float)):
            raise ValueError("{}: option '{}' must be a float type.".format(*args))
        # Basic iterables (list, tuple, sets)
        elif isinstance(self.config[k], (list, tuple, set)) and not isinstance(v, list):
            raise ValueError("{}: option '{}' must be a float type.".format(*args))
        # Dictionaries
        elif isinstance(self.config[k], (dict, OrderedDict)) and not isinstance(v, (dict, OrderedDict)):
            raise ValueError("{}: option '{}' must be a dict type.".format(*args))
295206
private function enforceOptions() {
		foreach ($this->validShortOptions as $option => $info) {
			if ($info['option'] === self::OPTION_REQUIRED && !isset($this->options[$option])) {
				die("The option `{$option}` is required to be given.\n	{$info['comment']}\n	{$info['description']}\n	Example: {$info['example']}\n");
			}
		}
		foreach ($this->validLongOptions as $option => $info) {
			if ($info['option'] === self::OPTION_REQUIRED && !isset($this->options[$option])) {
				die("The option `{$option}` is required to be given.\n	{$info['comment']}\n	{$info['description']}\n	Example: {$info['example']}\n");
			}
		}
	}
1241147
def validate(in_, options=None):
    
    obj_json = json.load(in_)

    results = validate_parsed_json(obj_json, options)

    return results