Preserve unknown keys during deserialization.
506134
def _handle_load_unknown(self, data, original):
        """"""
        for key, val in original.items():
            if key not in self.fields:
                data[key] = val
        return data
885135
private Set<String> getNotNullExtraKeys(Node actual, Set<String> extraKeys) {
        Set<String> notNullExtraKeys = new TreeSet<>();
        for (String extraKey : extraKeys) {
            if (!actual.get(extraKey).isNull()) {
                notNullExtraKeys.add(extraKey);
            }
        }
        return notNullExtraKeys;
    }
354084
def _encode_key(self, obj):
        """"""

        if obj.__class__ is str:
            return self._encode_str(obj)

        if obj.__class__ is UUID:
            return '"' + str(obj) + '"'

        # __mm_serialize__ is called before any isinstance checks (but after exact type checks)
        try:
            sx_encoder = obj.__mm_serialize__
        except AttributeError:
            pass
        else:
            try:
                data = sx_encoder()
            except NotImplementedError:
                pass
            else:
                return self._encode_key(data)

        if isinstance(obj, UUID):
            return '"' + str(obj) + '"'

        if isinstance(obj, str):
            return self._encode_str(obj)

        # if everything else failed try the default() method and re-raise any TypeError
        # exceptions as more specific "not a valid dict key" TypeErrors
        try:
            value = self.default(obj)
        except TypeError:
            raise TypeError('{!r} is not a valid dictionary key'.format(obj))

        return self._encode_key(value)
919107
def clean_dict_keys(d):
    
    new_d = {}
    for (k, v) in d.iteritems():
        new_d[str(k)] = v
    return new_d
1013697
def filter_out_none_valued_keys(self, d):
        # type: (typing.Dict[K, V]) -> typing.Dict[K, V]
        """"""
        new_d = {}
        for k, v in d.items():
            if v is not None:
                new_d[k] = v
        return new_d
1091107
def unmarshall_key(self, key, cls):
        """"""
        return setattr(cls, key, self.get(key))
696387
private WrappedByteArray deserializeObj(String key) throws Exception {
      byte[] data = Base64.getDecoder().decode(key);
      return new WrappedByteArray(data);
   }
507962
def _warn_key_unknown(cls, cls_context, key):
        

        context_name = cls_context.__name__
        warnings.warn(cls._WARNING_KEY_UNKNOWN.format(key, context_name))
897048
def _calculateEncodingKey(comparator):
    
    encodingName = None
    for k, v in list(_encodings.items()):
        if v == comparator:
            encodingName = k
            break
    return encodingName
1091354
def _normalize_keys(self, data):
        
        encode = self.encoder.encode
        decode = self.encoder.decode
        return {decode(encode(k)): v for k, v in iteritems(data)}
653399
def deserialize(cls, serialized):
        ''' 
        '''
        return PublicKey(
            nacl.public.PublicKey(serialized,
                                  encoder=nacl.encoding.Base64Encoder))
1295860
def sanitize_dict(input_dict):
    
    """
    plain_dict = dict()
    for key in input_dict.keys():
        value = input_dict[key]
        if hasattr(value, 'keys'):
            plain_dict[key] = sanitize_dict(value)
        else:
            plain_dict[key] = value
    return plain_dict
642850
def deserialize(cls, assoc_s):
        
        pairs = kvform.kvToSeq(assoc_s, strict=True)
        keys = []
        values = []
        for k, v in pairs:
            keys.append(k)
            values.append(v)

        if keys != cls.assoc_keys:
            raise ValueError('Unexpected key values: %r', keys)

        version, handle, secret, issued, lifetime, assoc_type = values
        if version != '2':
            raise ValueError('Unknown version: %r' % version)
        issued = int(issued)
        lifetime = int(lifetime)
        secret = oidutil.fromBase64(secret)
        return cls(handle, secret, issued, lifetime, assoc_type)
1146834
function serializeKey( name ) {
   const identifier = /^[A-Za-z$_][A-Za-z0-9$_]*$/.test( name );
   const keyword = [
      'if', 'else',
      'switch', 'case', 'default',
      'try', 'catch', 'finally',
      'function', 'return',
      'var', 'let', 'const'
   ].indexOf( name ) >= 0;

   return ( identifier && !keyword ) ? name : `"${name}"`;
}
604901
def _ignore_keys(endpoint_props):
    '''
    
    '''
    return dict(
        (prop_name, prop_val)
        for prop_name, prop_val in six.iteritems(endpoint_props)
        if prop_name not in _DO_NOT_COMPARE_FIELDS
    )
1365401
private byte[] getByteKey(K key){
		if(key instanceof String){
			String preKey = this.keyPrefix + key;
    		return preKey.getBytes();
    	}else{
    		return SerializeUtils.serialize(key);
    	}
	}
952863
def _DecodeUnrecognizedFields(message, pair_type):
    """"""
    new_values = []
    codec = _ProtoJsonApiTools.Get()
    for unknown_field in message.all_unrecognized_fields():
        # TODO(craigcitro): Consider validating the variant if
        # the assignment below doesn't take care of it. It may
        # also be necessary to check it in the case that the
        # type has multiple encodings.
        value, _ = message.get_unrecognized_field_info(unknown_field)
        value_type = pair_type.field_by_name('value')
        if isinstance(value_type, messages.MessageField):
            decoded_value = DictToMessage(value, pair_type.value.message_type)
        else:
            decoded_value = codec.decode_field(
                pair_type.value, value)
        try:
            new_pair_key = str(unknown_field)
        except UnicodeEncodeError:
            new_pair_key = protojson.ProtoJson().decode_field(
                pair_type.key, unknown_field)
        new_pair = pair_type(key=new_pair_key, value=decoded_value)
        new_values.append(new_pair)
    return new_values