Code instrumentation¶
The Python implementation of the protocol relies on the automatic code instrumentation that is implemented through the command function decorator. This decorator registers all necessary information when a method is called and offers convenient conversion functions. This works by inspecting the declared type of a method (using function annotations) and checking of the provided type has the right type. If this is not the case, the command search for a converter among those registered.
Command related functions¶
queue
¶
Return a new or existing command queue. There is a special name "active" that relates to the current command queue. Each time a queue is created, it becomes automatically the active one.
record
¶
Activate (state=True) or deactivate (state=False) global command recording (for all command queues).
command
¶
Function decorator that creates a command when the function is called and optionally record it. The name of the method can can be overriden with the provided name.
Conversion related functions¶
register
¶
Function decorator that registers a converter from src_types
to dst_type
unregister
¶
Unregister converters from src_types
to dst_type
.
convert
¶
Return a converter from value
type to dst_type
, if there
exists such a converter.