18 lines
422 B
Python
18 lines
422 B
Python
import hjson
|
|
from typing import Dict
|
|
from datetime import datetime
|
|
|
|
|
|
def load_config(config_path: str) -> Dict:
|
|
with open(config_path, "r") as f:
|
|
config = hjson.load(f)
|
|
return dict(config)
|
|
|
|
|
|
def expand_filename(filename: str) -> str:
|
|
# expand %T
|
|
res = filename.replace("%T", datetime.now().strftime("%Y%m%d_%H%M%S"))
|
|
# expand %D
|
|
return res.replace("%D", datetime.now().strftime("%Y%m%d"))
|
|
|