OpenQasm3DataModel
pydantic model OpenQasm3DataModel
Bases: BaseModel, Generic[T]
OpenQASM3-encoded objects.
data
field
Type: list[str] [Required]
A list of OpenQASM3 serialized programs.
from_python
classmethod from_python(data)
Create a model instance from Python data of the correct type.
The returned instance owns a reference to the provided data. This instance may be returned by to_python() depending on the value of use_cached. Users of this class are responsible for managing cached instances of the data and possible side-effects of their mutations.
Parameters
data (list[T]) – The data to string encode in the new model instance.
Returns
A new model instance.
Return type
Self
to_python
to_python(use_cached=False)
Return a Python representation of the encoded data in the model.
When use_cached is false, or when no cached version exists, data is decoded and loaded into a new Python instance. Users of this class are responsible for managing cached instances of the Python data and possible side-effects of their mutations.
Parameters
use_cached (bool) – Whether to return the cached instance (if it exists).
Returns
Python data.
Return type
list[T]
num_programs
Type: int
The number of programs in this encoded circuit.