I met a problem when I wrote the followed lines of codes:
from artiq.coredevice.core import Core
from artiq.coredevice.zotino import Zotino
from artiq.experiment import *
class ExampleCode(EnvExperiment):
def build(self):
# The host process some arguments and add some handler to the followed list
# the list may or may not be empty
self.deviceList = []
self.deviceLength: int = len(self.deviceList)
@kernel
def run(self):
# I placed some core device action here.
# with the followed line, I could raise "Type can't not be fully inferred" error
for i in range(self.deviceLength):
deviceHandler = self.deviceList[i]
If a variable request a member of a list which may be or may not be empty, it would raise type annotation error when the code is executed with this list is empty. I tried to explicitly mark its type(such as: Zotino AD53XX or AD9910), and I found that it won't work because these are not belong to ARTIQ types.
So here I would like to request some tips for the followed questions:
- How ARTIQ actually process a "Device" type when "Device" type is not an ARTIQ type
- How may I explicitly infer a variable to be "Zotino" type or some other core device type, instead of leave it
to be infered by the complier
Thank you for your help in advance