allow to use the same label twice in a function

This commit is contained in:
Martin Diehl 2019-10-18 20:39:00 +02:00
parent edcb8f9c4d
commit 47ba7d49b5
1 changed files with 2 additions and 2 deletions
python/damask

View File

@ -563,7 +563,7 @@ class DADF5():
formula = kwargs['formula']
for d in re.findall(r'#(.*?)#',formula):
formula = re.sub('#{}#'.format(d),"kwargs['{}']['data']".format(d),formula)
formula = formula.replace('#{}#'.format(d),"kwargs['{}']['data']".format(d))
return {
'data' : eval(formula),
@ -575,7 +575,7 @@ class DADF5():
}
}
requested = [{'label':d,'arg':d} for d in re.findall(r'#(.*?)#',formula)] # datasets used in the formula
requested = [{'label':d,'arg':d} for d in set(re.findall(r'#(.*?)#',formula))] # datasets used in the formula
pass_through = {'formula':formula,'label':label,'unit':unit,'description':description}
self.__add_generic_pointwise(calculation,requested,pass_through)