Created
November 10, 2016 05:59
-
-
Save DanielOaks/84282a58fbceeb313afbbd09ab974c4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DataStore: | |
def __init__(): | |
self.store = {} | |
def set(key, value): | |
self.store[key] = value | |
def delete(key): | |
try: | |
del self.store[key] | |
except: | |
pass | |
def load(filename): | |
raise Exception("Method must be overwritten") | |
def save(filename): | |
raise Exception("Method must be overwritten") | |
class JsonDataStore(DataStore): | |
def load(filename): | |
# whoo loading stuff yay | |
self.store = json.loads(open(filename).read()) | |
def save(filename): | |
# whoo saving | |
blah blah blah | |
class PickleDataStore(DataStore): | |
def load(filename): | |
# whoo loading stuff yay | |
blah blah | |
def save(filename): | |
# whoo saving | |
blah blah blah |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment