Skip to content

Commit

Permalink
remove draw(..., line_length, ...) (deprecated after Qiskit#3108) (Qi…
Browse files Browse the repository at this point in the history
…skit#4507)

* remove line_length

* release note

Co-authored-by: Julien Gacon <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 18, 2020
1 parent 1ad9cac commit 564a9fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
10 changes: 1 addition & 9 deletions qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ def qasm(self, formatted=False, filename=None):
return string_temp

def draw(self, output=None, scale=0.7, filename=None, style=None,
interactive=False, line_length=None, plot_barriers=True,
interactive=False, plot_barriers=True,
reverse_bits=False, justify=None, vertical_compression='medium', idle_wires=True,
with_layout=True, fold=None, ax=None, initial_state=False, cregbundle=False):
"""Draw the quantum circuit.
Expand Down Expand Up @@ -833,13 +833,6 @@ def draw(self, output=None, scale=0.7, filename=None, style=None,
supporting this). Note when used with either the `text` or the
`latex_source` output type this has no effect and will be
silently ignored.
line_length (int): Deprecated; see `fold` which supersedes this
option. Sets the length of the lines generated by `text` output
type. This is useful when the drawing does not fit in the console.
If None (default), it will try to guess the console width using
``shutil.get_terminal_size()``. However, if you're running in
jupyter, the default line length is set to 80 characters. If you
don't want pagination at all, set ``line_length=-1``.
reverse_bits (bool): When set to True, reverse the bit order inside
registers for the output visualization.
plot_barriers (bool): Enable/disable drawing barriers in the output
Expand Down Expand Up @@ -1009,7 +1002,6 @@ def draw(self, output=None, scale=0.7, filename=None, style=None,
filename=filename, style=style,
output=output,
interactive=interactive,
line_length=line_length,
plot_barriers=plot_barriers,
reverse_bits=reverse_bits,
justify=justify,
Expand Down
15 changes: 1 addition & 14 deletions qiskit/visualization/circuit_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def circuit_drawer(circuit,
style=None,
output=None,
interactive=False,
line_length=None,
plot_barriers=True,
reverse_bits=False,
justify=None,
Expand Down Expand Up @@ -99,13 +98,6 @@ def circuit_drawer(circuit,
supporting this). Note when used with either the `text` or the
`latex_source` output type this has no effect and will be silently
ignored.
line_length (int): Deprecated, see `fold` which supersedes this option.
Sets the length of the lines generated by `text` output type.
This useful when the drawing does not fit in the console. If None
(default), it will try to guess the console width using
``shutil.get_terminal_size()``. However, if you're running in
jupyter the default line length is set to 80 characters. If you
don't want pagination at all, set ``line_length=-1``.
reverse_bits (bool): When set to True reverse the bit order inside
registers for the output visualization.
plot_barriers (bool): Enable/disable drawing barriers in the output
Expand Down Expand Up @@ -282,7 +274,6 @@ def circuit_drawer(circuit,

if output == 'text':
return _text_circuit_drawer(circuit, filename=filename,
line_length=line_length,
reverse_bits=reverse_bits,
plot_barriers=plot_barriers,
justify=justify,
Expand Down Expand Up @@ -411,7 +402,7 @@ def qx_color_scheme():
# -----------------------------------------------------------------------------


def _text_circuit_drawer(circuit, filename=None, line_length=None, reverse_bits=False,
def _text_circuit_drawer(circuit, filename=None, reverse_bits=False,
plot_barriers=True, justify=None, vertical_compression='high',
idle_wires=True, with_layout=True, fold=None, initial_state=True,
cregbundle=False):
Expand All @@ -420,7 +411,6 @@ def _text_circuit_drawer(circuit, filename=None, line_length=None, reverse_bits=
Args:
circuit (QuantumCircuit): Input circuit
filename (str): optional filename to write the result
line_length (int): Deprecated. See `fold`.
reverse_bits (bool): Rearrange the bits in reverse order.
plot_barriers (bool): Draws the barriers when they are there.
justify (str) : `left`, `right` or `none`. Defaults to `left`. Says how
Expand Down Expand Up @@ -449,9 +439,6 @@ def _text_circuit_drawer(circuit, filename=None, line_length=None, reverse_bits=
layout = circuit._layout
else:
layout = None
if line_length:
warn('The parameter "line_length" is being replaced by "fold"', DeprecationWarning, 3)
fold = line_length
text_drawing = _text.TextDrawing(qregs, cregs, ops, layout=layout, initial_state=initial_state,
cregbundle=cregbundle)
text_drawing.plotbarriers = plot_barriers
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
upgrade:
- |
In 0.10 the parameter ``line_length`` in the method ``QuantumCircuit.draw`` was deprecated.
This parameter is being removed.

0 comments on commit 564a9fc

Please sign in to comment.