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'] 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]"