Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -52,53 +52,53 @@ 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
files: .*\.(py|txt|cmake|md|rst|sh|ps1|hpp|tpp|cpp|cc)$
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
Expand All @@ -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']
4 changes: 2 additions & 2 deletions projectq/backends/_awsbraket/_awsbraket_boto3_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion projectq/backends/_awsbraket/_awsbraket_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions projectq/backends/_circuits/_plot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 2 additions & 6 deletions projectq/backends/_ibm/_ibm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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];"
Expand Down
16 changes: 4 additions & 12 deletions projectq/ops/_command_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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]"
Loading