def load_data(): data = storage.get(LOCAL_STORAGE) if data: hash_map = json.loads(data) else: storage[LOCAL_STORAGE] = json.dumps({}) hash_map = {} return hash_map
def load_data(): data = storage.get("b64data") if data: b64_map = json.loads(data) else: storage["b64data"] = json.dumps({}) b64_map = {} return b64_map
def __init__(self, path, flags): self._path = path self._pos = 0 self._flags = flags if self._flags & O_RDONLY == O_RDONLY: self._data = storage.get(self._path, None) if self._data is None: raise FileNotFoundError("%s not found" % self._path) elif self._flags & O_WRONLY == O_WRONLY: storage[self._path] = ''
def __init__(self, path, flags): self._path=path self._pos=0 self._flags=flags if self._flags & O_RDONLY == O_RDONLY: self._data=storage.get(self._path, None) if self._data is None: raise FileNotFoundError("%s not found" % self._path) elif self._flags & O_WRONLY == O_WRONLY: storage[self._path]=''
def fetch(cls): cls.NEXT_UID = 0 todos = json.loads(storage.get(STORAGE_KEY, '[]')) return [{"id": cls.next_uid(), **todo} for todo in todos]
def load_data(): b64_map = {} for key in storage.keys(): b64_map[key] = storage.get(key) return b64_map
def get_value(key): value = storage.get(key) if not value: return 0 else: return int(value)
def increment_key(key, amount=1): value = storage.get(key) if not value: storage[key] = str(amount) else: storage[key] = str(int(value) + amount)
def mock_exists(path): return bool(storage.get(path))