We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ebc57f1 commit 4300f76Copy full SHA for 4300f76
src/storage.py
@@ -5,15 +5,18 @@
5
class FileStorage:
6
def __init__(self, file_name):
7
self.fine_name = file_name
8
+ self.history = {}
9
10
def save(self, data):
- with open(self.fine_name, 'a+', newline='') as f:
11
- json.dump(data, f)
+ self.history.update(data)
12
+ with open(self.fine_name, 'w', newline='') as f:
13
+ json.dump(self.history, f)
14
15
def load(self):
16
with open(self.fine_name, newline='') as jsonfile:
17
data = json.load(jsonfile)
- return data
18
+ self.history = data
19
+ return self.history
20
21
22
class MongoStorage:
0 commit comments