Mercurial > cpython-lru_cache-weakref
annotate Lib/idlelib/RemoteObjectBrowser.py @ 79691:05c8928362ee
Merge __next__ method link fixes with 3.3.
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Fri, 12 Oct 2012 13:46:37 +0300 |
| parents | bfa5835e10f0 |
| children |
| rev | line source |
|---|---|
|
42714
2ec16b6b4d04
Switch to absolute imports to support direct execution of modules. Many
Kurt B. Kaiser <kbk@shore.net>
parents:
42507
diff
changeset
|
1 from idlelib import rpc |
| 23547 | 2 |
| 3 def remote_object_tree_item(item): | |
| 4 wrapper = WrappedObjectTreeItem(item) | |
| 5 oid = id(wrapper) | |
| 6 rpc.objecttable[oid] = wrapper | |
| 7 return oid | |
| 8 | |
| 9 class WrappedObjectTreeItem: | |
| 10 # Lives in PYTHON subprocess | |
| 11 | |
| 12 def __init__(self, item): | |
| 13 self.__item = item | |
| 14 | |
| 15 def __getattr__(self, name): | |
| 16 value = getattr(self.__item, name) | |
| 17 return value | |
| 18 | |
| 19 def _GetSubList(self): | |
|
67816
bfa5835e10f0
#11069: fix the IDLE Stack Viewer, by not using "list" as a variable name.
Georg Brandl <georg@python.org>
parents:
42714
diff
changeset
|
20 sub_list = self.__item._GetSubList() |
|
bfa5835e10f0
#11069: fix the IDLE Stack Viewer, by not using "list" as a variable name.
Georg Brandl <georg@python.org>
parents:
42714
diff
changeset
|
21 return list(map(remote_object_tree_item, sub_list)) |
| 23547 | 22 |
| 23 class StubObjectTreeItem: | |
| 24 # Lives in IDLE process | |
| 25 | |
| 26 def __init__(self, sockio, oid): | |
| 27 self.sockio = sockio | |
| 28 self.oid = oid | |
| 29 | |
| 30 def __getattr__(self, name): | |
| 31 value = rpc.MethodProxy(self.sockio, self.oid, name) | |
| 32 return value | |
| 33 | |
| 34 def _GetSubList(self): | |
|
67816
bfa5835e10f0
#11069: fix the IDLE Stack Viewer, by not using "list" as a variable name.
Georg Brandl <georg@python.org>
parents:
42714
diff
changeset
|
35 sub_list = self.sockio.remotecall(self.oid, "_GetSubList", (), {}) |
|
bfa5835e10f0
#11069: fix the IDLE Stack Viewer, by not using "list" as a variable name.
Georg Brandl <georg@python.org>
parents:
42714
diff
changeset
|
36 return [StubObjectTreeItem(self.sockio, oid) for oid in sub_list] |
