Changed structure of referencing data
This commit is contained in:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user