From 564a9fc4f0951301e6d40efde0ffebe123e3c96f Mon Sep 17 00:00:00 2001 From: Luciano Bello Date: Thu, 18 Jun 2020 04:12:45 -0400 Subject: [PATCH] remove draw(..., line_length, ...) (deprecated after #3108) (#4507) * remove line_length * release note Co-authored-by: Julien Gacon Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- qiskit/circuit/quantumcircuit.py | 10 +--------- qiskit/visualization/circuit_visualization.py | 15 +-------------- .../line_length_remove_0.10-d13e5a15524e67c0.yaml | 5 +++++ 3 files changed, 7 insertions(+), 23 deletions(-) create mode 100644 releasenotes/notes/line_length_remove_0.10-d13e5a15524e67c0.yaml diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index ac649bd51fdd..efa7af9b725e 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -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. @@ -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 @@ -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, diff --git a/qiskit/visualization/circuit_visualization.py b/qiskit/visualization/circuit_visualization.py index aaf0facd2d33..bc7f7659b5ba 100644 --- a/qiskit/visualization/circuit_visualization.py +++ b/qiskit/visualization/circuit_visualization.py @@ -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, @@ -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 @@ -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, @@ -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): @@ -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 @@ -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 diff --git a/releasenotes/notes/line_length_remove_0.10-d13e5a15524e67c0.yaml b/releasenotes/notes/line_length_remove_0.10-d13e5a15524e67c0.yaml new file mode 100644 index 000000000000..9b3f63fe5eea --- /dev/null +++ b/releasenotes/notes/line_length_remove_0.10-d13e5a15524e67c0.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + In 0.10 the parameter ``line_length`` in the method ``QuantumCircuit.draw`` was deprecated. + This parameter is being removed.