class PetOwnerSchema(BaseSchema): """Example PetOwner schema, with different polymorphic fields.""" auto_pets = TryFrom([CatSchema, DogSchema], many=True) by_attribute_pets = ByAttribute( { 'fur_density': CatSchema, 'barking_power': DogSchema }, many=True) by_type_contact = ByType([fields.Email(), fields.Url()])
class PulseQobjInstructionSchema(QobjInstructionSchema): """Schema for PulseQobjInstruction.""" # pylint: disable=invalid-name # Required properties t0 = Integer(required=True, validate=Range(min=0)) # Optional properties. ch = String(validate=Regexp('[dum]([0-9])+')) conditional = Integer(validate=Range(min=0)) val = ByType([Complex(), String()]) phase = ByType([Float(), String()]) duration = Integer(validate=Range(min=1)) qubits = List(Integer(validate=Range(min=0)), validate=Length(min=1)) memory_slot = List(Integer(validate=Range(min=0)), validate=Length(min=1)) register_slot = List(Integer(validate=Range(min=0)), validate=Length(min=1)) kernels = Nested(QobjMeasurementOptionSchema, many=True) discriminators = Nested(QobjMeasurementOptionSchema, many=True) label = String() type = String()
class ExperimentResultSchema(BaseSchema): """Schema for ExperimentResult.""" # Required fields. shots = ByType([ Integer(), List(Integer(validate=Range(min=1)), validate=Length(equal=2)) ], required=True) success = Boolean(required=True) data = Nested(ExperimentResultDataSchema, required=True) # Optional fields. status = String() seed = Integer() meas_return = String(validate=OneOf(['single', 'avg'])) header = Nested(ObjSchema)
class ExperimentResultSchema(BaseSchema): """Schema for ExperimentResult.""" # Required fields. shots = ByType([Integer(), List(Integer(validate=Range(min=1)), validate=Length(equal=2))], required=True) success = Boolean(required=True) data = Nested(ExperimentResultDataSchema, required=True) # Optional fields. status = String() seed = Integer() meas_level = Integer(validate=Range(min=0, max=2)) meas_return = String(validate=OneOf(choices=(MeasReturnType.AVERAGE, MeasReturnType.SINGLE))) header = Nested(ObjSchema)