From 965c4a4b80aaace7ee05a2952169a90595ca17b2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 22:48:58 +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/tox-dev/tox-ini-fmt: 1.4.1 → 1.5.0](https://github.com/tox-dev/tox-ini-fmt/compare/1.4.1...1.5.0) - [github.com/astral-sh/ruff-pre-commit: v0.8.4 → v0.9.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.4...v0.9.3) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3e0c838..baf07e5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: exclude: '(\.Rd|python/doc/source/reference/.*|test-doctest-.*)' - repo: https://github.com/tox-dev/tox-ini-fmt - rev: "1.4.1" + rev: "1.5.0" hooks: - id: tox-ini-fmt - repo: https://github.com/tox-dev/pyproject-fmt @@ -35,7 +35,7 @@ repos: additional_dependencies: ["tox>=4.12.1"] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.8.4 + rev: v0.9.3 hooks: # Run the formatter. - id: ruff-format From 43de1289a547babe614f1304e30340e6216739cd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 22:49:22 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- python/src/moocore/_moocore.py | 6 +++--- python/tests/test_moocore.py | 36 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/python/src/moocore/_moocore.py b/python/src/moocore/_moocore.py index 0e73c0d..6aeac7e 100644 --- a/python/src/moocore/_moocore.py +++ b/python/src/moocore/_moocore.py @@ -1464,9 +1464,9 @@ def eafdiff( """ x = np.asarray(x, dtype=float) y = np.asarray(y, dtype=float) - assert ( - x.shape[1] == y.shape[1] - ), "'x' and 'y' must have the same number of columns" + assert x.shape[1] == y.shape[1], ( + "'x' and 'y' must have the same number of columns" + ) nobj = x.shape[1] - 1 assert nobj == 2 maximise = _parse_maximise(maximise, nobj=nobj) diff --git a/python/tests/test_moocore.py b/python/tests/test_moocore.py index 1c1f216..8f80334 100644 --- a/python/tests/test_moocore.py +++ b/python/tests/test_moocore.py @@ -21,9 +21,9 @@ def test_read_datasets_data(test_datapath): def check_testdata(testpath, expected_name, expected_shape): testdata = moocore.read_datasets(testpath) - assert ( - testdata.shape == expected_shape - ), f"Read data array has incorrect shape, should be {expected_shape} but is {testdata.shape}" + assert testdata.shape == expected_shape, ( + f"Read data array has incorrect shape, should be {expected_shape} but is {testdata.shape}" + ) if expected_name != "": check_data = np.loadtxt( test_datapath(f"expected_output/read_datasets/{expected_name}") @@ -98,26 +98,26 @@ def test_hv_output(self, test_datapath): X = self.input1 dat = X[X[:, 2] == 1, :2] hv = moocore.hypervolume(dat, ref=np.array([10, 10])) - assert math.isclose( - hv, 90.46272765 - ), "input1.dat hypervolume produces wrong output" + assert math.isclose(hv, 90.46272765), ( + "input1.dat hypervolume produces wrong output" + ) hv_ind = moocore.Hypervolume(ref=[10, 10]) hv = hv_ind(dat) - assert math.isclose( - hv, 90.46272765 - ), "input1.dat Hypervolume(ref = [10,10]) produces wrong output" + assert math.isclose(hv, 90.46272765), ( + "input1.dat Hypervolume(ref = [10,10]) produces wrong output" + ) dat = X[X[:, 2] == 2, :2] hv = moocore.hypervolume(dat, ref=[10, 10]) - assert math.isclose( - hv, 53.969708954 - ), "input1.dat hypervolume produces wrong output" + assert math.isclose(hv, 53.969708954), ( + "input1.dat hypervolume produces wrong output" + ) hv = hv_ind(dat) - assert math.isclose( - hv, 53.969708954 - ), "input1.dat Hypervolume(ref = [10,10]) produces wrong output" + assert math.isclose(hv, 53.969708954), ( + "input1.dat Hypervolume(ref = [10,10]) produces wrong output" + ) X = moocore.read_datasets(test_datapath("duplicated3.inp"))[:, :-1] hv = moocore.hypervolume( @@ -282,9 +282,9 @@ def test_eaf(test_datapath): expected_eaf_pct_result = np.loadtxt( test_datapath(f"expected_output/eaf/pct_{expected_eaf_name}") ) - assert ( - eaf_test.shape == expected_eaf_result.shape - ), f"Shapes of {test_name} and {expected_eaf_name} do not match" + assert eaf_test.shape == expected_eaf_result.shape, ( + f"Shapes of {test_name} and {expected_eaf_name} do not match" + ) assert_allclose( eaf_test, expected_eaf_result,