fix: 仪表盘改进

This commit is contained in:
2025-12-08 01:06:19 +08:00
parent c98f3a4418
commit 853511b861
7 changed files with 69 additions and 30 deletions

View File

@@ -32,10 +32,19 @@ def load_nucleon(path: pathlib.Path, fmt = "toml"):
return lst
def load_electron(path: pathlib.Path, fmt = "json") -> dict:
"""从文件路径加载电子对象
Args:
path (pathlib.Path): 路径
fmt (str): 文件格式(可选, 默认 json)
Returns:
dict: 键名是电子对象名称, 值是电子对象
"""
with open(path, "r") as f:
dictdata = dict()
dictdata = json.load(f) # type: ignore
dic = dict()
for item, attr in dictdata.items():
dic["item"] = (Electron(hasher.hash(item), attr))
dic[item] = (Electron(hasher.hash(item), attr))
return dic