Build information
The following functions and classes allow you to programmatically retrieve version and build information for various components.
Information about Qblox instruments
- qblox_instruments.get_build_info() BuildInfo [source]
Get build information for Qblox Instruments.
- Returns
Build information structure for Qblox Instruments.
- Return type
- class qblox_instruments.BuildInfo(version: Union[str, Tuple[int, int, int]], build: Union[str, int, datetime], hash: Union[str, int], dirty: Union[str, bool])[source]
Bases:
object
Class representing build information for a particular component.
- __init__(version: Union[str, Tuple[int, int, int]], build: Union[str, int, datetime], hash: Union[str, int], dirty: Union[str, bool])[source]
Makes a build information object.
- Parameters
version (Union[str, Tuple[int, int, int]]) – Either a canonical version string or a three-tuple of integers.
build (Union[str, int, datetime],) – The build timestamp, either as a string formatted like “17/11/2021-19:04:53” (as used in
*IDN?
), a Unix timestamp in seconds, or a Python datetime object.hash (Union[str, int]) – The git hash of the repository that the build was run from, either as a hex string with at least 8 characters, or as an integer. If 0x is prefixed, the hash may have less than 8 digits, implying zeros in front.
dirty (Union[str, bool]) – Whether the git repository was dirty at the time of the build, either as a
0
or1
string (as in*IDN?
) or as the boolean itself.
- classmethod from_idn(idn: str, prefix: str = '') Optional[BuildInfo] [source]
Constructs a build information structure from an
*IDN?
string.
- to_idn(prefix: str = '') str [source]
Formats this build information object in the same way
*IDN?
is formatted.
- classmethod from_dict(build_data: dict) BuildInfo [source]
Constructs a build information structure from a JSON-capable dict, as used in ZeroMQ/CBOR descriptions, plug&play descriptions, update file metadata, and various other places.
- Parameters
build_data (dict) –
Dictionary with (at least) the following keys:
"version"
: iterable of three integers representing the version;"build"
: Unix timestamp in seconds representing the build timestamp;"hash"
: the first 8 hex digits of the git hash as an integer; and"dirty"
: boolean dirty flag.
- Returns
The build information structure.
- Return type
- to_dict() dict [source]
Formats this build information object as a JSON-capable dict, as used in ZeroMQ/CBOR descriptions, plug&play descriptions, update file metadata, and various other places.
- Parameters
None –
- Returns
The generated dictionary, having the following keys:
"version"
: iterable of three integers representing the version;"build"
: Unix timestamp in seconds representing the build timestamp;"hash"
: the first 8 hex digits of the git hash as an integer; and"dirty"
: boolean dirty flag.
- Return type
- to_idn_dict() dict [source]
Formats this build information object as a human-readable JSON-capable dict, as used in get_idn.
- Returns
The generated dictionary, having the following keys:
"version"
: string representation of the version;"build"
: string representation of timestamp in seconds representing the build timestamp;"hash"
: string representation of the first 8 hex digits of the git hash; and"dirty"
: boolean dirty flag.
- Return type
Information about an instrument
- qblox_instruments.get_device_info(identifier: Union[str, AddressInfo, ConnectionInfo]) DeviceInfo [source]
Fetches a complete
DeviceInfo
structure for the given device.- Parameters
identifier (Union[str, AddressInfo, ConnectionInfo]) – Instrument identifier. See
resolve()
for more information.- Returns
The device information.
- Return type
- Raises
RuntimeError – if we failed to connect.
- class qblox_instruments.DeviceInfo(manufacturer: str, model: str, serial: Optional[str] = None, sw_build: Optional[BuildInfo] = None, fw_build: Optional[BuildInfo] = None, kmod_build: Optional[BuildInfo] = None, cfg_man_build: Optional[BuildInfo] = None)[source]
Bases:
object
Class representing the build and model information of a device. Has the same information content as what
*IDN?
returns.- __init__(manufacturer: str, model: str, serial: Optional[str] = None, sw_build: Optional[BuildInfo] = None, fw_build: Optional[BuildInfo] = None, kmod_build: Optional[BuildInfo] = None, cfg_man_build: Optional[BuildInfo] = None)[source]
- property sw_build: Optional[BuildInfo]
The software/application build information, if known.
- Type
Optional[BuildInfo]
- property fw_build: Optional[BuildInfo]
The FPGA firmware build information, if known.
- Type
Optional[BuildInfo]
- property kmod_build: Optional[BuildInfo]
The kernel module build information, if known.
- Type
Optional[BuildInfo]
- property cfg_man_build: Optional[BuildInfo]
The configuration management build information, if known.
- Type
Optional[BuildInfo]
- get_build_info(key: str) Optional[BuildInfo] [source]
Returns build information for the given key.
- Parameters
key (str) –
The key. Must be one of:
"sw"
: returns the application build info;"fw"
: returns the FPGA firmware build info;"kmod"
: returns the kernel module build info; or"cfg_man"
or"cfgMan"
: returns the configuration manager build info.
- Returns
The build information structure, if known.
- Return type
Optional[BuildInfo]
- Raises
KeyError – For unknown keys.
- classmethod from_idn(idn: str) DeviceInfo [source]
Constructs a device information structure from an
*IDN?
string.- Parameters
idn (str) – The
*IDN?
string.- Returns
The parsed device information structure.
- Return type
- to_idn() str [source]
Formats this device information object in the same way
*IDN?
is formatted.- Returns
The
*IDN?
string.- Return type
- classmethod from_dict(description: dict) DeviceInfo [source]
Constructs a device information structure from a JSON-capable dict, as used in ZeroMQ/CBOR descriptions, plug&play descriptions, update file metadata, and various other places.
- Parameters
description (dict) –
Dictionary with the following keys:
"manufacturer"
: manufacturer name (string);"model"
: model name (string);"ser"
: serial number (string);"sw"
: application build information (dict);"fw"
: FPGA firmware build information (dict);"kmod"
: kernel module build information (dict); and"cfg_man"
: configuration management build information (dict);
- Returns
The build information structure.
- Return type
- to_dict() dict [source]
Formats this device information object as a JSON-capable dict, as used in ZeroMQ/CBOR descriptions, plug&play descriptions, update file metadata, and various other places.
- Returns
The generated dictionary, having the following keys:
"manufacturer"
: manufacturer name (string);"model"
: model name (string);"ser"
: serial number (string);"sw"
: application build information (dict);"fw"
: FPGA firmware build information (dict);"kmod"
: kernel module build information (dict); and/or"cfg_man"
: configuration management build information (dict);
Some keys may be omitted if the information is not available.
- Return type
- to_idn_dict() dict [source]
Formats this device information object as a human-readable JSON-capable dict, as used get_idn.
- Returns
The generated dictionary, having the following keys:
"manufacturer"
: manufacturer name (string);"model"
: model name (string);"serial_number"
: serial number (string);"firmware"
: build info (dict);"fpga"
: FPGA firmware build information (dict);"kernel_mod"
: kernel module build information (dict);"application"
: application build information (dict); and"driver"
: driver build information (dict);
Some keys may be omitted if the information is not available.
- Return type