Source code for kappa_sdk.user_tasks.output_parameters
from .parameters_dictionary import ParametersDictionary
from typing import Optional, Union, ItemsView, Any
from uuid import UUID
from datetime import datetime
[docs]
class OutputParameters:
"""Output parameters container.
Provides access to output (read/write) parameters of the user task.
.. note:: Should not be instantiated directly.
.. automethod:: __getitem__
.. automethod:: __setitem__
"""
def __init__(self, parameters_dictionary: ParametersDictionary) -> None:
self.__parameters_dictionary: ParametersDictionary = parameters_dictionary
[docs]
def __getitem__(self, parameter_name: str) -> Optional[Union[bool, UUID, datetime, float, int, str]]:
"""Gets the value of the user task parameter identified by its name.
Parameters
----------
parameter_name:
The name of the User Task parameter.
"""
return self.__parameters_dictionary[parameter_name.lower()]
[docs]
def __setitem__(self, parameter_name: str, value: Optional[Union[bool, UUID, datetime, float, int, str]]) -> None:
"""Sets the value of the user task parameter identified by its name.
Parameters
----------
parameter_name:
The name of the User Task parameter.
value:
The new value of the User Task parameter.
"""
self.__parameters_dictionary[parameter_name.lower()] = value
def items(self) -> ItemsView[str, Any]:
"""
Access to the class like a real dictionary
Returns
-------
key, values of the class
"""
return self.__parameters_dictionary.items()