Validate Storage OS and its UUID.

        If the OS is a custom OS UUID, don't validate against templates.
169537
def get_OS_UUID(cls, os):
        
        if os in cls.templates:
            return cls.templates[os]

        uuid_regexp = '^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$'
        if re.search(uuid_regexp, os):
            return os

        raise Exception((
            "Invalid OS -- valid options are: 'CentOS 6.5', 'CentOS 7.0', "
            "'Debian 7.8', 'Debian 8.0' ,'Ubuntu 12.04', 'Ubuntu 14.04', 'Ubuntu 16.04', "
            "'Windows 2008', 'Windows 2012'"
        ))
811328
def validate(self) :
        """"""
        self._store.validate()
        for pField in self.collection.arangoPrivates :
            self.collection.validatePrivate(pField, getattr(self, pField))
1038404
def check_is_uuid(self, uuid_str: str):
        
        # check uuid type
        if not isinstance(uuid_str, str):
            raise TypeError("'uuid_str' expected a str value.")
        else:
            pass
        # handle Isogeo specific UUID in XML exports
        if "isogeo:metadata" in uuid_str:
            uuid_str = "urn:uuid:{}".format(uuid_str.split(":")[-1])
        else:
            pass
        # test it
        try:
            uid = UUID(uuid_str)
            return uid.hex == uuid_str.replace("-", "").replace("urn:uuid:", "")
        except ValueError as e:
            logging.error(
                "uuid ValueError. {} ({})  -- {}".format(type(uuid_str), uuid_str, e)
            )
            return False
1346384
function validate () {
  var env = state.env('NODE_ENV');
  var uri = state.env('MONGO_URI');
  var notTestEnv = env !== 'test';
  if (notTestEnv) {
    throw new Error('NODE_ENV must be set to "test".');
  }
  var notTestDb = word.test(uri) === false;
  if (notTestDb) {
    throw new Error('MONGO_URI must contain "test" word.');
  }
}
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__))
1283812
def validate_uuid_representation(dummy, value):
    
    try:
        return _UUID_REPRESENTATIONS[value]
    except KeyError:
        raise ValueError("%s is an invalid UUID representation. "
                         "Must be one of "
                         "%s" % (value, tuple(_UUID_REPRESENTATIONS)))
592260
def _validate(self):
        
        if self.data_format is FormatType.PYTHON:
            self.data = self.raw_data
        elif self.data_format is FormatType.JSON:
            self._validate_json()
        elif self.data_format is FormatType.YAML:
            self._validate_yaml()
642688
def _validated(self, value):
        """"""
        if value is None:
            return None
        if isinstance(value, uuid.UUID):
            return value
        try:
            if isinstance(value, bytes) and len(value) == 16:
                return uuid.UUID(bytes=value)
            else:
                return uuid.UUID(value)
        except (ValueError, AttributeError, TypeError):
            self.fail('invalid_uuid')
1047113
def validate(self, instance, value):
        """"""
        if not isinstance(value, uuid.UUID):
            self.error(instance, value)
        return value
844295
def valid_uuid(value):
    

    try:
        uuid.UUID(value, version=4)
        return True
    except (TypeError, ValueError, AttributeError):
        return False
335894
protected function validateDirectories()
    {

        // query whether the container's application directory is available and readable
        $appBase = $this->getAppBase();
        if (!is_dir($appBase) || !is_readable($appBase)) {
            $this->getInitialContext()->getSystemLogger()->critical(
                sprintf(
                    'Base directory (appBase) %s of container %s is no directory or not readable, can\'t deploy applications',
                    $appBase,
                    $this->getName()
                )
            );
        }

        // query whether the container's temporary directory is available and readable
        $tmpDir = $this->getTmpDir();
        if (!is_dir($tmpDir) || !is_readable($tmpDir)) {
            $this->getInitialContext()->getSystemLogger()->critical(
                sprintf(
                    'Temporary directory (tmpDir) %s of container %s is no directory or not readable!',
                    $tmpDir,
                    $this->getName()
                )
            );
        }
    }
600699
public static boolean isValidUUID(String uuid) {

        try {
            return (null != uuid) && (null != UUID.valueOf(uuid));
        } catch (NumberFormatException e) {
            // return false
        }
        return false;
    }
1167631
def Uuid(to_uuid=True):
    
    @wraps(Uuid)
    def built(value):
        invalid = Error("Not a valid UUID")

        if isinstance(value, uuid.UUID):
            return value
        elif not isinstance(value, six.string_types):
            raise invalid

        try:
            as_uuid = uuid.UUID(value)
        except (ValueError, AttributeError) as e:
            raise invalid

        if to_uuid:
            return as_uuid
        return value
    return built
521429
private void validate(File root, Collection<URI> dirs) throws IOException {
    if (dirs == null)
      return;
    for (URI dir : dirs) {
      if (new File(dir.getPath()).getAbsolutePath().equals(
          root.getAbsolutePath())) {
        // we found the corresponding entry
        return;
      }
    }
    throwIOException("Error. Storage directory: " + root
        + " is not in the configured list of storage directories: " + dirs);
  }
1341884
def validate(self, arg=None):
        """"""
        if os.path.isdir(self.path):
            self.validator.object = None
        else:
            self.validator.object = ICONS['error']
180930
function hasValidToken (storageLocation) {
	var token = getStoredToken(storageLocation);
	if (token) {
		try {
			var payload = decode(token);
			return payloadIsValid(payload);
		} catch (error) {
			return false;
		}
	}
	return false;
}
916518
def validate(self, **kwargs):
        '''
        '''

        self._set_attributes(**kwargs)
        self._check_type()
        self.dev_group_uri_res = self._get_device_group(self.devices[0])
        if self.dev_group_uri_res.type != self.type:
            msg = 'Device group type found: %r does not match expected ' \
                'device group type: %r' % (
                    self.dev_group_uri_res.type, self.type
                )
            raise UnexpectedDeviceGroupType(msg)
        queried_device_names = self._get_device_names_in_group()
        given_device_names = []
        for device in self.devices:
            device_name = get_device_info(device).name
            given_device_names.append(device_name)
        if sorted(queried_device_names) != sorted(given_device_names):
            msg = 'Given devices does not match queried devices.'
            raise UnexpectedDeviceGroupDevices(msg)
        self.ensure_all_devices_in_sync()