[nodes] Adds arg0_to_kwargs and kwargs_to_arg0 transformations.

This commit is contained in:
Romain Dorgueil
2017-07-15 10:14:30 +02:00
parent 53d6ac5887
commit f2a9a45fd1
2 changed files with 18 additions and 2 deletions

View File

@ -91,8 +91,22 @@ def noop(*args, **kwargs): # pylint: disable=unused-argument
def arg0_to_kwargs(row):
"""
Transform items in a stream from "arg0" format (each call only has one positional argument, which is a dict-like
object) to "kwargs" format (each call only has keyword arguments that represent a row).
:param row:
:return: bonobo.Bag
"""
return Bag(**row)
def kwargs_to_arg0(**row):
"""
Transform items in a stream from "kwargs" format (each call only has keyword arguments that represent a row) to
"arg0" format (each call only has one positional argument, which is a dict-like object) .
:param **row:
:return: bonobo.Bag
"""
return Bag(row)