Skip to content

loqs.internal.serializable

Serializable definition.

Classes

Attributes

Name Type Value Doc
IMPORT_LOCATION_CHANGES_BY_VERSION dict[int, dict[tuple[str, str], tuple[str, str] | None]] {1: {('syndrome', 'SyndromeLabel'): ('syndromelabel', 'SyndromeLabel'), ('syndrome', 'SyndromeLabelCastableTypes'): ('syndromelabel', 'SyndromeLabelCastableTypes'), ('syndrome', 'PauliFrame'): ('pauliframe', 'PauliFrame')}, 2: {('instructionlabel', 'InstructionLabelCastableTypes'): ('instructionlabel', 'InstructionLabelLike'), ('instructionstack', 'InstructionStackCastableTypes'): ('instructionstack', 'InstructionStackLike'), ('syndromelabel', 'SyndromeLabelCastableTypes'): ('syndromelabel', 'SyndromeLabelLike'), ('pauliframe', 'PauliFrameCastableTypes'): ('pauliframe', 'PauliFrameLike'), ('patchdict', 'PatchDictCastableTypes'): ('patchlayout', 'PatchLayoutLike'), ('measurementoutcomes', 'MeasurementOutcomesCastableTypes'): ('measurementoutcomes', 'MeasurementOutcomesLike'), ('frame', 'FrameCastableTypes'): ('frame', 'FrameLike'), ('history', 'HistoryCastableTypes'): ('history', 'HistoryLike'), ('pygstimodel', 'PyGSTiModelCastableTypes'): ('pygstimodel', 'PyGSTiModelLike'), ('npsvstate', 'NumpyStatevectorCastableTypes'): ('npsvstate', 'NumpyStatevectorLike'), ('qsimstate', 'QSimStateCastableTypes'): ('qsimstate', 'QSimStateLike'), ('stimstate', 'STIMStateCastableTypes'): ('stimstate', 'STIMStateLike'), ('pygsticircuit', 'PyGSTiCircuitCastableTypes'): ('pygsticircuit', 'PyGSTiCircuitLike'), ('listcircuit', 'ListCircuitCastableTypes'): ('listcircuit', 'ListCircuitLike'), ('stimcircuit', 'STIMCircuitCastableTypes'): ('stimcircuit', 'STIMCircuitLike'), ('dictmodel', 'DictModelCastableTypes'): None, ('castable', 'Castable'): None, ('castable', 'SeqCastable'): None, ('castable', 'MapCastable'): None, ('castable', 'Castable'): None, ('castable', 'SeqCastable'): None, ('castable', 'MapCastable'): None, ('patchdict', 'PatchDict'): ('patchlayout', 'PatchLayout'), ('reps', 'RepTuple'): ('base', 'OperationRep'), ('stimdictmodel', 'STIMDictNoiseModel'): ('dictmodel', 'DictNoiseModel')}}
SERIALIZATION_VERSION 2 Serialization versions.

0: First version. JSON encoding only, per-shot checkpointing only. 1: HDF5 encoding now available. Backwards compatible to version 0. 2: CastableTypes -> Like renames and several class removals/ relocations; see IMPORT_LOCATION_CHANGES_BY_VERSION.
MIGRATE_LEGACY_FNS contextvars.ContextVar[bool] contextvars.ContextVar('migrate_legacy_fns', default=False) Whether decoding may run a known legacy-construction pattern found in an old Instruction's frozen source, rather than raising a clear error. Set for the duration of a Serializable.read/.load call, read once in Instruction._from_decoded_attrs.
EncodableArrays TypeAlias NDArray | SPSArray
EncodableIterables TypeAlias list | tuple | set
EncodablePrimitives TypeAlias Int | Float | Bool | str | bytes | Complex | None
Encodable TypeAlias 'Serializable | EncodableIterables | dict | EncodableArrays | type | Callable | EncodablePrimitives'
Encoded TypeAlias dict | h5py.Group
EncodeFormats TypeAlias Literal['json', 'json.gz', 'hdf5', 'h5'] | None
EncodeCache TypeAlias dict[int, list[tuple[int, int]]] | None
DecodeCache TypeAlias dict[int, 'Serializable | DeferredRef'] | None
T TypeVar TypeVar('T', bound='Serializable')