Skip to content

Commit 87dd8a1

Browse files
committed
WIP
1 parent 9120ef2 commit 87dd8a1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

dolang/language.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ def eval_data(data: "yaml_structure", calibration={}):
8585
import warnings
8686
from yaml import MappingNode, SequenceNode, ScalarNode
8787

88+
import math
89+
d = calibration.copy()
90+
d['log'] = math.log
91+
d['exp'] = math.exp
92+
8893
if isinstance(data, ScalarNode):
8994

9095
val = data.value
@@ -94,7 +99,9 @@ def eval_data(data: "yaml_structure", calibration={}):
9499
elif isinstance(val, str):
95100
# could be a string, could be an expression, could depend on other sections
96101
try:
97-
val = eval(val.replace("^", "**"), calibration)
102+
print(val)
103+
print(d)
104+
val = eval(val.replace("^", "**"), d)
98105
except Exception as e:
99106
warnings.warn(f"Impossible to evaluate expression: {val}")
100107
return val

0 commit comments

Comments
 (0)