Source code for kappa_sdk.user_tasks.parameters_dictionary
from typing import 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.
"""
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.
"""
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.
"""
def items(self) -> ItemsView[str, Any]:
"""
Access to the class like a real dictionary
Returns
-------
key, values of the class
"""