Skip to content

Commit

Permalink
Fix pylint errors due to version update (#1348)
Browse files Browse the repository at this point in the history
* fix pylint errors due to version update

* fix copyright years

* Update qiskit_nature/second_q/operators/bosonic_op.py

---------

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
  • Loading branch information
MarcoBarroca and woodsp-ibm committed Mar 1, 2024
1 parent a7d9253 commit cbba76c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions qiskit_nature/second_q/operators/bosonic_op.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2023.
# (C) Copyright IBM 2023, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -214,8 +214,7 @@ def _validate_keys(self, keys: Collection[str]) -> None:
for term in key.split():
index = int(term[2:])
if num_so is None:
if index > max_index:
max_index = index
max_index = max(max_index, index)
elif index >= num_so:
raise QiskitNatureError(
f"The index, {index}, from the label, {key}, exceeds the number of spin "
Expand Down
5 changes: 2 additions & 3 deletions qiskit_nature/second_q/operators/fermionic_op.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2021, 2023.
# (C) Copyright IBM 2021, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -216,8 +216,7 @@ def _validate_keys(self, keys: Collection[str]) -> None:
for term in key.split():
index = int(term[2:])
if num_so is None:
if index > max_index:
max_index = index
max_index = max(max_index, index)
elif index >= num_so:
raise QiskitNatureError(
f"The index, {index}, from the label, {key}, exceeds the number of spin "
Expand Down
5 changes: 2 additions & 3 deletions qiskit_nature/second_q/operators/spin_op.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2021, 2023.
# (C) Copyright IBM 2021, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -275,8 +275,7 @@ def _validate_keys(self, keys: Collection[str]) -> None:
# sub_terms[0] is the base, sub_terms[1] is the (optional) exponent
index = int(sub_terms[0][2:])
if num_s is None:
if index > max_index:
max_index = index
max_index = max(max_index, index)
elif index >= num_s:
raise QiskitNatureError(
f"The index, {index}, from the label, {key}, exceeds the number of "
Expand Down
5 changes: 2 additions & 3 deletions qiskit_nature/second_q/problems/properties_container.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2022, 2023.
# (C) Copyright IBM 2022, 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand Down Expand Up @@ -80,8 +80,7 @@ def __len__(self) -> int:
return len(self._properties)

def __iter__(self) -> Generator[SparseLabelOpsFactory, None, None]:
for prop in self._properties.values():
yield prop
yield from self._properties.values()

def _getter(self, _type: type) -> SparseLabelOpsFactory | None:
"""An internal utility method to handle the attribute getter implementation.
Expand Down

0 comments on commit cbba76c

Please sign in to comment.