Skip to content

Commit

Permalink
disable=invalid-name at line level instead of file level (Qiskit#3242)
Browse files Browse the repository at this point in the history
* qiskit/qasm/node/customunitary.py

* qiskit/qasm/node/opaque.py

* qiskit/visualization/counts_visualization.py

* qiskit/visualization/pass_manager_visualization.py

* qiskit/visualization/gate_map.py

* qiskit/extensions/

* qiskit/qasm/node/qreg.py

* qiskit/quantum_info/states/measures.py

* qiskit/qasm/node/indexedid.py

* qiskit/qasm/node/creg.py

* qiskit/tools/jupyter/copyright.py

* qiskit/tools/jupyter/version_table.py

* qiskit/quantum_info/random/utils.py

* lint
  • Loading branch information
Luciano authored Oct 12, 2019
1 parent d84b0bb commit af714e3
Show file tree
Hide file tree
Showing 29 changed files with 104 additions and 147 deletions.
1 change: 0 additions & 1 deletion qiskit/extensions/quantum_initializer/diag.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# The structure of the code is based on Emanuel Malvetti's semester thesis at ETH in 2018,
# which was supervised by Raban Iten and Prof. Renato Renner.

# pylint: disable=invalid-name
# pylint: disable=missing-param-doc
# pylint: disable=missing-type-doc

Expand Down
10 changes: 4 additions & 6 deletions qiskit/extensions/quantum_initializer/ucrot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# The structure of the code is based on Emanuel Malvetti's semester thesis at ETH in 2018,
# which was supervised by Raban Iten and Prof. Renato Renner.

# pylint: disable=invalid-name

"""
(Abstract) base class for uniformly controlled (also called multiplexed) single-qubit rotations R_t.
This class provides a basis for the decomposition of uniformly controlled R_x,R_y and R_z gates
Expand Down Expand Up @@ -55,9 +53,9 @@ def __init__(self, angle_list, rot_axis):
if not isinstance(angle_list, list):
raise QiskitError("The angles are not provided in a list.")
# Check if the angles in angle_list are real numbers
for a in angle_list:
for angle in angle_list:
try:
float(a)
float(angle)
except TypeError:
raise QiskitError(
"An angle cannot be converted to type float (real angles are expected).")
Expand Down Expand Up @@ -165,5 +163,5 @@ def _dec_uc_rotations(angles, start_index, end_index, reversedDec):

# Calculate the new rotation angles according to Shende's decomposition

def _update_angles(a1, a2):
return (a1 + a2) / 2.0, (a1 - a2) / 2.0
def _update_angles(angle1, angle2):
return (angle1 + angle2) / 2.0, (angle1 - angle2) / 2.0
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/ch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
controlled-H gate.
"""
Expand Down Expand Up @@ -76,7 +74,7 @@ def to_matrix(self):
[0, 1/np.sqrt(2), 0, -1/np.sqrt(2)]], dtype=complex)


def ch(self, ctl, tgt):
def ch(self, ctl, tgt): # pylint: disable=invalid-name
"""Apply CH from ctl to tgt."""
return self.append(CHGate(), [ctl, tgt], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/cx.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
controlled-NOT gate.
"""
Expand Down Expand Up @@ -43,7 +41,7 @@ def to_matrix(self):
[0, 1, 0, 0]], dtype=complex)


def cx(self, ctl, tgt):
def cx(self, ctl, tgt): # pylint: disable=invalid-name
"""Apply CX from ctl to tgt."""
return self.append(CnotGate(), [ctl, tgt], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/cy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
controlled-Y gate.
"""
Expand Down Expand Up @@ -52,7 +50,7 @@ def inverse(self):
return CyGate() # self-inverse


def cy(self, ctl, tgt):
def cy(self, ctl, tgt): # pylint: disable=invalid-name
"""Apply CY to circuit."""
return self.append(CyGate(), [ctl, tgt], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/cz.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
controlled-Phase gate.
"""
Expand Down Expand Up @@ -60,7 +58,7 @@ def to_matrix(self):
[0, 0, 0, -1]], dtype=complex)


def cz(self, ctl, tgt):
def cz(self, ctl, tgt): # pylint: disable=invalid-name
"""Apply CZ to circuit."""
return self.append(CzGate(), [ctl, tgt], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/h.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
Hadamard gate.
"""
Expand Down Expand Up @@ -56,7 +54,7 @@ def to_matrix(self):
[1, -1]], dtype=complex) / numpy.sqrt(2)


def h(self, q):
def h(self, q): # pylint: disable=invalid-name
"""Apply H to q."""
return self.append(HGate(), [q], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/rx.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
Rotation around the x-axis.
"""
Expand Down Expand Up @@ -61,7 +59,7 @@ def to_matrix(self):
[-1j * sin, cos]], dtype=complex)


def rx(self, theta, q):
def rx(self, theta, q): # pylint: disable=invalid-name
"""Apply Rx to q."""
return self.append(RXGate(theta), [q], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/ry.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
Rotation around the y-axis.
"""
Expand Down Expand Up @@ -60,7 +58,7 @@ def to_matrix(self):
[sin, cos]], dtype=complex)


def ry(self, theta, q):
def ry(self, theta, q): # pylint: disable=invalid-name
"""Apply Ry to q."""
return self.append(RYGate(theta), [q], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/rz.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
Rotation around the z-axis.
"""
Expand Down Expand Up @@ -51,7 +49,7 @@ def inverse(self):
return RZGate(-self.params[0])


def rz(self, phi, q):
def rz(self, phi, q): # pylint: disable=invalid-name
"""Apply Rz to q."""
return self.append(RZGate(phi), [q], [])

Expand Down
8 changes: 3 additions & 5 deletions qiskit/extensions/standard/s.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
S=diag(1,i) Clifford phase gate or its inverse.
"""
Expand All @@ -39,7 +37,7 @@ def _define(self):
definition = []
q = QuantumRegister(1, "q")
rule = [
(U1Gate(pi/2), [q[0]], [])
(U1Gate(pi / 2), [q[0]], [])
]
for inst in rule:
definition.append(inst)
Expand Down Expand Up @@ -69,7 +67,7 @@ def _define(self):
definition = []
q = QuantumRegister(1, "q")
rule = [
(U1Gate(-pi/2), [q[0]], [])
(U1Gate(-pi / 2), [q[0]], [])
]
for inst in rule:
definition.append(inst)
Expand All @@ -85,7 +83,7 @@ def to_matrix(self):
[0, -1j]], dtype=complex)


def s(self, q):
def s(self, q): # pylint: disable=invalid-name
"""Apply S to q."""
return self.append(SGate(), [q], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/t.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
T=sqrt(S) phase gate or its inverse.
"""
Expand Down Expand Up @@ -85,7 +83,7 @@ def to_matrix(self):
[0, (1-1j) / numpy.sqrt(2)]], dtype=complex)


def t(self, q):
def t(self, q): # pylint: disable=invalid-name
"""Apply T to q."""
return self.append(TGate(), [q], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/u0.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
Single qubit gate cycle idle.
"""
Expand Down Expand Up @@ -54,7 +52,7 @@ def to_matrix(self):
[0, 1]], dtype=complex)


def u0(self, m, q):
def u0(self, m, q): # pylint: disable=invalid-name
"""Apply u0 with length m to q."""
return self.append(U0Gate(m), [q], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/extensions/standard/u1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""
Diagonal single qubit gate.
"""
Expand Down Expand Up @@ -52,7 +50,7 @@ def to_matrix(self):
return numpy.array([[1, 0], [0, numpy.exp(1j * lam)]], dtype=complex)


def u1(self, theta, q):
def u1(self, theta, q): # pylint: disable=invalid-name
"""Apply u1 with angle theta to q."""
return self.append(U1Gate(theta), [q], [])

Expand Down
3 changes: 1 addition & 2 deletions qiskit/extensions/standard/u2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name
"""
One-pulse single-qubit gate.
"""
Expand Down Expand Up @@ -59,7 +58,7 @@ def to_matrix(self):
dtype=complex)


def u2(self, phi, lam, q):
def u2(self, phi, lam, q): # pylint: disable=invalid-name
"""Apply u2 to q."""
return self.append(U2Gate(phi, lam), [q], [])

Expand Down
4 changes: 2 additions & 2 deletions qiskit/extensions/standard/u3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name
"""
Two-pulse single-qubit gate.
"""

import numpy
from qiskit.circuit import Gate
from qiskit.circuit import QuantumCircuit
Expand Down Expand Up @@ -51,7 +51,7 @@ def to_matrix(self):
dtype=complex)


def u3(self, theta, phi, lam, q):
def u3(self, theta, phi, lam, q): # pylint: disable=invalid-name
"""Apply u3 to q."""
return self.append(U3Gate(theta, phi, lam), [q], [])

Expand Down
4 changes: 1 addition & 3 deletions qiskit/qasm/node/creg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""Node for an OPENQASM creg statement."""

from .node import Node
Expand All @@ -29,7 +27,7 @@ def __init__(self, children):
"""Create the creg node."""
super().__init__('creg', children, None)
# This is the indexed id, the full "id[n]" object
self.id = children[0]
self.id = children[0] # pylint: disable=invalid-name
# Name of the creg
self.name = self.id.name
# Source line number
Expand Down
4 changes: 1 addition & 3 deletions qiskit/qasm/node/customunitary.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""Node for an OPENQASM custom gate statement."""

from .node import Node
Expand All @@ -36,7 +34,7 @@ class CustomUnitary(Node):
def __init__(self, children):
"""Create the custom gate node."""
super().__init__('custom_unitary', children, None)
self.id = children[0]
self.id = children[0] # pylint: disable=invalid-name
self.name = self.id.name
if len(children) == 3:
self.arguments = children[1]
Expand Down
4 changes: 1 addition & 3 deletions qiskit/qasm/node/gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""Node for an OPENQASM gate definition."""

from .node import Node
Expand All @@ -32,7 +30,7 @@ class Gate(Node):
def __init__(self, children):
"""Create the gate node."""
super().__init__('gate', children, None)
self.id = children[0]
self.id = children[0] # pylint: disable=invalid-name
# The next three fields are required by the symbtab
self.name = self.id.name
self.line = self.id.line
Expand Down
4 changes: 1 addition & 3 deletions qiskit/qasm/node/indexedid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""Node for an OPENQASM indexed id."""

from .node import Node
Expand All @@ -29,7 +27,7 @@ class IndexedId(Node):
def __init__(self, children):
"""Create the indexed id node."""
super().__init__('indexed_id', children, None)
self.id = children[0]
self.id = children[0] # pylint: disable=invalid-name
self.name = self.id.name
self.line = self.id.line
self.file = self.id.file
Expand Down
4 changes: 1 addition & 3 deletions qiskit/qasm/node/opaque.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""Node for an OPENQASM opaque gate declaration."""

from .node import Node
Expand All @@ -31,7 +29,7 @@ class Opaque(Node):
def __init__(self, children):
"""Create the opaque gate node."""
super().__init__('opaque', children, None)
self.id = children[0]
self.id = children[0] # pylint: disable=invalid-name
# The next three fields are required by the symbtab
self.name = self.id.name
self.line = self.id.line
Expand Down
Loading

0 comments on commit af714e3

Please sign in to comment.