1
Fork 0
mirror of https://github.com/RGBCube/JsonWrapper synced 2025-07-27 19:57:44 +00:00

indents becuase why not

This commit is contained in:
RGBCube 2022-01-12 21:06:45 +03:00 committed by GitHub
parent dfcd2381c6
commit 2b1309abdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

4
db.py
View file

@ -19,7 +19,7 @@ class ClutterDB:
json_data = json.load(json_file) json_data = json.load(json_file)
with open(self.path_to_json, mode="w") as json_file: with open(self.path_to_json, mode="w") as json_file:
json_data[key] = value json_data[key] = value
json.dump(json_data, json_file) json.dump(json_data, json_file, indent=4)
def get(self, key: str, **kwargs): def get(self, key: str, **kwargs):
with open(self.path_to_json, mode="r") as json_file: with open(self.path_to_json, mode="r") as json_file:
@ -36,7 +36,7 @@ class ClutterDB:
json_data = json.load(json_file) json_data = json.load(json_file)
with open(self.path_to_json, mode="w") as json_file: with open(self.path_to_json, mode="w") as json_file:
json_data.pop(key, None) json_data.pop(key, None)
json.dump(json_data, json_file) json.dump(json_data, json_file, indent=4)
def nuke(self): def nuke(self):
with open(self.path_to_json, mode="w") as json_file: with open(self.path_to_json, mode="w") as json_file: