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