Helper function for checking a given `key`.
189567
function hasKey(key) {
    return data.meta[key] !== undefined
      && (self.lookup[key] === null ||
      self.lookup[key] === data.meta[key]);
  }
733699
def validate(self, key, value):
    """"""
    if self._validator is not None:
      self._validator(key, value)
797543
def check_key(key, allowed):
    

    if key in allowed:
        return True

    for pattern in allowed:
        if fnmatch(key, pattern):
            return True

    return False
1100596
def is_valid_key(key):
    

    if PY3 and isinstance(key, bytes):
        raise TypeError("needs to be str not bytes")

    for c in key:
        if c < " " or c > "}" or c == "=":
            return False
    else:
        return bool(key)
580536
public boolean containsKey(Object key) {
        if (key instanceof Number) {
            return containsKey( ((Number)key).intValue() );
        }
        else {
            return false;
        }
    }
1234989
function getkey(key) {
        var parsedKey = Number(key);

        return (isNaN(parsedKey) || key.indexOf('.') !== -1)? key : parsedKey;
    }
727355
def validate_key(key):
    
    if len(key.split()) != 2:
        raise ValueError("'{}' is not in the form '(key) (mode)'".format(key))
    key, mode = key.split()
    if key.lower() not in KEY_TO_SEMITONE:
        raise ValueError(
            "Key {} is invalid; should be e.g. D or C# or Eb".format(key))
    if mode not in ['major', 'minor']:
        raise ValueError(
            "Mode '{}' is invalid; must be 'major' or 'minor'".format(mode))
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))
954766
def has_key(self, key):
        """"""
        try:
            if type(self.attrs) == dict:
                return key in self.attrs
            else:
                raise AttributeError    # if attrs is not a dict
        except AttributeError:          # if attrs doesnt exist
            raise NotImplementedError
677486
function hasKey (obj, keys) {
    let o = obj;
    keys.slice(0,-1).forEach(function (key) {
        o = (o[key] || {});
    });

    let key = keys[keys.length - 1];
    return key in o;
}
1029025
def check_index(self, key, *, index):
        
        self.append({
            "Verb": "check-index",
            "Key": key,
            "Index": extract_attr(index, keys=["ModifyIndex", "Index"])
        })
        return self
936166
def check_key!(key)
      return if key.is_a?(String) || key.is_a?(Symbol)
      raise TypeError, 'key must be a String or Symbol'
    end
797668
def is_key(cls, result):
        """"""
        from boto.gs.key import Key

        return isinstance(result, Key)
70324
private char checkKey(Object key) {
	if (key == null) {
	    throw new NullPointerException("key cannot be null");
	} else if (!(key instanceof Character)) {
	    throw new IllegalArgumentException("key must be an Character");
	}
	else {
	    return ((Character)key).charValue();
	}
    }
179473
function validateKey(key, flags, version) {
  assert(Buffer.isBuffer(key));
  assert(typeof flags === 'number');
  assert(typeof version === 'number');

  if (flags & Script.flags.VERIFY_STRICTENC) {
    if (!common.isKeyEncoding(key))
      throw new ScriptError('PUBKEYTYPE');
  }

  if (version === 1) {
    if (flags & Script.flags.VERIFY_WITNESS_PUBKEYTYPE) {
      if (!common.isCompressedEncoding(key))
        throw new ScriptError('WITNESS_PUBKEYTYPE');
    }
  }

  return true;
}
863533
def warn(self, key):
        """"""
        return (not self.quiet and not self.warn_none and
                (self.warn_all or getattr(self, "warn_%s" % key)))
449293
def is_ready(self, key):
        """"""
        if self.pending_callbacks is None or key not in self.pending_callbacks:
            raise UnknownKeyError("key %r is not pending" % (key,))
        return key in self.results