Replace the key of an existing heap node in place. Raises ``KeyError``
        if the key to replace does not exist or if the new key is already in
        the pqdict.
433403
def replace_key(self, key, new_key):
        
        heap = self._heap
        position = self._position
        if new_key in self:
            raise KeyError('%s is already in the queue' % repr(new_key))
        pos = position.pop(key)  # raises appropriate KeyError
        position[new_key] = pos
        heap[pos].key = new_key
602378
def additem(self, key, value):
        
        if key in self._position:
            raise KeyError('%s is already in the queue' % repr(key))
        self[key] = value
253198
def update(self, key, value):
        
        if not is_string(key):
            raise Exception("Key must be string")

        # if len(key) > 32:
        #     raise Exception("Max key length is 32")

        if not is_string(value):
            raise Exception("Value must be string")

        # if value == '':
        #     return self.delete(key)
        self.root_node = self._update_and_delete_storage(
            self.root_node,
            bin_to_nibbles(to_string(key)),
            to_string(value))
        self._update_root_hash()
621523
def update(self, key_vals=None, overwrite=True):
        
        if not key_vals:
            return
        write_items = self._update(key_vals, overwrite)
        self._root._root_set(self._path, write_items)
        self._root._write(commit=True)
836415
def updateitem(self, key, new_val):
        
        if key not in self._position:
            raise KeyError(key)
        self[key] = new_val
1202149
def _update_heap(self, peer):
        """"""
        rank = self.rank_calculator.get_rank(peer)
        if rank == peer.rank:
            return

        peer.rank = rank
        self.peer_heap.update_peer(peer)
688610
public V replace(K key, V value) {
        V curValue;
        if (((curValue = get(key)) != null) || containsKey(key)) {
            curValue = put(key, value);
        }
        return curValue;
    }
1308919
function Replacement(nodePath, nodes) {
  this.queue = [];
  if (nodePath && nodes) {
    this.queue.push([nodePath, nodes]);
  }
}
1211249
def _rename_node(self, name, new_name):
        
        # Update parent
        if not self.is_root(name):
            parent = self._db[name]["parent"]
            self._db[parent]["children"].remove(name)
            self._db[parent]["children"] = sorted(
                self._db[parent]["children"] + [new_name]
            )
        # Update children
        iobj = self._get_subtree(name) if name != self.root_name else self.nodes
        for key in iobj:
            new_key = key.replace(name, new_name, 1)
            new_parent = (
                self._db[key]["parent"]
                if key == name
                else self._db[key]["parent"].replace(name, new_name, 1)
            )
            self._db[new_key] = {
                "parent": new_parent,
                "children": [
                    child.replace(name, new_name, 1)
                    for child in self._db[key]["children"]
                ],
                "data": copy.deepcopy(self._db[key]["data"]),
            }
            del self._db[key]
        if name == self.root_name:
            self._root = new_name
            self._root_hierarchy_length = len(
                self.root_name.split(self._node_separator)
            )
907169
def pop(self, key=util_const.NoParam, default=util_const.NoParam):
        
        # Dictionary pop if key is specified
        if key is not util_const.NoParam:
            if default is util_const.NoParam:
                return (key, self._dict.pop(key))
            else:
                return (key, self._dict.pop(key, default))
        # Otherwise do a heap pop
        try:
            # Ammortized O(1)
            _heap = self._heap
            _dict = self._dict
            val, key = self._heappop(_heap)
            # Remove items marked for lazy deletion as they are encountered
            while key not in _dict or _dict[key] != val:
                val, key = self._heappop(_heap)
        except IndexError:
            if len(_heap) == 0:
                raise IndexError('queue is empty')
            else:
                raise
        del _dict[key]
        return key, val
164257
def kreplace(self, key, value):
        
        for item in self:
            if key in item:
                item[key] = value
691616
def insert(self, key):
        
        # Create new node
        n = TreeNode(key)
        if not self.node:
            self.node = n
            self.node.left = AvlTree()
            self.node.right = AvlTree()
        elif key < self.node.val:
            self.node.left.insert(key)
        elif key > self.node.val:
            self.node.right.insert(key)
        self.re_balance()
21486
def remove(self, key):
        ''''''
        copydict = ImmutableDict()
        copydict.tree = self.tree.remove(hash(key))
        copydict._length = self._length - 1
        return copydict
999775
protected boolean replace(final K key, final boolean _compare, final V _oldValue, final V _newValue) {
    Entry e = lookupEntry(key);
    if (e == null) {
      metrics.peekMiss();
      return false;
    }
    synchronized (e) {
      e.waitForProcessing();
      if (e.isGone() || !e.hasFreshData(clock)) {
        return false;
      }
      if (_compare && !e.equalsValue(_oldValue)) {
        return false;
      }
      putValue(e, _newValue);
    }
    return true;
  }
1102737
def replace(parent, idx, value, check_value=_NO_VAL):
  """"""
  if isinstance(parent, dict):
    if idx not in parent:
      raise JSONPatchError("Item does not exist")
  elif isinstance(parent, list):
    idx = int(idx)
    if idx < 0 or idx >= len(parent):
      raise JSONPatchError("List index out of range")
  if check_value is not _NO_VAL:
    if parent[idx] != check_value:
      raise JSONPatchError("Check value did not pass")
  parent[idx] = value
469919
def update(self, other=None, **kwargs):
        ''''''
        copydict = ImmutableDict()
        if other:
            vallist = [(hash(key), (key, other[key])) for key in other]
        else: vallist = []
        if kwargs:
            vallist += [(hash(key), (key, kwargs[key])) for key in kwargs]
        copydict.tree = self.tree.multi_assoc(vallist)
        copydict._length = iter_length(copydict.tree)
        return copydict
549278
public boolean replace    ( TypeK  key, TypeV  oldValue, TypeV newValue ) {
    return putIfMatch( key, newValue, oldValue ) == oldValue;
  }