1.7.1. Common helper classes¶
This section contains helper classes, that are used internally in the Connectors package.
1.7.1.1. Container classes¶
-
class
connectors._common._non_lazy_inputs.
NonLazyInputs
(situation)¶ A subclass of
set
, that is used internally to track the non-lazy input connectors, that request an immediate re-computation of the processing chain.Parameters: situation – a flag from the Laziness
enumeration to which the laziness of the connectors is compared in order to decide, if it shall be added to thisset
.-
add
(connector, laziness)¶ Adds a connector to this container, if its laziness is low enough to cause immediate execution.
Parameters: - connector – the
InputConnector
instance, that shall be added - laziness – the laziness setting of that connector as a flag from the
Laziness
enumeration
- connector – the
-
execute
(executor)¶ Executes the necessary computations, that are requested by the non-lazy input connectors.
Parameters: executor – the connectors._common._executors.Executor
instance, that manages the executions
-
1.7.1.2. Supplementary classes¶
-
class
connectors._common._multiinput_associate.
MultiInputAssociateDescriptor
(method, observers, executor)¶ A descriptor class for associating remove and replace methods with their multi-input. Instances of this class are created by the decorator methods
remove()
andreplace()
.Parameters: - method – the unbound method, that is wrapped
- observers – the names of output methods that are affected by passing a value to the multi-input connector.
- executor – an
Executor
instance, that can be created with theconnectors.executor()
function. See theMultiInputConnector
’sset_executor()
method for details
-
class
connectors._common._multiinput_associate.
MultiInputAssociateProxy
(instance, method, observers, executor)¶ A proxy class for remove or replace methods of multi-input connectors. Connector proxies are returned by the connector decorators, while the methods are replaced by the actual connectors. Think of a connector proxy like of a bound method, which is also created freshly, whenever a method is accessed. The actual connector only has a weak reference to its instance, while this proxy has a hard reference, but mimics the connector in almost every other way. This makes constructions like
value = Class().connector()
possible. Without the proxy, the instance of the class would be deleted before the connector method is called, so that the weak reference of the connector would be expired during its call.Parameters: - instance – the instance in which the method is replaced by the multi-input connector proxy
- method – the unbound method, that is replaced by this proxy (the remove or replace method)
- observers – the names of output methods that are affected by passing a value to the multi-input connector proxy
- executor – an
Executor
instance, that can be created with theconnectors.executor()
function. See theset_executor()
method for details