fix: 修复浅拷贝导致的 eval 问题
This commit is contained in:
@@ -4,6 +4,7 @@ import heurams.services.hasher as hasher
|
||||
import pathlib
|
||||
import toml
|
||||
import json
|
||||
from copy import deepcopy
|
||||
|
||||
def load_nucleon(path: pathlib.Path, fmt = "toml"):
|
||||
with open(path, "r") as f:
|
||||
@@ -28,7 +29,7 @@ def load_nucleon(path: pathlib.Path, fmt = "toml"):
|
||||
for item, attr in nested_data.items():
|
||||
if item == "__metadata__":
|
||||
continue
|
||||
lst.append((Nucleon(hasher.hash(item), attr, nested_data['__metadata__']), nested_data["__metadata__"]["orbital"]))
|
||||
lst.append((Nucleon(hasher.hash(item), attr, deepcopy(nested_data['__metadata__'])), deepcopy(nested_data["__metadata__"]["orbital"])))
|
||||
return lst
|
||||
|
||||
def load_electron(path: pathlib.Path, fmt = "json") -> dict:
|
||||
|
||||
Reference in New Issue
Block a user