部分移植
This commit is contained in:
16
src/heurams/kernel/particles/loader.py
Normal file
16
src/heurams/kernel/particles/loader.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from .nucleon import Nucleon
|
||||
from .electron import Electron
|
||||
import heurams.services.hasher as hasher
|
||||
import pathlib
|
||||
import toml
|
||||
import json
|
||||
|
||||
def loader_nucleon(path: pathlib.Path, fmt = "toml"):
|
||||
with open(path, "r") as f:
|
||||
dictdata = dict()
|
||||
toml.load(f, dictdata) # type: ignore
|
||||
lst = list()
|
||||
for item, attr in dictdata.items():
|
||||
if item == "__metadata__":
|
||||
continue
|
||||
lst.append(Nucleon(hasher.hash(item), attr))
|
||||
Reference in New Issue
Block a user