Skip to content

Commit

Permalink
Update black version (#1059)
Browse files Browse the repository at this point in the history
### Before submitting

Please complete the following checklist when submitting a PR:

- [ ] All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to
the
      [`tests`](../tests) directory!

- [ ] All new functions and code must be clearly commented and
documented.
If you do make documentation changes, make sure that the docs build and
      render correctly by running `make docs`.

- [ ] Ensure that the test suite passes, by running `make test`.

- [x] Add a new entry to the `.github/CHANGELOG.md` file, summarizing
the
      change, and including a link back to the PR.

- [ ] Ensure that code is properly formatted by running `make format`. 

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


------------------------------------------------------------------------------------------------------------

**Context:**
A new version of black formatter (25.1.0) has been released, which
breaks our CI.

**Description of the Change:**
Update code to comply with this version of black.

**Benefits:**
CI passes. Nicer styling.

**Possible Drawbacks:**

**Related GitHub Issues:**

[sc-83330]

---------

Co-authored-by: ringo-but-quantum <[email protected]>
  • Loading branch information
josephleekl and ringo-but-quantum authored Jan 29, 2025
1 parent 63b9ecd commit f4b244f
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

### Improvements

* Update source code to use black formatter 25.1.0.
[(#1059)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1059)

* Replace the type checking using the property `return_type` of `MeasurementProcess` with direct `isinstance` checks.
[(#1044)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1044)

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 25.1.0
hooks:
- id: black
args: [--line-length=100]
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ Black & Pylint
==============

If you contribute to the Python code, please mind the following.
The Python code is formatted with the PEP 8 compliant opinionated formatter `Black <https://github.com/psf/black>`_ (`black==23.7.0`).
The Python code is formatted with the PEP 8 compliant opinionated formatter `Black <https://github.com/psf/black>`_ (`black==25.1.0`).
We set a line width of a 100 characters.
The Python code is statically analyzed with `Pylint <https://pylint.readthedocs.io/en/stable/>`_.
We set up a pre-commit hook (see `Git hooks <https://git-scm.com/docs/githooks>`_) to run both of these on `git commit`.
Expand Down
4 changes: 2 additions & 2 deletions pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

"""Version information.
Version number (major.minor.patch[-label])
Version number (major.minor.patch[-label])
"""

__version__ = "0.41.0-dev11"
__version__ = "0.41.0-dev12"
2 changes: 1 addition & 1 deletion pennylane_lightning/lightning_tensor/lightning_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
"""
This module contains the LightningTensor class that inherits from the new device interface.
It is a device to perform tensor network simulations of quantum circuits using `cutensornet`.
It is a device to perform tensor network simulations of quantum circuits using `cutensornet`.
"""
from dataclasses import replace
from numbers import Number
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pytest-mock>=3.7.0
pytest-xdist>=2.5.0
pytest-split
flaky>=3.7.0
black>=21
black>=25.1.0
clang-tidy~=16.0
clang-format~=16.0
isort==5.13.2
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pytest-cov>=3.0.0
pytest-mock>=3.7.0
pytest-xdist>=2.5.0
flaky>=3.7.0
black>=21
black>=25.1.0
clang-tidy~=16.0
clang-format~=16.0
isort==5.13.2
Expand Down
4 changes: 2 additions & 2 deletions tests/lightning_tensor/test_serialize_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ def test_mixed_tensor_return(self, use_csingle, wires_map):

@pytest.mark.parametrize(
"test_hermobs0",
[(qml.Hermitian(np.eye(2), wires=[0]))],
[qml.Hermitian(np.eye(2), wires=[0])],
)
@pytest.mark.parametrize(
"test_hermobs1",
[(qml.Hermitian(np.ones((2, 2)), wires=[0]))],
[qml.Hermitian(np.ones((2, 2)), wires=[0])],
)
def test_hamiltonian_return(self, test_hermobs0, test_hermobs1, use_csingle, wires_map):
"""Test expected serialization for a Hamiltonian return"""
Expand Down
12 changes: 6 additions & 6 deletions tests/test_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,11 @@ def test_mixed_tensor_return(self, use_csingle, wires_map):

@pytest.mark.parametrize(
"test_hermobs0",
[(qml.Hermitian(np.eye(4), wires=[0, 1]))],
[qml.Hermitian(np.eye(4), wires=[0, 1])],
)
@pytest.mark.parametrize(
"test_hermobs1",
[(qml.Hermitian(np.ones((8, 8)), wires=range(3)))],
[qml.Hermitian(np.ones((8, 8)), wires=range(3))],
)
@pytest.mark.parametrize("use_csingle", [True, False])
@pytest.mark.parametrize("wires_map", [wires_dict, None])
Expand Down Expand Up @@ -328,11 +328,11 @@ def test_hamiltonian_return(self, test_hermobs0, test_hermobs1, use_csingle, wir

@pytest.mark.parametrize(
"test_hermobs0",
[(qml.Hermitian(np.eye(4), wires=[0, 1]))],
[qml.Hermitian(np.eye(4), wires=[0, 1])],
)
@pytest.mark.parametrize(
"test_hermobs1",
[(qml.Hermitian(np.ones((8, 8)), wires=range(3)))],
[qml.Hermitian(np.ones((8, 8)), wires=range(3))],
)
@pytest.mark.parametrize("use_csingle", [True, False])
@pytest.mark.parametrize("wires_map", [wires_dict, None])
Expand Down Expand Up @@ -394,11 +394,11 @@ def test_hamiltonian_tensor_return(self, test_hermobs0, test_hermobs1, use_csing

@pytest.mark.parametrize(
"test_hermobs0",
[(qml.Hermitian(np.eye(4), wires=[0, 1]))],
[qml.Hermitian(np.eye(4), wires=[0, 1])],
)
@pytest.mark.parametrize(
"test_hermobs1",
[(qml.Hermitian(np.ones((8, 8)), wires=range(3)))],
[qml.Hermitian(np.ones((8, 8)), wires=range(3))],
)
@pytest.mark.parametrize("use_csingle", [True, False])
@pytest.mark.parametrize("wires_map", [wires_dict, None])
Expand Down

0 comments on commit f4b244f

Please sign in to comment.