Source code for kappa_sdk.user_tasks.parameters_dictionary
from typing import KeysView, List, runtime_checkable, Protocol, Optional, Union, ItemsView, Any
from uuid import UUID
from datetime import datetime
[docs]
@runtime_checkable
class ParametersDictionary(Protocol):
"""
Defines a protocol for a dictionary-like object with specific parameter types and behavior.
The `ParametersDictionary` protocol is used to describe an interface for objects
that act as dictionaries, providing methods to get, set, and access key-value
pairs where the keys are strings, and the values can be one of a defined set of types.
"""
[docs]
def __getitem__(self, parameter_name: str) -> Optional[Union[bool, UUID, datetime, float, int, str]]:
r"""Gets the value of the user task parameter identified by its name.
Parameters
----------
parameter_name : str
The name of the user task parameter.
"""
[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 : str
The name of the user task parameter.
"""
[docs]
def items(self) -> ItemsView[str, Any]:
"""
Access to the class like a real dictionary
Returns
-------
key, values of the class
"""
[docs]
def keys(self) -> KeysView[str]:
"""
Get only the keys (parameter names) of the parameters
Returns
-------
Keys of the parameters
"""
[docs]
def values(self) -> List[Any]:
"""
Get only the values of the parameters
Returns
-------
Values of the parameters
"""