1.4. Helper functionalities

This is the API reference for helper functionalities, that facilitate the use of the Connectors package.

class connectors.MultiInputData(datas=())

A container for data that is managed with a multi-input connector. This is basically an OrderedDict with an add method, that stores the added data under a unique key. This facilitates the implementation of a class with a MultiInput connector:

>>> import connectors
>>> class ReplacingMultiInput:
...     def __init__(self):
...         self.__data = connectors.MultiInputData()
...
...     @connectors.MultiInput()
...     def add_value(self, value):
...         return self.__data.add(value)
...
...     @add_value.remove
...     def remove_value(self, data_id):
...         del self.__data[data_id]
...
...     @add_value.replace
...     def replace_value(self, data_id, value):
...         self.__data[data_id] = value
...         return data_id
Parameters:datas – an optional sequence of data objects, that shall be added to the container
add(data)

Adds a data set to the container.

Parameters:data – the data set that shall be added
Returns:the id under which the data is stored