-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Correct MitTask type #197
base: main
Are you sure you want to change the base?
Conversation
] | ||
|
||
qermit_result_list = postselection_task( | ||
( | ||
result_list, | ||
postselect_mgr_list, | ||
postselect_mgr_list, # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required since PostselectMgr, is not a recognised wire type. Simply adding it to the list of recognised wire types induces cyclic imports.
I don't really know what the right solution to this is...
I assume there must be a way to define a type annotation for PostselectMgr within mittask.py
although I have tried and failed to do that. User defined generic types might also help -> https://docs.python.org/3/library/typing.html#user-defined-generic-types but I think that only works for python 3.12. If you happen to know how to do something like that then I would be very interested to know about that.
Another solution is to move serialised versions of PostselectMgr along wires. As far as I can tell that is the best solution, but would be some significant work.
Another solution would be to allow Any as a wire type, which I don't want to do...
WireList = Union[ | ||
List[CircuitShots], | ||
List[Circuit], | ||
List[BackendResult], | ||
List[ResultHandle], | ||
List[AnsatzCircuit], | ||
List[ObservableExperiment], | ||
List[int], | ||
List[float], | ||
List[bool], | ||
List[str], | ||
List[QubitPauliOperator], | ||
List[Dict[Qubit, Bit]], | ||
List[Dict], | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if there is a more succinct way of doing this. I would like Tuple[List[Wire], ...]
to work but that assumes every List[Wire]
in Tuple
uses the same Wire
.
Very minor change. As this change touches everything I though I would double check incase I have misunderstood something.
Is this typing the way we have used MitTask in practice?
This was all done in an effort to get
working.