first commit
This commit is contained in:
commit
acd31cdf9d
73 changed files with 650543 additions and 0 deletions
32
helpers/utils.py
Normal file
32
helpers/utils.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# utils
|
||||
|
||||
import os
|
||||
import json
|
||||
|
||||
def get_path(*path):
|
||||
return os.path.join(os.getcwd(), *path)
|
||||
|
||||
def get_config(name):
|
||||
with open(get_path("configs/vars.json"), "r") as f:
|
||||
config = json.loads(f.read())
|
||||
f.close()
|
||||
|
||||
return config[name]
|
||||
|
||||
def set_config(name, value):
|
||||
with open(get_path("configs/vars.json"), "r") as f:
|
||||
config = json.loads(f.read())
|
||||
f.close()
|
||||
|
||||
config[name] = value
|
||||
|
||||
with open(get_path("configs/vars.json"), "w") as f:
|
||||
f.write(json.dumps(config, indent=4))
|
||||
f.close()
|
||||
|
||||
def get_index_meta(version):
|
||||
with open(get_path(f"configs/indexes/index.{version}.meta.json"), "r") as f:
|
||||
meta = json.loads(f.read())
|
||||
f.close()
|
||||
|
||||
return meta
|
||||
Loading…
Add table
Add a link
Reference in a new issue