Check for unknown keys.
773186
def load_unknown_fields(self, data, original_data):
        """"""
        if isinstance(original_data, list):
            for elem in original_data:
                self.load_unknown_fields(data, elem)
        else:
            for key, value in original_data.items():
                if key not in data:
                    data[key] = value
        return data
10298
def has_key(cls, *args):
        
        key = args if len(args) > 1 else args[0]
        return key in cls._instances
740138
public function validateKeys($_)
    {
        $keys = $this->getKeyArguments(func_get_args());

        if (! $this->hasKey($keys)) {
            throw new KeyNotFoundException(
                sprintf(
                    _('The configuration key %1$s does not exist.'),
                    implode('->', $keys)
                )
            );
        }

        return $keys;
    }
1112629
def error_keys_not_found(self, keys):
        
        try:
            log.error("Filename: {0}".format(self['meta']['location']))
        except:
            log.error("Filename: {0}".format(self['location']))
        log.error("Key '{0}' does not exist".format('.'.join(keys)))
        indent = ""
        last_index = len(keys) - 1
        for i, k in enumerate(keys):
            if i == last_index:
                log.error(indent + k + ": <- this value is missing")
            else:
                log.error(indent + k + ":")
            indent += "    "
282511
def validate_obj(keys, obj):
    """"""
    msg = ''
    for k in keys:
        if isinstance(k, str):
            if k not in obj or (not isinstance(obj[k], list) and not obj[k]):
                if msg:
                    msg = "%s," % msg

                msg = "%s%s" % (msg, k)
        elif isinstance(k, list):
            found = False
            for k_a in k:
                if k_a in obj:
                    found = True

            if not found:
                if msg:
                    msg = "%s," % msg

                msg = "%s(%s" % (msg, ','.join(k))

    if msg:
        msg = "%s missing" % msg

    return msg
727275
def show(all_keys):
    """"""
    if not config_file_exists():
        echo_info('No config file found! Please try `ddev config restore`.')
    else:
        if all_keys:
            echo_info(read_config_file().rstrip())
        else:
            echo_info(read_config_file_scrubbed().rstrip())
1319137
function guessType (key) {
    var type = 'boolean'

    if (checkAllAliases(key, flags.strings)) type = 'string'
    else if (checkAllAliases(key, flags.numbers)) type = 'number'
    else if (checkAllAliases(key, flags.arrays)) type = 'array'

    return type
  }
53068
def _assert_keys_match(keys1, keys2):
  """"""
  if set(keys1) != set(keys2):
    raise ValueError('{} {}'.format(list(keys1), list(keys2)))
133490
def check_keyname(self, rule):
        """"""

        keynames = rule.get('keynames')
        if not keynames:
            self.logdebug('no keynames requirement.\n')
            return True
        if not isinstance(keynames, list):
            keynames = [keynames]

        if self.keyname in keynames:
            self.logdebug('keyname "%s" matches rule.\n' % self.keyname)
            return True
        else:
            self.logdebug('keyname "%s" does not match rule.\n' % self.keyname)
            return False
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
1246592
def _validate_key(self, key):
        """"""
        return not any([key.startswith(i) for i in self.EXCEPTIONS])
1061026
function checkKeyCodes (
  eventKeyCode,
  key,
  builtInAlias
) {
  var keyCodes = config.keyCodes[key] || builtInAlias;
  if (Array.isArray(keyCodes)) {
    return keyCodes.indexOf(eventKeyCode) === -1
  } else {
    return keyCodes !== eventKeyCode
  }
}
88306
def _check_attributes(self, attributes, extra=None):
        """"""
        extra = extra or ()
        unknown_keys = set(attributes) - set(self._possible_attributes) - set(extra)
        if unknown_keys:
            logger.warning('%s got unknown attributes: %s' %
                            (self.__class__.__name__, unknown_keys))
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
860466
def displayNewKey(key):
    """"""

    if key.keyring:
        gpg.keyring = key.keyring
    if key.secring:
        gpg.secring = key.secring

    # Using '--fingerprint' twice will display subkey fingerprints too:
    gpg.options = ['--fingerprint', '--fingerprint']
    keylist = gpg.list_keys(secret=True)

    # `result` is a `gnupg._parsers.ListKeys`, which is list-like, so iterate
    # over all the keys and display their info:
    for gpgkey in keylist:
        for k, v in gpgkey.items():
            log.info("%s: %s" % (k.capitalize(), v))

    return keylist
515112
def check_validity_for_dict(keys, dict):
    
    for key in keys:
        if key not in dict or dict[key] is '' or dict[key] is None:
            return False
    return True
186672
def missingkeys_nonstandard(block, commdct, dtls, objectlist, afield='afiled %s'):
    """"""
    afield = 'afield %s'
    for key_txt in objectlist:
        key_i = dtls.index(key_txt.upper())
        comm = commdct[key_i]
        if block:
            blk = block[key_i]
        for i, cmt in enumerate(comm):
            if cmt == {}:
                first_i = i
                break
        for i, cmt in enumerate(comm):
            if i >= first_i:
                if block:
                    comm[i]['field'] = ['%s' % (blk[i])]
                else:
                    comm[i]['field'] = [afield % (i - first_i + 1,),]