From cbba76c516cbf372903a336b17fdeb2c31cd6d57 Mon Sep 17 00:00:00 2001 From: Marco Antonio Barroca Date: Fri, 1 Mar 2024 14:02:55 -0300 Subject: [PATCH] Fix pylint errors due to version update (#1348) * 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> --- qiskit_nature/second_q/operators/bosonic_op.py | 5 ++--- qiskit_nature/second_q/operators/fermionic_op.py | 5 ++--- qiskit_nature/second_q/operators/spin_op.py | 5 ++--- qiskit_nature/second_q/problems/properties_container.py | 5 ++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/qiskit_nature/second_q/operators/bosonic_op.py b/qiskit_nature/second_q/operators/bosonic_op.py index 86e5ae43d..56ce46bc5 100644 --- a/qiskit_nature/second_q/operators/bosonic_op.py +++ b/qiskit_nature/second_q/operators/bosonic_op.py @@ -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 @@ -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 " diff --git a/qiskit_nature/second_q/operators/fermionic_op.py b/qiskit_nature/second_q/operators/fermionic_op.py index 72a48b2d3..2fb19bee6 100644 --- a/qiskit_nature/second_q/operators/fermionic_op.py +++ b/qiskit_nature/second_q/operators/fermionic_op.py @@ -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 @@ -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 " diff --git a/qiskit_nature/second_q/operators/spin_op.py b/qiskit_nature/second_q/operators/spin_op.py index adc53dee0..5dd9eaebb 100644 --- a/qiskit_nature/second_q/operators/spin_op.py +++ b/qiskit_nature/second_q/operators/spin_op.py @@ -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 @@ -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 " diff --git a/qiskit_nature/second_q/problems/properties_container.py b/qiskit_nature/second_q/problems/properties_container.py index 3fa04794b..4a751d25b 100644 --- a/qiskit_nature/second_q/problems/properties_container.py +++ b/qiskit_nature/second_q/problems/properties_container.py @@ -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 @@ -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.