def replace_edge_from(self, from_node, old_to, new_to, **kw):
        """ Replaces the edge (*from_node*, *old_to*) with
        (*from_node*, *new_to*), optionally with the attributes
        provided by the keyword arguments.

        :Exceptions:
            ValueError
                If the existing edge does not exist, or the new edge already exists.
        """
        if not self.has_edge(from_node, old_to):
            raise ValueError('%s has no edge to %s.' % (from_node, old_to))
        if self.has_edge(from_node, new_to):
            # Since this isn't a multi-graph:
            raise ValueError((from_node, new_to) % '%s already has an edge to %s.')

        self._ensure_ordered_dicts_for_node(new_to)
        self.succ[from_node].replace_key(old_to, new_to, kw)
        self.pred[new_to][from_node] = kw
        del self.pred[old_to][from_node]
dataset/ETHPy150Open foundit/Piped/piped/graph.py/DirectedGraphWithOrderedEdges.replace_edge_from/swapped operands of `%`