Validate the manditory keys.
482341
def _validate_mandatory_keys(mandatory, validated, data, to_validate):
    """"""
    errors = []
    for key, sub_schema in mandatory.items():
        if key not in data:
            errors.append('missing key: %r' % (key,))
            continue
        try:
            validated[key] = sub_schema(data[key])
        except NotValid as ex:
            errors.extend(['%r: %s' % (key, arg) for arg in ex.args])
        to_validate.remove(key)
    return errors
127685
def _validate_password(self, password):
		""""""
		self.password = password
		if password is None:
			raise errors.AuthError('Missing password')
		keyHash = self.info.get('keyHash', None)
		if keyHash is None and self.password is None:
			return True
		if keyHash is None:
			raise errors.AuthError('Invalid keyHash')
		if self.password is None:
			raise errors.AuthError('Missing password')

		keyHashAlgorithmID = self.info.get('keyHashAlgorithmID','MD5')

		password = self.password.encode('utf8')
		saltHash = self._decode_hex(self.info['salt'])

		keyBasis = password + saltHash
		self.key = self.hash_algo[keyHashAlgorithmID](keyBasis).digest()
		keyHash = self.hash_algo[keyHashAlgorithmID](self.key).hexdigest()

		if not keyHash.upper() == self.info['keyHash'].upper():
			raise errors.AuthError('Invalid Hash')
		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)
                        )
183081
def _validate(self):
        
        # This could be done with a default config

        # Check that specific keys exist
        sections = odict([
                ('catalog',['dirname','basename',
                            'lon_field','lat_field','objid_field',
                            'mag_1_band', 'mag_1_field', 'mag_err_1_field',
                            'mag_2_band', 'mag_2_field', 'mag_err_2_field',
                            ]),
                ('mask',[]),
                ('coords',['nside_catalog','nside_mask','nside_likelihood',
                           'nside_pixel','roi_radius','roi_radius_annulus',
                           'roi_radius_interior','coordsys',
                           ]),
                ('likelihood',[]),
                ('output',[]),
                ('batch',[]),
                ])  

        keys = np.array(list(sections.keys()))
        found = np.in1d(keys,list(self.keys()))

        if not np.all(found):
            msg = 'Missing sections: '+str(keys[~found])
            raise Exception(msg)

        for section,keys in sections.items():
            keys = np.array(keys)
            found = np.in1d(keys,list(self[section].keys()))
            if not np.all(found):
                msg = 'Missing keys in %s: '%(section)+str(keys[~found])
                raise Exception(msg)
166644
def _check_valid_key(self, key):
        
        if not isinstance(key, key_type):
            raise ValueError('%r is not a valid key type' % key)
        if not VALID_KEY_RE.match(key):
            raise ValueError('%r contains illegal characters' % key)
10859
private static void validateKey(String key) {
		if (key == null || key.length() > MAX_KEY_SIZE) {
			throw new IllegalArgumentException("Invalid key - must be non null and have a length less than " + MAX_KEY_SIZE);
		}
	}
306326
def keys_are_valid(self, tag_value):
        """"""
        for key in ScheduleParser.raw_data(tag_value):
            if key not in ('on', 'off', 'tz'):
                return False
        return True
1101139
def _validated(self, values):
        """"""
        if self.length != len(values):
            raise NotValid(
                "%r does not have exactly %d values. (Got %d.)" % (
                    values, self.length, len(values)))
        return type(self.schemas)(
            self.schemas[i].validate(v) for i, v in enumerate(values))
361881
def validate_one(cls, keystr):
        
        regex = r'%s$' % cls.ALLOWED_KEY
        if re.match(regex, keystr) is None:
            raise cls.Bad("Bad key syntax for: %s. Should be: key1.key2..." % (keystr))

        return True
1239508
def assert_valid(key, value)
      validators[key].each do |validator|
        validator.call(key, value)
      end
    end
59454
def validate(self):
        """"""
        super().validate()
        nb_entities = len(self.entities)
        if nb_entities != self.rows:
            raise self.error(
                'Number of entities: %s != number of rows: %s' % (
                    nb_entities, self.rows))
244597
protected static function parseValidKeys()
    {
        if (self::$validOptions !== null) {
            return;
        }

        $refl = new ReflectionClass('\ZMQ');
        $const = $refl->getConstants();
        self::$validOptions = array();
        foreach ($const as $key => $value) {
            if (substr($key, 0, 8) == 'SOCKOPT_') {
                self::$validOptions[$value] = '\ZMQ::'.$key;
            }
        }
    }
757120
def _check_valid_key(self, key):
        
        if not isinstance(key, key_type) and key is not None:
            raise ValueError('%r is not a valid key type' % key)
        if not VALID_KEY_RE_EXTENDED.match(key) or key == u'/':
            raise ValueError('%r contains illegal characters' % key)
183620
def validate_key(key_path):
    

    key_path = os.path.expanduser(key_path)

    if not os.path.isfile(key_path):
        return False

    return paramiko.RSAKey.from_private_key_file(key_path)
837284
def check_obj(keys, name, obj):
    """"""
    msg = validate_obj(keys, obj)

    if msg:
        raise aomi.exceptions.AomiData("object check : %s in %s" % (msg, name))
1193967
def validate(self):
        """"""
        depr = self._all_deprecated
        return dict((key, val[1]) for key, val in
                    six.iteritems(self.defaultParams)
                    if key not in depr)
949405
def validate(self):
        """"""
        missing = []
        for k, v in self._map.items():
            attr = getattr(self, k, False)
            if not attr or attr == CONFIG_PLACEHOLDER:
                missing.append(v)
        if missing:
            return "Missing or invalid config values: {}".format(
                ", ".join(sorted(missing))
            )