Skip to content

Commit 68a1eca

Browse files
Replace parsed-literal with code-block (#13257)
* Replace parsed-literal with code-block * Manually set some code blocks to Python * Revert "Manually set some code blocks to Python" This reverts commit 7c5e4a1. * Fix missing blank lines * Fix missing indentation and template functions not buildilng docs * Fix rzx files * Add missing whitespace to base_scheduler.py * Skip Pylint * Update qiskit/circuit/library/templates/rzx/rzx_zz2.py --------- Co-authored-by: Jake Lishman <jake@binhbar.com>
1 parent 5517150 commit 68a1eca

File tree

165 files changed

+1089
-942
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+1089
-942
lines changed

qiskit/circuit/library/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
print(gate.power(1/2).to_matrix()) # √X gate
5757
print(gate.control(1).to_matrix()) # CX (controlled X) gate
5858
59-
.. parsed-literal::
59+
.. code-block:: text
6060
6161
[[0.+0.j 1.+0.j]
6262
[1.+0.j 0.+0.j]]
@@ -160,7 +160,7 @@
160160
diagonal = Diagonal([1, 1, 1, 1])
161161
print(diagonal.num_qubits)
162162
163-
.. parsed-literal::
163+
.. code-block:: text
164164
165165
1
166166
2

qiskit/circuit/library/arithmetic/adders/cdkm_ripple_carry_adder.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CDKMRippleCarryAdder(Adder):
2323
As an example, a ripple-carry adder circuit that performs addition on two 3-qubit sized
2424
registers with a carry-in bit (``kind="full"``) is as follows:
2525
26-
.. parsed-literal::
26+
.. code-block:: text
2727
2828
┌──────┐ ┌──────┐
2929
cin_0: ┤2 ├─────────────────────────────────────┤2 ├
@@ -54,7 +54,7 @@ class CDKMRippleCarryAdder(Adder):
5454
5555
The circuit diagram for the fixed-point adder (``kind="fixed"``) on 3-qubit sized inputs is
5656
57-
.. parsed-literal::
57+
.. code-block:: text
5858
5959
┌──────┐┌──────┐ ┌──────┐┌──────┐
6060
a_0: ┤0 ├┤2 ├────────────────┤2 ├┤0 ├

qiskit/circuit/library/arithmetic/adders/draper_qft_adder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DraperQFTAdder(Adder):
3131
As an example, a non-fixed_point QFT adder circuit that performs addition on two 2-qubit sized
3232
registers is as follows:
3333
34-
.. parsed-literal::
34+
.. code-block:: text
3535
3636
a_0: ─────────■──────■────────────────────────■────────────────
3737
│ │ │

qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class VBERippleCarryAdder(Adder):
2626
As an example, a classical adder circuit that performs full addition (i.e. including
2727
a carry-in bit) on two 2-qubit sized registers is as follows:
2828
29-
.. parsed-literal::
29+
.. code-block:: text
3030
3131
┌────────┐ ┌───────────┐┌──────┐
3232
cin_0: ┤0 ├───────────────────────┤0 ├┤0 ├

qiskit/circuit/library/arithmetic/linear_pauli_rotations.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class LinearPauliRotations(FunctionalPauliRotations):
2727
For a register of state qubits :math:`|x\rangle`, a target qubit :math:`|0\rangle` and the
2828
basis ``'Y'`` this circuit acts as:
2929
30-
.. parsed-literal::
30+
.. code-block:: text
3131
3232
q_0: ─────────────────────────■───────── ... ──────────────────────
3333

qiskit/circuit/library/arithmetic/multipliers/hrs_cumulative_multiplier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class HRSCumulativeMultiplier(Multiplier):
2626
the default adder is as follows (where ``Adder`` denotes the
2727
``CDKMRippleCarryAdder``):
2828
29-
.. parsed-literal::
29+
.. code-block:: text
3030
3131
a_0: ────■─────────────────────────
3232

qiskit/circuit/library/arithmetic/multipliers/rg_qft_multiplier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class RGQFTMultiplier(Multiplier):
3333
As an example, a circuit that performs a modular QFT multiplication on two 2-qubit
3434
sized input registers with an output register of 2 qubits, is as follows:
3535
36-
.. parsed-literal::
36+
.. code-block:: text
3737
3838
a_0: ────────────────────────────────────────■───────■──────■──────■────────────────
3939
│ │ │ │

qiskit/circuit/library/arithmetic/weighted_adder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class WeightedAdder(BlueprintCircuit):
4545
For an example where the state of 4 qubits is added into a sum register, the circuit can
4646
be schematically drawn as
4747
48-
.. parsed-literal::
48+
.. code-block:: text
4949
5050
┌────────┐
5151
state_0: ┤0 ├ | state_0 * weights[0]

qiskit/circuit/library/boolean_logic/inner_product.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class InnerProduct(QuantumCircuit):
3232
where the inner product of the top and bottom registers is 1. Otherwise it keeps
3333
the input intact.
3434
35-
.. parsed-literal::
35+
.. code-block:: text
3636
3737
3838
q0_0: ─■──────────

qiskit/circuit/library/data_preparation/_z_feature_map.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ZFeatureMap(PauliFeatureMap):
2424
2525
On 3 qubits and with 2 repetitions the circuit is represented by:
2626
27-
.. parsed-literal::
27+
.. code-block:: text
2828
2929
┌───┐┌─────────────┐┌───┐┌─────────────┐
3030
┤ H ├┤ P(2.0*x[0]) ├┤ H ├┤ P(2.0*x[0]) ├

qiskit/circuit/library/data_preparation/_zz_feature_map.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ZZFeatureMap(PauliFeatureMap):
2323
2424
For 3 qubits and 1 repetition and linear entanglement the circuit is represented by:
2525
26-
.. parsed-literal::
26+
.. code-block:: text
2727
2828
┌───┐┌────────────────┐
2929
┤ H ├┤ P(2.0*φ(x[0])) ├──■───────────────────────────■───────────────────────────────────
@@ -44,7 +44,8 @@ class ZZFeatureMap(PauliFeatureMap):
4444
prep = ZZFeatureMap(2, reps=1)
4545
print(prep.decompose())
4646
47-
.. parsed-literal::
47+
.. code-block:: text
48+
4849
┌───┐┌─────────────┐
4950
q_0: ┤ H ├┤ P(2.0*x[0]) ├──■──────────────────────────────────────■──
5051
├───┤├─────────────┤┌─┴─┐┌────────────────────────────────┐┌─┴─┐
@@ -57,15 +58,15 @@ class ZZFeatureMap(PauliFeatureMap):
5758
classifier = ZZFeatureMap(3).compose(EfficientSU2(3))
5859
classifier.num_parameters
5960
60-
.. parsed-literal::
61+
.. code-block:: text
6162
6263
27
6364
6465
.. code-block::
6566
6667
classifier.parameters # 'x' for the data preparation, 'θ' for the SU2 parameters
6768
68-
.. parsed-literal::
69+
.. code-block:: text
6970
7071
ParameterView([
7172
ParameterVectorElement(x[0]), ParameterVectorElement(x[1]),
@@ -88,7 +89,7 @@ class ZZFeatureMap(PauliFeatureMap):
8889
8990
classifier.count_ops()
9091
91-
.. parsed-literal::
92+
.. code-block:: text
9293
9394
OrderedDict([('ZZFeatureMap', 1), ('EfficientSU2', 1)])
9495

qiskit/circuit/library/data_preparation/pauli_feature_map.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def pauli_feature_map(
8686
8787
which will produce blocks of the form
8888
89-
.. parsed-literal::
89+
.. code-block:: text
9090
9191
┌───┐┌─────────────┐┌──────────┐ ┌───────────┐
9292
┤ H ├┤ P(2.0*x[0]) ├┤ RX(pi/2) ├──■──────────────────────────────────────■──┤ RX(-pi/2) ├
@@ -183,7 +183,7 @@ def z_feature_map(
183183
184184
On 3 qubits and with 2 repetitions the circuit is represented by:
185185
186-
.. parsed-literal::
186+
.. code-block:: text
187187
188188
┌───┐┌─────────────┐┌───┐┌─────────────┐
189189
┤ H ├┤ P(2.0*x[0]) ├┤ H ├┤ P(2.0*x[0]) ├
@@ -262,7 +262,7 @@ def zz_feature_map(
262262
263263
For 3 qubits and 1 repetition and linear entanglement the circuit is represented by:
264264
265-
.. parsed-literal::
265+
.. code-block:: text
266266
267267
┌───┐┌────────────────┐
268268
┤ H ├┤ P(2.0*φ(x[0])) ├──■───────────────────────────■───────────────────────────────────
@@ -353,7 +353,7 @@ class PauliFeatureMap(NLocal):
353353
354354
which will produce blocks of the form
355355
356-
.. parsed-literal::
356+
.. code-block:: text
357357
358358
┌───┐┌─────────────┐┌──────────┐ ┌───────────┐
359359
┤ H ├┤ P(2.0*x[0]) ├┤ RX(pi/2) ├──■──────────────────────────────────────■──┤ RX(-pi/2) ├

qiskit/circuit/library/generalized_gates/diagonal.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Diagonal(QuantumCircuit):
3434
3535
Circuit symbol:
3636
37-
.. parsed-literal::
37+
.. code-block:: text
3838
3939
┌───────────┐
4040
q_0: ┤0 ├

qiskit/circuit/library/generalized_gates/gms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class GMS(QuantumCircuit):
2929
3030
**Circuit symbol:**
3131
32-
.. parsed-literal::
32+
.. code-block:: text
3333
3434
┌───────────┐
3535
q_0: ┤0 ├

qiskit/circuit/library/generalized_gates/gr.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class GR(QuantumCircuit):
2121
2222
**Circuit symbol:**
2323
24-
.. parsed-literal::
24+
.. code-block:: text
2525
2626
┌──────────┐
2727
q_0: ┤0 ├
@@ -75,7 +75,7 @@ class GRX(GR):
7575
7676
**Circuit symbol:**
7777
78-
.. parsed-literal::
78+
.. code-block:: text
7979
8080
┌──────────┐
8181
q_0: ┤0 ├
@@ -123,7 +123,7 @@ class GRY(GR):
123123
124124
**Circuit symbol:**
125125
126-
.. parsed-literal::
126+
.. code-block:: text
127127
128128
┌──────────┐
129129
q_0: ┤0 ├
@@ -171,7 +171,7 @@ class GRZ(QuantumCircuit):
171171
172172
**Circuit symbol:**
173173
174-
.. parsed-literal::
174+
.. code-block:: text
175175
176176
┌──────────┐
177177
q_0: ┤0 ├

qiskit/circuit/library/generalized_gates/linear_function.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class LinearFunction(Gate):
3737
3838
**Example:** the circuit
3939
40-
.. parsed-literal::
40+
.. code-block:: text
4141
4242
q_0: ──■──
4343
┌─┴─┐

qiskit/circuit/library/generalized_gates/mcmt.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class MCMT(QuantumCircuit):
2929
3030
For example, the H gate controlled on 3 qubits and acting on 2 target qubit is represented as:
3131
32-
.. parsed-literal::
32+
.. code-block:: text
3333
3434
───■────
3535

qiskit/circuit/library/generalized_gates/rv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class RVGate(Gate):
2727
2828
**Circuit symbol:**
2929
30-
.. parsed-literal::
30+
.. code-block:: text
3131
3232
┌─────────────────┐
3333
q_0: ┤ RV(v_x,v_y,v_z) ├

qiskit/circuit/library/grover_operator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class GroverOperator(QuantumCircuit):
6161
Note that you can easily construct a phase oracle from a bitflip oracle by sandwiching the
6262
controlled X gate on the result qubit by a X and H gate. For instance
6363
64-
.. parsed-literal::
64+
.. code-block:: text
6565
6666
Bitflip oracle Phaseflip oracle
6767
q_0: ──■── q_0: ────────────■────────────

qiskit/circuit/library/n_local/efficient_su2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class EfficientSU2(TwoLocal):
3939
On 3 qubits and using the Pauli :math:`Y` and :math:`Z` su2_gates as single qubit gates, the
4040
hardware efficient SU(2) circuit is represented by:
4141
42-
.. parsed-literal::
42+
.. code-block:: text
4343
4444
┌──────────┐┌──────────┐ ░ ░ ░ ┌───────────┐┌───────────┐
4545
┤ RY(θ[0]) ├┤ RZ(θ[3]) ├─░────────■───░─ ... ─░─┤ RY(θ[12]) ├┤ RZ(θ[15]) ├

qiskit/circuit/library/n_local/n_local.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class NLocal(BlueprintCircuit):
5454
For instance, a rotation block on 2 qubits and an entanglement block on 4 qubits using
5555
``'linear'`` entanglement yields the following circuit.
5656
57-
.. parsed-literal::
57+
.. code-block:: text
5858
5959
┌──────┐ ░ ┌──────┐ ░ ┌──────┐
6060
┤0 ├─░─┤0 ├──────────────── ... ─░─┤0 ├

qiskit/circuit/library/n_local/pauli_two_design.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PauliTwoDesign(TwoLocal):
3737
For instance, the circuit could look like this (but note that choosing a different seed
3838
yields different Pauli rotations).
3939
40-
.. parsed-literal::
40+
.. code-block:: text
4141
4242
┌─────────┐┌──────────┐ ░ ┌──────────┐ ░ ┌──────────┐
4343
q_0: ┤ RY(π/4) ├┤ RZ(θ[0]) ├─■─────░─┤ RY(θ[4]) ├─■─────░──┤ RZ(θ[8]) ├

qiskit/circuit/library/n_local/real_amplitudes.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class RealAmplitudes(TwoLocal):
3535
For example a ``RealAmplitudes`` circuit with 2 repetitions on 3 qubits with ``'reverse_linear'``
3636
entanglement is
3737
38-
.. parsed-literal::
38+
.. code-block:: text
39+
3940
┌──────────┐ ░ ░ ┌──────────┐ ░ ░ ┌──────────┐
4041
┤ Ry(θ[0]) ├─░────────■───░─┤ Ry(θ[3]) ├─░────────■───░─┤ Ry(θ[6]) ├
4142
├──────────┤ ░ ┌─┴─┐ ░ ├──────────┤ ░ ┌─┴─┐ ░ ├──────────┤

qiskit/circuit/library/standard_gates/dcx.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ class DCXGate(SingletonGate):
2828
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
2929
with the :meth:`~qiskit.circuit.QuantumCircuit.dcx` method.
3030
31-
.. parsed-literal::
31+
.. code-block:: text
32+
3233
┌───┐
3334
q_0: ──■──┤ X ├
3435
┌─┴─┐└─┬─┘

qiskit/circuit/library/standard_gates/ecr.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ECRGate(SingletonGate):
3838
3939
**Circuit Symbol:**
4040
41-
.. parsed-literal::
41+
.. code-block:: text
4242
4343
┌─────────┐ ┌────────────┐┌────────┐┌─────────────┐
4444
q_0: ┤0 ├ q_0: ┤0 ├┤ RX(pi) ├┤0 ├
@@ -66,7 +66,7 @@ class ECRGate(SingletonGate):
6666
Instead, if we apply it on (q_1, q_0), the matrix will
6767
be :math:`Z \otimes X`:
6868
69-
.. parsed-literal::
69+
.. code-block:: text
7070
7171
┌─────────┐
7272
q_0: ┤1 ├

qiskit/circuit/library/standard_gates/h.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class HGate(SingletonGate):
3838
3939
**Circuit symbol:**
4040
41-
.. parsed-literal::
41+
.. code-block:: text
4242
4343
┌───┐
4444
q_0: ┤ H ├
@@ -142,7 +142,7 @@ class CHGate(SingletonControlledGate):
142142
143143
**Circuit symbol:**
144144
145-
.. parsed-literal::
145+
.. code-block:: text
146146
147147
q_0: ──■──
148148
┌─┴─┐
@@ -170,7 +170,8 @@ class CHGate(SingletonControlledGate):
170170
which in our case would be q_1. Thus a textbook matrix for this
171171
gate will be:
172172
173-
.. parsed-literal::
173+
.. code-block:: text
174+
174175
┌───┐
175176
q_0: ┤ H ├
176177
└─┬─┘

qiskit/circuit/library/standard_gates/i.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class IGate(SingletonGate):
4040
4141
**Circuit symbol:**
4242
43-
.. parsed-literal::
43+
.. code-block:: text
44+
4445
┌───┐
4546
q_0: ┤ I ├
4647
└───┘

0 commit comments

Comments
 (0)