Skip to content

Commit

Permalink
Merge pull request #9 from EconForge/albop/many_fixes
Browse files Browse the repository at this point in the history
Albop/many fixes
  • Loading branch information
albop authored Jan 7, 2021
2 parents 9120ef2 + 0fde125 commit 862a9a5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dolang/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def eval_data(data: "yaml_structure", calibration={}):
import warnings
from yaml import MappingNode, SequenceNode, ScalarNode

d = calibration.copy()
d.update(functions)

if isinstance(data, ScalarNode):

val = data.value
Expand All @@ -94,7 +97,7 @@ def eval_data(data: "yaml_structure", calibration={}):
elif isinstance(val, str):
# could be a string, could be an expression, could depend on other sections
try:
val = eval(val.replace("^", "**"), calibration)
val = eval(val.replace("^", "**"), d)
except Exception as e:
warnings.warn(f"Impossible to evaluate expression: {val}")
return val
Expand Down

0 comments on commit 862a9a5

Please sign in to comment.