Commit a1fc1524 authored by Wout De Nolf's avatar Wout De Nolf
Browse files

Refactor ppf tasks

parent 3e2eb975
......@@ -12,31 +12,30 @@ class PpfMethodExecutorTask(
gets updates by each task.
"""
@property
def method(self):
fullname = self.inputs.method
return import_method(fullname)
def process(self):
method_kwargs = self.input_values
method_kwargs.pop("method")
ppfdict = method_kwargs.pop("ppfdict", None)
if ppfdict:
method_kwargs.update(ppfdict)
ppfdict = self.input_values
fullname = ppfdict.pop("method")
method = import_method(fullname)
ppfdict_unpack = ppfdict.pop("ppfdict", None)
if ppfdict_unpack:
ppfdict.update(ppfdict_unpack)
result = self.method(**method_kwargs)
result = method(**ppfdict)
ppfdict = dict(method_kwargs)
ppfdict.update(result)
self.outputs.ppfdict = ppfdict
class PpfPortTask(Task, optional_input_names=["ppfdict"], output_names=["ppfdict"]):
class PpfPortTask(
Task, optional_input_names=["ppfdict", "ppfport"], output_names=["ppfdict"]
):
"""A ppfmethod which represents the identity mapping"""
def process(self):
passthroughdata = self.inputs.ppfdict
if passthroughdata:
self.outputs.ppfdict = dict(passthroughdata)
else:
self.outputs.ppfdict = dict()
ppfdict = self.input_values
ppfdict.pop("ppfport") # not used
ppfdict_unpack = ppfdict.pop("ppfdict", None)
if ppfdict_unpack:
ppfdict.update(ppfdict_unpack)
self.outputs.ppfdict = ppfdict
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment