conductor-worker-python/pyexecplugins/Eval.py

22 lines
555 B
Python

from pyexecplugins.pyexecplugins import PyExecPlugin
class Plugin(PyExecPlugin):
name = "Eval"
taskdef = {
"name" : "pyeval",
"description" : "Execute arbitrary python code",
"inputKeys" : ["code"],
"outputKeys" : ["result"],
"ownerEmail" : "m.lettere@gmail.com"
}
def __init__(self, data=None):
super().__init__(data)
def execute(self):
code = self.data.get("code")
if code != None:
ret = eval(code, { "data" : self.data})
return ret