forked from M-Labs/artiq
protocols/pyon: remove FlatFileDB
This commit is contained in:
parent
741b11c26d
commit
8a912105cb
|
@ -202,23 +202,3 @@ def load_file(filename):
|
||||||
"""Parses the specified file and returns the decoded Python object."""
|
"""Parses the specified file and returns the decoded Python object."""
|
||||||
with open(filename, "r") as f:
|
with open(filename, "r") as f:
|
||||||
return decode(f.read())
|
return decode(f.read())
|
||||||
|
|
||||||
|
|
||||||
class FlatFileDB:
|
|
||||||
def __init__(self, filename):
|
|
||||||
self.filename = filename
|
|
||||||
self.data = pyon.load_file(self.filename)
|
|
||||||
|
|
||||||
def save(self):
|
|
||||||
pyon.store_file(self.filename, self.data)
|
|
||||||
|
|
||||||
def get(self, key):
|
|
||||||
return self.data[key]
|
|
||||||
|
|
||||||
def set(self, key, value):
|
|
||||||
self.data[key] = value
|
|
||||||
self.save()
|
|
||||||
|
|
||||||
def delete(self, key):
|
|
||||||
del self.data[key]
|
|
||||||
self.save()
|
|
||||||
|
|
Loading…
Reference in New Issue