MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / __pickleable

Method __pickleable

src/com/dtmilano/android/viewclient.py:4491–4514  ·  view source on GitHub ↗

Makes the tree pickleable.

(tree)

Source from the content-addressed store, hash-verified

4489
4490 @staticmethod
4491 def __pickleable(tree):
4492 """
4493 Makes the tree pickleable.
4494 """
4495
4496 def removeDeviceReference(view):
4497 """
4498 Removes the reference to a L{MonkeyDevice}.
4499 """
4500
4501 view.device = None
4502
4503 ###########################################################################################
4504 # FIXME: Unfortunately deepcopy does not work with MonkeyDevice objects, which is
4505 # sadly the reason why we cannot pickle the tree and we need to remove the MonkeyDevice
4506 # references.
4507 # We wanted to copy the tree to preserve the original and make piclkleable the copy.
4508 # treeCopy = copy.deepcopy(tree)
4509 treeCopy = tree
4510 # IMPORTANT:
4511 # This assumes that the first element in the list is the tree root
4512 ViewClient.__traverse(treeCopy[0], transform=removeDeviceReference)
4513 ###########################################################################################
4514 return treeCopy
4515
4516 def distanceTo(self, tree):
4517 """

Callers 2

distanceToMethod · 0.80
distanceMethod · 0.80

Calls 1

__traverseMethod · 0.80

Tested by

no test coverage detected