class HistogramSchema(BaseSchema): """Example HistogramSchema schema with strict dict structure validation.""" counts = fields.Nested(ObjSchema, validate=PatternProperties({ Regexp('^0x([0-9A-Fa-f])+$'): fields.Integer() }))
class PulseHamiltonianSchema(BaseSchema): """Schema for PulseHamiltonian.""" # Required properties. h_str = fields.List(fields.String(), validate=Length(min=1), required=True) dim_osc = fields.List(fields.Integer(validate=Range(min=1)), required=True) dim_qub = fields.List(fields.Integer(validate=Range(min=2)), required=True) vars = fields.Dict(validate=PatternProperties( {Regexp('^([a-z0-9])+$'): fields.InstructionParameter()}), required=True)
class ExperimentResultDataSchema(BaseSchema): """Schema for ExperimentResultData.""" counts = Nested(ObjSchema, validate=PatternProperties( {Regexp('^0x([0-9A-Fa-f])+$'): Integer()})) snapshots = Nested(ObjSchema) memory = List(Raw(), validate=Length(min=1)) statevector = List(Complex(), validate=Length(min=1)) unitary = List(List(Complex(), validate=Length(min=1)), validate=Length(min=1))
class PulseHamiltonianSchema(BaseSchema): """Schema for PulseHamiltonian.""" # pylint: disable=redefined-builtin # Required properties. h_str = List(String(), validate=Length(min=1), required=True) dim_osc = List(Integer(validate=Range(min=1)), required=True) dim_qub = List(Integer(validate=Range(min=2)), required=True) vars = Dict(validate=PatternProperties( {Regexp('^([a-z0-9])+$'): InstructionParameter()}), required=True)