Skip to content

Commit 076ec9c

Browse files
committed
Soften warnings about unsupported Expr nodes
1 parent 2b31d49 commit 076ec9c

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

qiskit/circuit/quantumcircuit.py

+7
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,13 @@ def draw(
17941794
17951795
**latex_source**: raw uncompiled latex output.
17961796
1797+
.. warning::
1798+
1799+
Support for :class:`~.expr.Expr` nodes in conditions and :attr:`.SwitchCaseOp.target`
1800+
fields is preliminary and incomplete. The ``text`` and ``mpl`` drawers will make a
1801+
best-effort attempt to show data dependencies, but the LaTeX-based drawers will skip
1802+
these completely.
1803+
17971804
Args:
17981805
output (str): select the output method to use for drawing the circuit.
17991806
Valid choices are ``text``, ``mpl``, ``latex``, ``latex_source``.

qiskit/visualization/circuit/circuit_visualization.py

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ def circuit_drawer(
7373
7474
**latex_source**: raw uncompiled latex output.
7575
76+
.. warning::
77+
78+
Support for :class:`~.expr.Expr` nodes in conditions and :attr:`.SwitchCaseOp.target` fields
79+
is preliminary and incomplete. The ``text`` and ``mpl`` drawers will make a best-effort
80+
attempt to show data dependencies, but the LaTeX-based drawers will skip these completely.
81+
7682
Args:
7783
circuit (QuantumCircuit): the quantum circuit to draw
7884
scale (float): scale of image to draw (shrink if < 1.0). Only used by

qiskit/visualization/circuit/matplotlib.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,8 @@ def _condition(self, node, node_data, wire_map, cond_xy, glob_data):
11071107
cond_pos = []
11081108

11091109
if isinstance(condition, expr.Expr):
1110-
warn("runtime-expression conditions are not properly supported yet")
1110+
# If fixing this, please update the docstrings of `QuantumCircuit.draw` and
1111+
# `visualization.circuit_drawer` to remove warnings.
11111112
condition_bits = condition_resources(condition).clbits
11121113
label = "[expression]"
11131114
override_fc = True

qiskit/visualization/circuit/text.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,8 @@ def set_cl_multibox(self, condition, top_connect="┴"):
13481348
List: list of tuples of connections between clbits for multi-bit conditions
13491349
"""
13501350
if isinstance(condition, expr.Expr):
1351-
warn("runtime-expression conditions are not properly supported yet")
1351+
# If fixing this, please update the docstrings of `QuantumCircuit.draw` and
1352+
# `visualization.circuit_drawer` to remove warnings.
13521353
label = "<expression>"
13531354
out = []
13541355
condition_bits = node_resources(condition).clbits

0 commit comments

Comments
 (0)