qat.qlmaas.upload.MetaLocalGenerator

The MetaLocalGenerator() metaclass is used for defining a qat.generators.UploadedGenerator.

qat.qlmaas.upload.MetaLocalGenerator(class_name, parents, attributes)

Local Generator meta class. Generator defined using this class can be uploaded using using UploadedGenerator.

from qat.qlmaas.upload import MetaLocalGenerator
from qat.generators import AbstractGenerator
from qat.lang.AQASM import Program

class LocalGenerator(metaclass=MetaLocalGenerator):
    " Uploadable Generator "
    def generate(self, specs):
        " Generates a batch. This function should return either an iterator or a Batch "
        prog = Program()
        ...
        yield prog.to_circ().to_job()

print("Is LocalGenerator a generator?", issubclass(LocalGenerator, AbstractGenerator))
Is LocalGenerator a generator? True