QsysShot

class guppylang.emulator.QsysShot(entries: Iterable[TaggedResult] | None = None)[source]

Results from a single shot execution.

__abstractmethods__ = frozenset({})
__eq__(other)

Return self==value.

__getitem__(index: int | slice) tuple[str, int | float | bool | list[int | float | bool]] | list[tuple[str, int | float | bool | list[int | float | bool]]][source]
__hash__ = None
__init__(entries: Iterable[TaggedResult] | None = None)[source]
__iter__() Iterator[tuple[str, int | float | bool | list[int | float | bool]]][source]
__len__() int[source]
__repr__()

Return repr(self).

append(tag: str, data: int | float | bool | list[int | float | bool]) None[source]
as_dict() dict[str, int | float | bool | list[int | float | bool]][source]

Convert results to a dictionary.

For duplicate tags, the last value is used.

Returns:

dict: A dictionary where the keys are the tags and the values are the data.

Example:
>>> results = QsysShot()
>>> results.append("tag1", 1)
>>> results.append("tag2", 2)
>>> results.append("tag2", 3)
>>> results.as_dict()
{'tag1': 1, 'tag2': 3}
collate_tags() dict[str, list[int | float | bool | list[int | float | bool]]][source]

Collate all the entries with the same tag in to a dictionary with a list containing all the data for that tag.

entries: list[tuple[str, int | float | bool | list[int | float | bool]]]

List of tagged results, where each result is a tuple of tag and data value.

to_register_bits() dict[str, str][source]

Convert results to a dictionary of register bit values.