Re-adds the value of a specific key in the dict, only in case of valid str value.
164238
def _str_elem(config, key):

    '''
    
    '''

    _value = config.pop(key, '')
    if _valid_str(_value):
        config[key] = _value
6902
def insert(self, value):
        ""
        key = str(uuid4())
        self.set(key, value)
        return key
456733
def add(self, value):
        """"""
        # Raise TypeError if value is not hashable
        hash(value)

        self.redis.sadd(self.key, self._pickle(value))
966592
def add(self, name, value):
        # type: (str, str) -> None
        """"""
        self._last_key = name
        if name in self:
            self._dict[name] = value
            self._as_list[name].append(value)
        else:
            self[name] = value
204507
def prepend(self, key, value, cas=0, format=None,
                persist_to=0, replicate_to=0):
        
        return _Base.prepend(self, key, value, cas=cas, format=format,
                             persist_to=persist_to, replicate_to=replicate_to)
344261
def _dict_set(self, key, val):
        '''
        
        '''
        if key != None and self.stringify_keys:
            key = str(key)
        db = self._keyed_db[self.split_func(key)]
        db._dict_set(key, val)
608916
def put_(keyname, val):
    '''
    
    '''
    mdata = _check_mdata_put()
    ret = {}

    if mdata:
        cmd = 'echo {2} | {0} {1}'.format(mdata, keyname, val)
        ret = __salt__['cmd.run_all'](cmd, python_shell=True, ignore_retcode=True)

    return ret['retcode'] == 0
224882
def append(self, value):
        
        self.count += 1

        if self.count == 1:
            self.old_m = self.new_m = value
            self.old_s = 0
        else:
            self.new_m = self.old_m + (value - self.old_m) / self.count
            self.new_s = self.old_s + (value - self.old_m) * (value - self.new_m)

            self.old_m = self.new_m
            self.old_s = self.new_s
963581
def modifie(self, key: str, value: Any) -> None:
        """"""
        if key in self.FIELDS_OPTIONS:
            self.modifie_options(key, value)
        else:
            self.modifications[key] = value
602378
def additem(self, key, value):
        
        if key in self._position:
            raise KeyError('%s is already in the queue' % repr(key))
        self[key] = value
342187
def update(self, value):
        
        key = self.name

        # if it's a variable name (otherwise a constant)
        if isinstance(key, str):
            self.env.swapkey(self.local_name, key, new_value=value)

        self.value = value
1173498
def modify(key, value, tree)
      # if already set, just change value
      return false unless tree[key]

      tree[key] = value
      true
    end
1130794
def _update_nested(key, val, data, allow_overwriting=False):
    
    if isinstance(val, dict):
        for sub_key, sub_val in val.items():
            data = _update_nested(key + [sub_key], sub_val, data, allow_overwriting=allow_overwriting)
    else:
        already_there = tz.get_in(key, data) is not None
        if already_there and val:
            if not allow_overwriting:
                raise ValueError("Duplicated key %s: %s and %s" % (key, val, tz.get_in(key, data)))
            else:
                already_there = False
        if val or not already_there:
            data = tz.update_in(data, key, lambda x: val)
    return data
462949
private static void appendKeyValue(StringBuffer str, String key, String value) {

        str.append(key);
        if (value == IS_USED) {
            str.append(";");
        } else {
            str.append("=(");
            str.append(value);
            str.append(");");
        }
    }
530123
def coerce(cls, key, value):
        """"""

        if not isinstance(value, MutableDict):
            if isinstance(value, dict):
                return MutableDict(value)
            elif isinstance(value, six.string_types):
                # Assume JSON string
                if value:
                    return MutableDict(simplejson.loads(value, use_decimal=True))
                else:
                    return MutableDict()  # Empty value is an empty dict

            # this call will raise ValueError
            return Mutable.coerce(key, value)
        else:
            return value
1337950
def add(self, key, val):
        
        key_lower = key.lower()
        new_vals = [key, val]
        # Keep the common case aka no item present as fast as possible
        vals = self._container.setdefault(key_lower, new_vals)
        if new_vals is not vals:
            vals.append(val)
794874
def rename_key(d: Dict[str, Any], old: str, new: str) -> None:
    
    d[new] = d.pop(old)