This commit is contained in:
2025-10-19 00:19:13 +08:00
parent ace6197231
commit 3fef587ff5
3 changed files with 21 additions and 11 deletions

View File

@@ -5,7 +5,7 @@ import pathlib
import toml
import json
def loader_nucleon(path: pathlib.Path, fmt = "toml"):
def load_nucleon(path: pathlib.Path, fmt = "toml"):
with open(path, "r") as f:
dictdata = dict()
toml.load(f, dictdata) # type: ignore
@@ -13,4 +13,14 @@ def loader_nucleon(path: pathlib.Path, fmt = "toml"):
for item, attr in dictdata.items():
if item == "__metadata__":
continue
lst.append(Nucleon(hasher.hash(item), attr))
lst.append((Nucleon(hasher.hash(item), attr), dictdata["__metadata__"]["orbital"]))
return lst
def load_electron(path: pathlib.Path, fmt = "json"):
with open(path, "r") as f:
dictdata = dict()
json.load(f, dictdata) # type: ignore
lst = list()
for item, attr in dictdata.items():
lst.append(Electron(hasher.hash(item), attr))
return lst