Replace a dict map, key to its value in the stirng
    :param subject_dict: dict
    :param string: string
    :return: string
4243
def dict_replace(subject_dict, string):
    
    for i, j in subject_dict.items():
        string = string.replace(i, j)
    return string
273020
def entities(self, subject_id):
        
        res = self._cache.get(subject_id)
        if not res:
            raise KeyError("No such subject")
        else:
            return res
898052
def to_obj(cls, obj_data=None, *fields, **field_map):
    '''  '''
    obj_dict = obj_data.__dict__ if hasattr(obj_data, '__dict__') else obj_data
    if not fields:
        fields = obj_dict.keys()
    obj = cls()
    update_obj(obj_dict, obj, *fields, **field_map)
    return obj
419813
public Subject replaceInvocationSubject(Subject invocationSubject) {
        SubjectThreadContext subjectThreadContext = getSubjectThreadContext();
        Subject replacedInvocationSubject = subjectThreadContext.getInvocationSubject();
        subjectThreadContext.setInvocationSubject(invocationSubject);
        return replacedInvocationSubject;
    }
680947
def update_dict(d, u):
    
    for key, val in u.items():
        if isinstance(val, collections.Mapping):
            d[key] = update_dict(d.get(key, {}), val)
        else:
            d[key] = u[key]
    return d
617344
def get_subject(self, data):
        
        if not isinstance(data, Mapping):
            return None
        if data.get(self.subject):
            return data.get(self.subject)
        return uuid.uuid4().urn
1042644
def get_subject_version(self, subject, version_id):
        
        res = requests.get(self._url('/subjects/{}/versions/{}', subject, version_id))
        raise_if_failed(res)
        return json.loads(res.json()['schema'])
100976
def _transform_key_value(self, key, value, map_dict):
        '''
        '''

        if key in self.tcl_list_patterns:
            value = self._parse_tcl_list(key, value)

        if key in map_dict:
            key = map_dict[key]

        return key, value
647385
def replace_keys(d, keymap, force_snake_case):
    
    return {
        to_snake(keymap.get(k, k)) if force_snake_case else keymap.get(k, k):
            v for k, v in d.items()
    }
889586
def dictlist_convert_to_string(dict_list: Iterable[Dict], key: str) -> None:
    
    for d in dict_list:
        d[key] = str(d[key])
        if d[key] == "":
            d[key] = None
116593
def to_dict(dictish):
    
    if hasattr(dictish, 'iterkeys'):
        m = dictish.iterkeys
    elif hasattr(dictish, 'keys'):
        m = dictish.keys
    else:
        raise ValueError(dictish)

    return dict((k, dictish[k]) for k in m())
69349
def register_subject_version(self, subject, schema):
        
        data = json.dumps({'schema': json.dumps(schema)})
        res = requests.post(self._url('/subjects/{}/versions', subject), data=data, headers=HEADERS)
        raise_if_failed(res)
        return res.json()['id']
118107
def _key_dot_replace(self, rdict):
        """"""
        temp_dict = {}
        for key, value in iteritems(rdict):
            if isinstance(value, dict):
                value = self._key_dot_replace(value)
            temp_dict[key.replace('.', '_')] = value
        return temp_dict
1018585
def format_subject(subject):
    
    subject_prefix_re = r'^Re\[(\d*)\]:\ '
    m = re.match(subject_prefix_re, subject, re.U)
    prefix = u""
    if subject.startswith('Re: '):
        prefix = u"[2]"
        subject = subject[4:]
    elif m is not None:
        try:
            num = int(m.group(1))
            prefix = u"[%d]" % (num+1)
            subject = subject[6+len(str(num)):]
        except:
            # if anything fails here, fall back to the old mechanism
            pass

    return ugettext(u"Re%(prefix)s: %(subject)s") % {
        'subject': subject,
        'prefix': prefix
    }
615382
def _dict_to_map_str_str(self, d):
        
        return dict(map(
            lambda (k, v): (k, str(v).lower() if isinstance(v, bool) else str(v)),
            d.iteritems()
        ))
1345733
def get(self, key, default=None):
        """"""
        try:
            return self.__dict__['overrides'][key]
        except KeyError:
            return self.__dict__['__subject'].get(key, default)
115967
private void replaceMapWithJsonObject(String claimName, JwtClaims claimsSet) {
        try {
            Map<String, Object> map = claimsSet.getClaimValue(claimName, Map.class);
            JsonObjectBuilder builder = Json.createObjectBuilder();
            for (Map.Entry<String, Object> entry : map.entrySet()) {
                builder.add(entry.getKey(), entry.getValue().toString());
            }
            JsonObject jsonObject = builder.build();
            claimsSet.setClaim(claimName, jsonObject);
        } catch (MalformedClaimException e) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "The value for the claim [" + claimName + "] could not be convered to a Map: " + e.getLocalizedMessage());
            }
        }
    }