Validates the "regionalOptions" field and verifies all the regions used
    in "regionalOptions" have the same options.
188711
def assert_consistent_reg_options(exec_type, json_spec, executable_builder_exeception):
    
    reg_options_spec = json_spec.get('regionalOptions')
    json_fn = 'dxapp.json' if exec_type == 'app' else 'dxworkflow.json'

    if not isinstance(reg_options_spec, dict):
        raise executable_builder_exeception("The field 'regionalOptions' in  must be a mapping")
    if not reg_options_spec:
        raise executable_builder_exeception(
            "The field 'regionalOptions' in " + json_fn + " must be a non-empty mapping")
    regional_options_list = list(reg_options_spec.items())
    for region, opts_for_region in regional_options_list:
        if not isinstance(opts_for_region, dict):
            raise executable_builder_exeception("The field 'regionalOptions['" + region +
                            "']' in " + json_fn + " must be a mapping")
        if set(opts_for_region.keys()) != set(regional_options_list[0][1].keys()):
            if set(opts_for_region.keys()) - set(regional_options_list[0][1].keys()):
                with_key, without_key = region, regional_options_list[0][0]
                key_name = next(iter(set(opts_for_region.keys()) - set(regional_options_list[0][1].keys())))
            else:
                with_key, without_key = regional_options_list[0][0], region
                key_name = next(iter(set(regional_options_list[0][1].keys()) - set(opts_for_region.keys())))
            raise executable_builder_exeception(
                "All regions in regionalOptions must specify the same options; " +
                "%s was given for %s but not for %s" % (key_name, with_key, without_key)
            )

        if exec_type == 'app':
            for key in opts_for_region:
                if key in json_spec.get('runSpec', {}):
                    raise executable_builder_exeception(
                    key + " cannot be given in both runSpec and in regional options for " + region)
797484
def validate(self, value, model_instance):
        
        if not self.multiple:
            return super(CountryField, self).validate(value, model_instance)

        if not self.editable:
            # Skip validation for non-editable fields.
            return

        if value:
            choices = [option_key for option_key, option_value in self.choices]
            for single_value in value:
                if single_value not in choices:
                    raise exceptions.ValidationError(
                        self.error_messages["invalid_choice"],
                        code="invalid_choice",
                        params={"value": single_value},
                    )

        if not self.blank and value in self.empty_values:
            raise exceptions.ValidationError(self.error_messages["blank"], code="blank")
928571
protected function validateRelationFields()
    {
        if (empty($this->submittedValues['sendCustomer']) && !empty($this->submittedValues['emailAsPdf'])) {
            $this->warningMessages['conflicting_options'] = $this->t('message_validate_conflicting_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))
120856
public void endInvalidatingRegion() {
		synchronized (this) {
			if (--regionInvalidations == 0) {
				regionInvalidationTimestamp = timeSource.nextTimestamp();
				if (trace) {
					log.tracef("Finished invalidating region %s at %d", cache.getName(), regionInvalidationTimestamp);
				}
			}
			else {
				if (trace) {
					log.tracef("Finished invalidating region %s, but there are %d ongoing invalidations", cache.getName(), regionInvalidations);
				}
			}
		}
	}
1049898
def assert_consistent_regions(from_spec, from_command_line, builder_exception):
    
    if from_spec is None or from_command_line is None:
        return
    if set(from_spec) != set(from_command_line):
        raise builder_exception("--region and the 'regionalOptions' key in the JSON file do not agree")
73608
private void validateConfigurationProperties() {
        if (isStringValueUndefined(config.userName()) && !isStringValueUndefined(config.userPassword())) {
            Tr.error(tc, "QUICK_START_SECURITY_MISSING_ATTIRBUTES", CFG_KEY_USER);
        }
        if (!isStringValueUndefined(config.userName()) && isStringValueUndefined(config.userPassword())) {
            Tr.error(tc, "QUICK_START_SECURITY_MISSING_ATTIRBUTES", CFG_KEY_PASSWORD);
        }
        errorOnAnotherRegistry();
        errorOnAnotherManagementRole();
    }
273761
public static void checkOptional(OptionSet options, List<String> opts)
            throws VoldemortException {
        List<String> optCopy = Lists.newArrayList();
        for(String opt: opts) {
            if(options.has(opt)) {
                optCopy.add(opt);
            }
        }
        if(optCopy.size() > 1) {
            System.err.println("Conflicting options:");
            for(String opt: optCopy) {
                System.err.println("--" + opt);
            }
            throw new VoldemortException("Conflicting options detected.");
        }
    }
1349022
def schemaSetValidOptions(self, options):
        
        ret = libxml2mod.xmlSchemaSetValidOptions(self._o, options)
        return ret
727190
def validate_options(self, k, v):
        """"""

        super().validate_options(k, v)
        if k == 'mode' and v not in MODE:
            raise ValueError("{}: '{}' is not a valid value for '{}'".format(self.__class__.__name, v, k))
884307
function validateOptions(options) {
  if (_.isNil(options)) {
    return null;
  }

  if (!_.isPlainObject(options)) {
    return new TypeError('Expected `options` to be an object or not defined.');
  }

  if (!isOptionalIntAbove(options.time, 0)) {
    return new TypeError('Expected `options.time` to be an integer that is 0 or greater.');
  }

  if (!isOptionalIntAbove(options.count, 1)) {
    return new TypeError('Expected `options.count` to be an integer greater than 0.');
  }

  return null;
}
636612
function validateRuleOptions(id, options, source) {
  var validateRule = validators.rules[id],
    message;

  if (!validateRule) {
    validateRule = schemaValidator(getRuleOptionsSchema(id), { verbose: true });
    validators.rules[id] = validateRule;
  }

  if (typeof options === 'number') {
    options = [options];
  }

  validateRule(options);

  if (validateRule.errors) {
    message = [
      source, ':\n',
      '\tConfiguration for rule "', id, '" is invalid:\n'
    ];
    validateRule.errors.forEach(function(error) {
      if (error.field === 'data["0"]') {  // better error for severity
        message.push(
                    '\tSeverity should be one of the following: 0 = off, 1 = warning, 2 = error (you passed "', error.value, '").\n');
      } else {
        message.push(
                    '\tValue "', error.value, '" ', error.message, '.\n'
                );
      }
    });

    throw new Error(message.join(''));
  }
}
894305
private void validateConfiguration(ApiSource apiSource) throws GenerateException {
        if (apiSource == null) {
            throw new GenerateException("You do not configure any apiSource!");
        } else if (apiSource.getInfo() == null) {
            throw new GenerateException("`<info>` is required by Swagger Spec.");
        }
        if (apiSource.getInfo().getTitle() == null) {
            throw new GenerateException("`<info><title>` is required by Swagger Spec.");
        }

        if (apiSource.getInfo().getVersion() == null) {
            throw new GenerateException("`<info><version>` is required by Swagger Spec.");
        }

        if (apiSource.getInfo().getLicense() != null && apiSource.getInfo().getLicense().getName() == null) {
            throw new GenerateException("`<info><license><name>` is required by Swagger Spec.");
        }

        if (apiSource.getLocations() == null) {
            throw new GenerateException("<locations> is required by this plugin.");
        }

    }
778774
public static boolean containsOptionWithMatching(final List<?> options, final Object data) {
		if (options != null) {
			for (Object option : options) {
				if (option instanceof OptionGroup) {
					List<?> groupOptions = ((OptionGroup) option).getOptions();
					if (groupOptions != null) {
						for (Object nestedOption : groupOptions) {
							if (isEqualWithMatching(nestedOption, data)) {
								return true;
							}
						}
					}
				} else if (isEqualWithMatching(option, data)) {
					return true;
				}
			}
		}
		return false;
	}
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]);
            }
1006975
function validateOptions(options) {
  const notSupported = _.reject(_.keys(options), (key) => (
    OPTIONS.has(key)
  ));

  if (notSupported.length > 0) {
    console.warn(`[${PLUGIN_NAME}] Options ${notSupported} are not supported, use following options: ${Array.from(OPTIONS)}`);
  }
}
1349452
def validate(self, value, model_instance):
        
        if not self.editable:
            # Skip validation for non-editable fields.
            return
        if self._choices and value:
            print(value)
            l = value
            if type(value) != list:
                l = [ value ]
            for v in value:
                for option_key, option_value in self.choices:
                    if isinstance(option_value, (list, tuple)):
                        # This is an optgroup, so look inside the group for options.
                        for optgroup_key, optgroup_value in option_value:
                            if v == optgroup_key:
                                return
                    elif v == option_key:
                        return
                raise ValidationError(self.error_messages['invalid_choice'] % {'value': value})

        if value is None and not self.null:
            raise ValidationError(self.error_messages['null'])

        if not self.blank and value in validators.EMPTY_VALUES:
            raise ValidationError(self.error_messages['blank'])

        return super(MultipleChoiceCommaSeparatedIntegerField, self).validate(value, model_instance)