summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2014-06-20 14:11:20 +0100
committerJosé Fonseca <jfonseca@vmware.com>2014-06-24 16:30:34 +0100
commit01fc85bb71cb7518f17ca789429f137727970737 (patch)
tree1e472d5d2cf5c5b345fb9529692f54cc11e6aa46 /scripts
parenta0a2044e3431cd16c1804d33bacaf414e62396a2 (diff)
cli/pickle: Pass structures as dictionaries.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/unpickle.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/unpickle.py b/scripts/unpickle.py
index 0249e4b7..5fe40f59 100755
--- a/scripts/unpickle.py
+++ b/scripts/unpickle.py
@@ -105,7 +105,7 @@ class Visitor:
return self.visitIterable(obj)
def visitDict(self, obj):
- raise NotImplementedError
+ return self.visitIterable(obj)
def visitByteArray(self, obj):
raise NotImplementedError
@@ -132,6 +132,12 @@ class Dumper(Visitor):
return '&' + self.visit(obj[0])
return '{' + ', '.join(itertools.imap(self.visit, obj)) + '}'
+ def visitItems(self, items):
+ return ', '.join(['%s = %s' % (name, self.visit(value)) for name, value in items])
+
+ def visitDict(self, obj):
+ return '{' + self.visitItems(obj.iteritems()) + '}'
+
def visitByteArray(self, obj):
return 'blob(%u)' % len(obj)