Repository: KIT-IAI/pyWATTS

Issue:
FunctionModule uses old API
**Describe the bug**
The transform module of the FunctionModule takes only x, we should change it to kwargs which are then passed to the wrapped function.

**Expected behavior**
The transform methods takes multiple key word arguments and passes them to the wrapped function


Discussion:

Patch:
diff --git a/pywatts/wrapper/function_module.py b/pywatts/wrapper/function_module.py
index 558973c..8d14590 100644
--- a/pywatts/wrapper/function_module.py
+++ b/pywatts/wrapper/function_module.py
@@ -9,7 +9,8 @@ from pywatts.core.filemanager import FileManager
 
 class FunctionModule(BaseTransformer):
     """
-    This module calls the function in its transform. It can be used, for executing own code in the pipeline
+    This module calls the function in its transform. It can be used, for executing own code in the pipeline. Note that
+    the wrapped function is called with the same keyword arguments as the module.
 
     :param name: name of the instance (FunctionModule)
     :type name: str
@@ -35,7 +36,7 @@ class FunctionModule(BaseTransformer):
         Does nothing:
         """
 
-    def transform(self, x: Optional[xr.Dataset]) -> xr.Dataset:
+    def transform(self, **kwargs: xr.DataArray) -> xr.DataArray:
         """
         Call the function wrapped by this module on x.
 
@@ -44,13 +45,13 @@ class FunctionModule(BaseTransformer):
         :return: The transformed Dataset
         :rtype: xarray.Dataset
         """
-        return self.function(x)
+        return self.function(**kwargs)
 
     def save(self, fm: FileManager):
         """
         Saves the Conditional module to JSON file
 
-        :param fm: A FileManager, from which the path where the JSON file is saved is fetcheds
+        :param fm: A FileManager, from which the path where the JSON file is saved is fetches
         :type fm: FileManager
         :return: Dictionary with name, parameters, related module and class, and path to the file
         :rtype: Dict


Test patch:
diff --git a/tests/unit/wrapper/test_function_module.py b/tests/unit/wrapper/test_function_module.py
index 9868bfe..8e665ce 100644
--- a/tests/unit/wrapper/test_function_module.py
+++ b/tests/unit/wrapper/test_function_module.py
@@ -16,9 +16,9 @@ class TestFunctionModule(unittest.TestCase):
 
     def test_transform(self):
         data_mock = MagicMock()
-        self.function_module.transform(data_mock)
+        self.function_module.transform(input_data=data_mock)
 
-        self.mocked_function.assert_called_once_with(data_mock)
+        self.mocked_function.assert_called_once_with(input_data=data_mock)
 
     @patch('pywatts.wrapper.function_module.cloudpickle')
     @patch("builtins.open")