diff options
author | José Fonseca <jfonseca@vmware.com> | 2014-06-20 14:11:20 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2014-06-24 16:30:34 +0100 |
commit | 01fc85bb71cb7518f17ca789429f137727970737 (patch) | |
tree | 1e472d5d2cf5c5b345fb9529692f54cc11e6aa46 /scripts | |
parent | a0a2044e3431cd16c1804d33bacaf414e62396a2 (diff) |
cli/pickle: Pass structures as dictionaries.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/unpickle.py | 8 |
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) |