From 342e1a010b5871c2995ef9d20263dfc2d2483547 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 18:24:09 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v6.0.0) - https://github.com/PyCQA/doc8/: v1.1.1 → v2.0.0 - [github.com/codespell-project/codespell: v2.2.6 → v2.4.1](https://github.com/codespell-project/codespell/compare/v2.2.6...v2.4.1) - [github.com/adrienverge/yamllint.git: v1.35.1 → v1.37.1](https://github.com/adrienverge/yamllint.git/compare/v1.35.1...v1.37.1) - [github.com/asottile/pyupgrade: v3.15.2 → v3.21.2](https://github.com/asottile/pyupgrade/compare/v3.15.2...v3.21.2) - [github.com/PyCQA/isort: 5.13.2 → 7.0.0](https://github.com/PyCQA/isort/compare/5.13.2...7.0.0) - https://github.com/psf/black → https://github.com/psf/black-pre-commit-mirror - [github.com/psf/black-pre-commit-mirror: 24.3.0 → 25.11.0](https://github.com/psf/black-pre-commit-mirror/compare/24.3.0...25.11.0) - [github.com/asottile/blacken-docs: 1.16.0 → 1.20.0](https://github.com/asottile/blacken-docs/compare/1.16.0...1.20.0) - [github.com/PyCQA/flake8: 7.0.0 → 7.3.0](https://github.com/PyCQA/flake8/compare/7.0.0...7.3.0) - [github.com/mgedmin/check-manifest: 0.49 → 0.51](https://github.com/mgedmin/check-manifest/compare/0.49...0.51) --- .pre-commit-config.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cf59ca9c..98c5830e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: - id: check-useless-excludes - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v6.0.0 hooks: - id: check-added-large-files - id: check-ast @@ -52,14 +52,14 @@ repos: additional_dependencies: [toml] - repo: https://github.com/PyCQA/doc8/ - rev: v1.1.1 + rev: v2.0.0 hooks: - id: doc8 require_serial: false additional_dependencies: [tomli] - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.4.1 hooks: - id: codespell require_serial: false @@ -67,38 +67,38 @@ repos: args: [-S, '.git,third_party', -I, .codespell.allow] - repo: https://github.com/adrienverge/yamllint.git - rev: v1.35.1 + rev: v1.37.1 hooks: - id: yamllint require_serial: false - repo: https://github.com/asottile/pyupgrade - rev: v3.15.2 + rev: v3.21.2 hooks: - id: pyupgrade args: [--py37-plus, --keep-mock] - repo: https://github.com/PyCQA/isort - rev: 5.13.2 + rev: 7.0.0 hooks: - id: isort name: isort (python) - - repo: https://github.com/psf/black - rev: 24.3.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 25.11.0 hooks: - id: black language_version: python3 - repo: https://github.com/asottile/blacken-docs - rev: 1.16.0 + rev: 1.20.0 hooks: - id: blacken-docs args: [-S, -l, '120'] additional_dependencies: [black==22.10.0] - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 + rev: 7.3.0 hooks: - id: flake8 name: flake8-strict @@ -120,7 +120,7 @@ repos: additional_dependencies: [pybind11>=2.6, numpy, requests, matplotlib, networkx] - repo: https://github.com/mgedmin/check-manifest - rev: '0.49' + rev: '0.51' hooks: - id: check-manifest additional_dependencies: ['setuptools-scm', 'pybind11>=2.6'] From 9b00ebc8ead386e603bb7fecdee0b00f430232a0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 18:25:24 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../_awsbraket/_awsbraket_boto3_client_test.py | 4 ++-- projectq/backends/_awsbraket/_awsbraket_test.py | 2 +- projectq/backends/_circuits/_plot_test.py | 8 ++++---- projectq/backends/_ibm/_ibm_test.py | 8 ++------ projectq/ops/_command_test.py | 16 ++++------------ 5 files changed, 13 insertions(+), 25 deletions(-) diff --git a/projectq/backends/_awsbraket/_awsbraket_boto3_client_test.py b/projectq/backends/_awsbraket/_awsbraket_boto3_client_test.py index 2b6e33e0..6925f133 100644 --- a/projectq/backends/_awsbraket/_awsbraket_boto3_client_test.py +++ b/projectq/backends/_awsbraket/_awsbraket_boto3_client_test.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -""" Test for projectq.backends._awsbraket._awsbraket_boto3_client.py """ +"""Test for projectq.backends._awsbraket._awsbraket_boto3_client.py""" import pytest @@ -282,7 +282,7 @@ def test_send_that_errors_are_caught(mocker, var_error, send_that_error_setup): @has_boto3 -@pytest.mark.parametrize("var_error", [('ResourceNotFoundException')]) +@pytest.mark.parametrize("var_error", ['ResourceNotFoundException']) def test_retrieve_error_arn_not_exist(mocker, var_error, arntask, creds): mock_boto3_client = mocker.MagicMock(spec=['get_quantum_task']) mock_boto3_client.get_quantum_task.side_effect = botocore.exceptions.ClientError( diff --git a/projectq/backends/_awsbraket/_awsbraket_test.py b/projectq/backends/_awsbraket/_awsbraket_test.py index 1a5288c8..4e0c3b58 100644 --- a/projectq/backends/_awsbraket/_awsbraket_test.py +++ b/projectq/backends/_awsbraket/_awsbraket_test.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -""" Test for projectq.backends._awsbraket._awsbraket.py""" +"""Test for projectq.backends._awsbraket._awsbraket.py""" import copy import math diff --git a/projectq/backends/_circuits/_plot_test.py b/projectq/backends/_circuits/_plot_test.py index 3e81d23d..bef73700 100644 --- a/projectq/backends/_circuits/_plot_test.py +++ b/projectq/backends/_circuits/_plot_test.py @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. """ - Tests for projectq.backends._circuits._plot.py. +Tests for projectq.backends._circuits._plot.py. - To generate the baseline images, - run the tests with '--mpl-generate-path=baseline' +To generate the baseline images, +run the tests with '--mpl-generate-path=baseline' - Then run the tests simply with '--mpl' +Then run the tests simply with '--mpl' """ from copy import deepcopy diff --git a/projectq/backends/_ibm/_ibm_test.py b/projectq/backends/_ibm/_ibm_test.py index dc9e2c2c..e7cccdf5 100755 --- a/projectq/backends/_ibm/_ibm_test.py +++ b/projectq/backends/_ibm/_ibm_test.py @@ -370,12 +370,8 @@ def mock_send(*args, **kwargs): assert prob_dict['00'] == pytest.approx(0.512) assert prob_dict['11'] == pytest.approx(0.488) result = "\nu2(0,pi/2) q[1];\ncx q[1], q[2];\ncx q[1], q[3];" - if sys.version_info.major == 3: - result += "\nu3(6.28318530718, 0, 0) q[1];\nu1(11.780972450962) q[1];" - result += "\nu3(6.28318530718, 0, 0) q[1];\nu1(10.995574287564) q[1];" - else: - result += "\nu3(6.28318530718, 0, 0) q[1];\nu1(11.780972451) q[1];" - result += "\nu3(6.28318530718, 0, 0) q[1];\nu1(10.9955742876) q[1];" + result += "\nu3(6.28318530718, 0, 0) q[1];\nu1(11.780972450962) q[1];" + result += "\nu3(6.28318530718, 0, 0) q[1];\nu1(10.995574287564) q[1];" result += "\nbarrier q[1], q[2], q[3];" result += "\nu3(0.2, -pi/2, pi/2) q[1];\nmeasure q[1] -> c[1];" result += "\nmeasure q[2] -> c[2];\nmeasure q[3] -> c[3];" diff --git a/projectq/ops/_command_test.py b/projectq/ops/_command_test.py index 19db3644..5dfe7474 100755 --- a/projectq/ops/_command_test.py +++ b/projectq/ops/_command_test.py @@ -287,12 +287,8 @@ def test_command_str(main_engine): cmd.tags = ["TestTag"] cmd.add_control_qubits(ctrl_qubit) cmd2 = _command.Command(main_engine, Rx(0.5 * math.pi), (qubit,)) - if sys.version_info.major == 3: - assert cmd.to_string(symbols=False) == "CRx(1.570796326795) | ( Qureg[1], Qureg[0] )" - assert str(cmd2) == "Rx(1.570796326795) | Qureg[0]" - else: - assert cmd.to_string(symbols=False) == "CRx(1.5707963268) | ( Qureg[1], Qureg[0] )" - assert str(cmd2) == "Rx(1.5707963268) | Qureg[0]" + assert cmd.to_string(symbols=False) == "CRx(1.570796326795) | ( Qureg[1], Qureg[0] )" + assert str(cmd2) == "Rx(1.570796326795) | Qureg[0]" def test_command_to_string(main_engine): @@ -305,9 +301,5 @@ def test_command_to_string(main_engine): assert cmd.to_string(symbols=True) == "CRx(0.5π) | ( Qureg[1], Qureg[0] )" assert cmd2.to_string(symbols=True) == "Rx(0.5π) | Qureg[0]" - if sys.version_info.major == 3: - assert cmd.to_string(symbols=False) == "CRx(1.570796326795) | ( Qureg[1], Qureg[0] )" - assert cmd2.to_string(symbols=False) == "Rx(1.570796326795) | Qureg[0]" - else: - assert cmd.to_string(symbols=False) == "CRx(1.5707963268) | ( Qureg[1], Qureg[0] )" - assert cmd2.to_string(symbols=False) == "Rx(1.5707963268) | Qureg[0]" + assert cmd.to_string(symbols=False) == "CRx(1.570796326795) | ( Qureg[1], Qureg[0] )" + assert cmd2.to_string(symbols=False) == "Rx(1.570796326795) | Qureg[0]"