Changed structure of referencing data

This commit is contained in:
2022-06-19 13:22:05 +01:00
parent 76fa1e1dd9
commit ac02f4dee1
8 changed files with 25 additions and 16 deletions

View File

@@ -1,13 +1,16 @@
from ..data import data as data_dir
from flask import current_app as app
import json
from pathlib import Path
from random import shuffle
def load(filename:str):
data_dir = Path(app.config.get('DATA'))
with open(f'./{data_dir}/{filename}') as file:
return json.load(file)
def save(data:dict, filename:str):
data_dir = Path(app.config.get('DATA'))
with open(f'./{data_dir}/{filename}', 'w') as file:
json.dump(data, file, indent=4)