1
0
mirror of https://github.com/bspeice/metrik synced 2024-09-28 13:41:31 -04:00
metrik/metrik/targets/pickle_target.py
2016-08-12 20:18:12 -04:00

13 lines
302 B
Python

from pickle import dump, load
from metrik.targets.temp_file import TempFileTarget
class PickleTarget(TempFileTarget):
def write(self, obj):
with open(self.full_path(), 'w+b') as handle:
dump(obj, handle)
def read(self):
return load(open(self.full_path(), 'rb'))