You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
502 B
20 lines
502 B
from typing import Any
|
|
import json
|
|
import os.path
|
|
|
|
DATA_FOLDER = "TODO"
|
|
|
|
def load_json(filename: str):
|
|
with open(filename + ".json") as f:
|
|
content = json.load(f)
|
|
return content
|
|
|
|
def dump_json(filename: str, data: Any):
|
|
with open(filename + ".json", "w") as f:
|
|
json.dump(data, f)
|
|
|
|
def load_data(filename: str):
|
|
return load_json(os.path.join(DATA_FOLDER, filename))
|
|
|
|
def dump_data(filename: str, data: Any):
|
|
return dump_json(os.path.join(DATA_FOLDER, filename), data)
|
|
|