Importing, replacing, and deleting nodes
Along with creating and connecting nodes, it's often necessary to replace and delete nodes from a flow. The methods that are available for importing, replacing, and deleting nodes are summarized in the following table.
Method | Return type | Description |
---|---|---|
s.replace(originalNode, replacementNode,
discardOriginal) |
Not applicable | Replaces the specified node from the specified flow. Both the original node and replacement node must be owned by the specified flow. |
s.insert(source, nodes, newIDs) |
List | Inserts copies of the nodes in the supplied list. It's assumed that all nodes
in the supplied list are contained within the specified flow. The newIDs flag
indicates whether new IDs should be generated for each node, or whether the existing ID should be
copied and used. It's assumed that all nodes in a flow have a unique ID, so this flag must be set to
True if the source flow is the same as the specified flow. The method returns the
list of newly inserted nodes, where the order of the nodes is undefined (that is, the ordering is
not necessarily the same as the order of the nodes in the input list). |
s.delete(node) |
Not applicable | Deletes the specified node from the specified flow. The node must be owned by the specified flow. |
s.deleteAll(nodes) |
Not applicable | Deletes all the specified nodes from the specified flow. All nodes in the collection must belong to the specified flow. |
s.clear() |
Not applicable | Deletes all nodes from the specified flow. |