Python Toolkit API Node Info¶
zhinst.toolkit.nodetree.node.NodeInfo(node)
¶
Class that holds the additional information for a single node.
LabOne provides for each leaf node a dictionary of so called node info (In addition toolkit or the user may also add some information for selected nodes). This class wraps around these information and exposes them to a user in a friendly way.
During the initialization is fetches the relevant information from the root of the nodetree and stores them internally.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node |
Node
|
A node the information belong to. |
required |
T = t.TypeVar('T')
class-attribute
instance-attribute
¶
contains_wildcards: bool
property
¶
Flag if the node contains wildcards.
description: str
property
¶
Description of the node.
enum: t.Optional[NodeEnum]
cached
property
¶
Enum of the node options.
is_partial: bool
property
¶
Flag if the node is a partial node (non-leaf node).
is_setting: t.Optional[bool]
property
¶
Flag if the node is setting node.
Returns None if the node does not provide the information (e.g. wildcard or partial nodes.)
is_vector: t.Optional[bool]
property
¶
Flag if the value of the node a vector.
Returns None if the node does not provide the information (e.g. wildcard or partial nodes.)
options: dict[int, _option_info]
cached
property
¶
Options of the node.
path: str
property
¶
Path (LabOne representation) of the node.
readable: t.Optional[bool]
property
¶
Flag if the node is readable.
Returns None if the node does not provide the information (e.g. wildcard or partial nodes.)
type: str
property
¶
Type of the node.
unit: str
property
¶
Unit of the node.
writable: t.Optional[bool]
property
¶
Flag if the node is writable.
Returns None if the node does not provide the information (e.g. wildcard or partial nodes.)
get_parser(value)
¶
Parse the get value.
set_parser(value)
¶
Parse the set value.
zhinst.toolkit.nodetree.node.NodeEnum(*args, **kwargs)
¶
Bases: IntEnum
Custom dynamically picklable IntEnum class.
The Enum values for a device are created dynamically in toolkit based on
the node informations. Since they are not predefined but rather created
dynamically, the are not picklable. This custom child class of IntEnum
overwrites the reduce function that returns all information required to
recreate the Enum class in NodeEnumMeta
.
For more information on the reduce functionality and how it is used within the pickle package see pep307.
zhinst.toolkit.nodetree.node.NodeEnumMeta
¶
Custom Metaclass for NodeEnum.
Note: Required to enable pickling of a NodeEnum value.
It simply servers the purpose to recreate a NodeEnum for a given enum value. Since the NodeEnums are created dynamically there is no way recreate a NodeEnum value since python can not find the definition. This class bypasses this problem by providing the functionality to recreate the Enum on the fly.
Warning: Although the class of the resulting enum object looks and feels
the same as the original one it is not. Therefore comparing the type
will
fail. This is however the only limitation.
(type(value_old) != type(value_new) but value_old == value_new)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
int
|
Value of the NodeEnum object that should be created. |
required |
class_name |
str
|
Name of the NodeEnum class. |
required |
names |
dict[str, int]
|
Mapping of the enum names to their corresponding integer value. |
required |
module |
str
|
Should be set to the module this class is being created in. |
required |
zhinst.toolkit.nodetree.node.NodeList(elements, root, tree)
¶
List of nodelike objects.
List of preinitialized classes that inherit from the Node
class would not
support wildcards since they would be of type list.
This class holds the preinitialized objects. But if a the passed item is not an integer it returns a Node instead.
Warning
Since in case of a passed wildcard symbol the return value is a node, the additional functionality that the nodelike object may provide (e.g. helper functions) are no longer accessible.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
elements |
Sequence[Any]
|
Preinitialized child elements |
required |
root |
NodeTree
|
Root of the nodetree |
required |
tree |
tuple
|
Node tree (node path as tuple) of the current node |
required |