Progress
This commit is contained in:
11
ref-test/app/tools/data.py
Normal file
11
ref-test/app/tools/data.py
Normal file
@ -0,0 +1,11 @@
|
||||
from .. import Config
|
||||
from ..data import data_dir
|
||||
import json
|
||||
|
||||
def load(filename:str):
|
||||
with open(f'./{data_dir}/{filename}') as file:
|
||||
return json.load(file)
|
||||
|
||||
def save(data:dict, filename:str):
|
||||
with open(f'./{data_dir}/{filename}', 'w') as file:
|
||||
json.dump(data, file, indent=4)
|
11
ref-test/app/tools/logs.py
Normal file
11
ref-test/app/tools/logs.py
Normal file
@ -0,0 +1,11 @@
|
||||
from .. import Config
|
||||
from ..data import data
|
||||
from datetime import datetime
|
||||
|
||||
def read(filename:str):
|
||||
with open(f'./{data}/logs/{filename}') as file:
|
||||
return file.readlines()
|
||||
|
||||
def write(filename:str, message:str):
|
||||
with open(f'./{data}/logs/{filename}', 'a+') as file:
|
||||
file.write(f'{datetime.now().strftime("%Y-%m-%d-%X")}: {message}\n')
|
Reference in New Issue
Block a user