Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Commit 95d4f57

Browse files
Fix pylint errors (#1615) (#1616)
1 parent a7c4e90 commit 95d4f57

File tree

13 files changed

+24
-26
lines changed

13 files changed

+24
-26
lines changed

constraints.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
astroid==2.5
2-
pylint==2.7.1
1+
astroid==2.5.6
2+
pylint==2.8.3
33
numpy>=1.20.0 ; python_version>'3.6'

qiskit/aqua/components/uncertainty_models/uncertainty_model.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of Qiskit.
22
#
3-
# (C) Copyright IBM 2018, 2020.
3+
# (C) Copyright IBM 2018, 2021.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -25,8 +25,6 @@ class UncertaintyModel(CircuitFactory, ABC):
2525
The abstract Uncertainty Model
2626
"""
2727

28-
__REPLACEMENT = 'a qiskit.QuantumCircuit'
29-
3028
# pylint: disable=useless-super-delegation
3129
def __init__(self, num_target_qubits: int) -> None:
3230
validate_min('num_target_qubits', num_target_qubits, 1)

qiskit/aqua/components/uncertainty_problems/multivariate_problem.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of Qiskit.
22
#
3-
# (C) Copyright IBM 2019, 2020.
3+
# (C) Copyright IBM 2019, 2021.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -190,7 +190,7 @@ def build(self, qc, q, q_ancillas=None, params=None):
190190

191191
else:
192192

193-
for j in range(len(self._conditions)):
193+
for j, _ in enumerate(self._conditions):
194194

195195
dimension = self._conditions[j][0]
196196
condition = self._conditions[j][1]
@@ -233,7 +233,7 @@ def build(self, qc, q, q_ancillas=None, params=None):
233233
qc.mct(q_cond_target[:-1], q_cond_target[-1], q_rem_ancillas)
234234

235235
# uncompute condition
236-
for j in range(len(self._conditions)):
236+
for j, _ in enumerate(self._conditions):
237237

238238
dimension = self._conditions[j][0]
239239
condition = self._conditions[j][1]

qiskit/aqua/operators/legacy/weighted_pauli_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def _scaling_weight(self, scaling_factor, copy=False):
267267
"Type of scaling factor is a valid type. {} if given.".format(
268268
scaling_factor.__class__))
269269
ret = self.copy() if copy else self
270-
for idx in range(len(ret._paulis)):
270+
for idx, _ in enumerate(ret._paulis):
271271
ret._paulis[idx] = [ret._paulis[idx][0] * scaling_factor, ret._paulis[idx][1]]
272272
return ret
273273

qiskit/aqua/utils/run_circuits.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def _maybe_split_qobj_by_gates(qobjs: List[QasmQobj], qobj: QasmQobj) -> List[Qa
106106
if MAX_GATES_PER_JOB is not None:
107107
max_gates_per_job = int(MAX_GATES_PER_JOB)
108108
total_num_gates = 0
109-
for j in range(len(qobj.experiments)):
109+
for j, _ in enumerate(qobj.experiments):
110110
total_num_gates += len(qobj.experiments[j].instructions)
111111
# split by gates if total number of gates in a qobj exceed MAX_GATES_PER_JOB
112112
if total_num_gates > max_gates_per_job:
@@ -116,7 +116,7 @@ def _maybe_split_qobj_by_gates(qobjs: List[QasmQobj], qobj: QasmQobj) -> List[Qa
116116
temp_qobj.qobj_id = str(uuid.uuid4())
117117
temp_qobj.experiments = []
118118
num_gates = 0
119-
for i in range(len(qobj.experiments)):
119+
for i, _ in enumerate(qobj.experiments):
120120
num_gates += len(qobj.experiments[i].instructions)
121121
if num_gates <= max_gates_per_job:
122122
temp_qobj.experiments.append(qobj.experiments[i])

qiskit/chemistry/bosonic_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def direct_mapping_filtering_criterion(self, state: Union[List, np.ndarray], val
227227
dtype='S1').astype(int)
228228
count = 0
229229
nqi = 0
230-
for m in range(len(self._basis)):
230+
for m, _ in enumerate(self._basis):
231231
sub_bin = bin_i[nqi:nqi + self._basis[m]]
232232
occ_i = 0
233233
for idx_i in sub_bin:

qiskit/chemistry/components/variational_forms/uccsd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def __init__(self,
190190

191191
# this will order the hopping operators
192192
self.labeled_double_excitations = []
193-
for i in range(len(self._double_excitations)):
193+
for i, _ in enumerate(self._double_excitations):
194194
self.labeled_double_excitations.append((self._double_excitations[i], i))
195195

196196
order_hopping_op = UCCSD.order_labels_for_hopping_ops(self._double_excitations,

qiskit/chemistry/drivers/fcidumpd/fcidumpdriver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from ...qiskit_chemistry_error import QiskitChemistryError
1818
from ...qmolecule import QMolecule
1919
from .dumper import dump
20-
from .parser import parse
20+
from .parser import parse # pylint: disable=deprecated-module
2121

2222

2323
class FCIDumpDriver(FermionicDriver):

qiskit/chemistry/results/vibronic_structure_result.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of Qiskit.
22
#
3-
# (C) Copyright IBM 2020.
3+
# (C) Copyright IBM 2020, 2021.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -73,7 +73,7 @@ def formatted(self) -> List[str]:
7373
format(np.round(self.computed_vibronic_energies[0], 12)))
7474
if len(self.num_occupied_modals_per_mode) > 0:
7575
lines.append('The number of occupied modals is')
76-
for i in range(len(self.num_occupied_modals_per_mode)):
76+
for i, _ in enumerate(self.num_occupied_modals_per_mode):
7777
lines.append('- Mode {}: {}'.format(i, self.num_occupied_modals_per_mode[i]))
7878

7979
return lines

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
coverage>=4.4.0
22
matplotlib>=2.1
33
pycodestyle
4-
pylint>=2.7.1
4+
pylint>=2.8.3
55
pylintfileheader>=0.0.2
66
pylatexenc>=1.4
77
stestr>=2.0.0

0 commit comments

Comments
 (0)