ยปCore Development>Code coverage>Lib/idlelib/debugobj_r.py

Python code coverage for Lib/idlelib/debugobj_r.py

#countcontent
1n/afrom idlelib import rpc
2n/a
3n/adef remote_object_tree_item(item):
4n/a wrapper = WrappedObjectTreeItem(item)
5n/a oid = id(wrapper)
6n/a rpc.objecttable[oid] = wrapper
7n/a return oid
8n/a
9n/aclass WrappedObjectTreeItem:
10n/a # Lives in PYTHON subprocess
11n/a
12n/a def __init__(self, item):
13n/a self.__item = item
14n/a
15n/a def __getattr__(self, name):
16n/a value = getattr(self.__item, name)
17n/a return value
18n/a
19n/a def _GetSubList(self):
20n/a sub_list = self.__item._GetSubList()
21n/a return list(map(remote_object_tree_item, sub_list))
22n/a
23n/aclass StubObjectTreeItem:
24n/a # Lives in IDLE process
25n/a
26n/a def __init__(self, sockio, oid):
27n/a self.sockio = sockio
28n/a self.oid = oid
29n/a
30n/a def __getattr__(self, name):
31n/a value = rpc.MethodProxy(self.sockio, self.oid, name)
32n/a return value
33n/a
34n/a def _GetSubList(self):
35n/a sub_list = self.sockio.remotecall(self.oid, "_GetSubList", (), {})
36n/a return [StubObjectTreeItem(self.sockio, oid) for oid in sub_list]