Rev 155: Commit to using the proxy implentation, fix the test suite. in http://bazaar.launchpad.net/~jameinel/meliae/mem-object-collection
John Arbash Meinel
john at arbash-meinel.com
Tue Dec 29 20:37:37 GMT 2009
At http://bazaar.launchpad.net/~jameinel/meliae/mem-object-collection
------------------------------------------------------------
revno: 155
revision-id: john at arbash-meinel.com-20091229203715-0lu6cshqg59ac54w
parent: john at arbash-meinel.com-20091229155946-18hvabfyjvs39m59
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: mem-object-collection
timestamp: Tue 2009-12-29 14:37:15 -0600
message:
Commit to using the proxy implentation, fix the test suite.
-------------- next part --------------
=== modified file 'meliae/loader.py'
--- a/meliae/loader.py 2009-12-29 15:59:46 +0000
+++ b/meliae/loader.py 2009-12-29 20:37:15 +0000
@@ -285,10 +285,11 @@
"""
source = lambda:self.objs.itervalues()
total_objs = len(self.objs)
+ # Add the 'null' object
+ self.objs.add(0, '<ex-reference>', 0, [])
for changed, obj in remove_expensive_references(source, total_objs,
self.show_progress):
- if changed:
- self.objs[obj.address] = obj
+ continue
def _compute_total_size(self, obj):
pending_descendents = list(obj.ref_list)
@@ -398,7 +399,8 @@
continue
(dict_ref, type_ref) = obj.ref_list
type_obj = self.objs[type_ref]
- if type_obj.type_str != 'type' or type_obj.name != obj.type_str:
+ if (type_obj.type_str != 'type'
+ or type_obj.value != obj.type_str):
continue
extra_refs = [type_ref]
dict_obj = self.objs[dict_ref]
@@ -561,7 +563,7 @@
% (line_num, len(objs), mb_read, input_mb, tdelta))
-def _load_moc(source, using_json, show_prog, input_size):
+def _load(source, using_json, show_prog, input_size):
objs = _loader.MemObjectCollection()
for memobj in iter_objs(source, using_json, show_prog, input_size, objs,
factory=objs.add):
@@ -570,16 +572,6 @@
return ObjManager(objs, show_progress=show_prog)
-def _load(source, using_json, show_prog, input_size):
- objs = {}
- for memobj in iter_objs(source, using_json, show_prog, input_size, objs):
- objs[memobj.address] = memobj
- # _fill_total_size(objs)
- return ObjManager(objs, show_progress=show_prog)
-
-_load = _load_moc
-
-
def remove_expensive_references(source, total_objs=0, show_progress=False):
"""Filter out references that are mere houskeeping links.
=== modified file 'meliae/tests/test_loader.py'
--- a/meliae/tests/test_loader.py 2009-12-29 04:59:10 +0000
+++ b/meliae/tests/test_loader.py 2009-12-29 20:37:15 +0000
@@ -99,7 +99,7 @@
keys = objs.keys()
self.assertEqual([1234], keys)
obj = objs[1234]
- self.assertTrue(isinstance(obj, _loader.MemObject))
+ self.assertTrue(isinstance(obj, _loader._MemObjectProxy))
# The address should be exactly the same python object as the key in
# the objs dictionary.
self.assertTrue(keys[0] is obj.address)
More information about the bazaar-commits
mailing list