Validate input when setting the QuantumCircuit data attribute directly
See original GitHub issueSimilar to #2170 , but for QuantumCircuit
. The possibility of arbitrary data in circuit.data
makes modifying or replacing the internals of QuantumCircuit
difficult and error prone (see discussion around circuit._append
in #2824 ). We should:
- Move
circuit.data
tocircuit._data
- Add a getter for
circuit.data
and document it as a ordered list of(Instruction, qargs, cargs)
. It’s an open question whether or not we should commit to preserving user-insertion order. - Add a setter for
circuit.data
with aDeprecationWarning
, directing users to e.g.QuantumCircuit.append
and the rest of the circuit API.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
qiskit.circuit.QuantumCircuit
This gets stored as free-form data in a dict in the metadata attribute. It will not be directly used in the circuit. Raises....
Read more >How to pass a condition via Data Attribute to JS for validation
Although this obviously isn't the direct answer to your question, it is my suggestion for how to build form validation. – Steven Moseley....
Read more >Validate your Data's Attributes with the AttributeValidator ...
FME has always been able to validate your data attributes using transformers such as the Tester, AttirbuteCreator (with conditional values), Joiner (to use ......
Read more >AttributeError: 'QuantumCircuit' object has no attribute ...
Qiskit (to my knowledge) does not directly support feed-forward simulation, so I attempted a work-around. I call the simulator firstly:
Read more >How to: Customize Data Field Validation in the Data Model ...
In the Name box, enter the name of the custom validation attribute class. You can use any name that is not already being...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks!
The relevant part of Ignis is in here: the
_make_syndrome_graph()
method ofGraphDecoder
. Any incompatible changes in.data()
can be expected to cause this test to fail.Hi @quantumjim , the title of this issue is somewhat outdated (see the two comments preceding yours, and the PR #2838 ). The current plan is for
circuit.data()
to remain in place with the same list-like interface, but with changes tocircuit.data()
being validated to make sure they are of the rightInstruction, qargs, cargs
format. Existing code should continue to work.Can you link to the example in ignis that works with
.data()
? It would be handy to have as a test case.