Using the context manager on a ListDatabase converts it to a dict:
>>> a = livejson.ListDatabase("a.json")
>>> a
[]
>>> with a:
... a.append(0)
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_abcoll.py", line 659, in append
self.insert(len(self), value)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/livejson.py", line 265, in insert
data.insert(index, value)
AttributeError: 'dict' object has no attribute 'insert'
>>> a
{}
Using the context manager on a
ListDatabaseconverts it to adict: