fix: 仪表盘改进
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user