MCPcopy Create free account
hub / github.com/ActiveState/code / __swapValues

Method __swapValues

recipes/Python/577898_23_Tree/recipe-577898.py:282–286  ·  view source on GitHub ↗

Swap any two values in nodes

(self, node1, a1, node2, a2)

Source from the content-addressed store, hash-verified

280 return lS, lCnt, rS, rCnt
281
282 def __swapValues(self, node1, a1, node2, a2):
283 """ Swap any two values in nodes """
284 if node1 is not node2:
285 idx1, idx2 = node1.values.index(a1), node2.values.index(a2)
286 node1.values[idx1], node2.values[idx2] = node2.values[idx2], node1.values[idx1]
287
288 def __fixNodeRemove(self, node, parent = -1):
289

Callers 1

removeValueMethod · 0.95

Calls 1

indexMethod · 0.45

Tested by

no test coverage detected