From 6f8cadd5a7263e015ac8e5aa874f2342f492d6e8 Mon Sep 17 00:00:00 2001 From: Laurent Courty Date: Sat, 11 Jul 2026 00:51:00 -0600 Subject: [PATCH] update ruff formatting --- benchmarks/benchmark_rastermetrics.py | 1 + benchmarks/benchmark_snippets.py | 1 + benchmarks/benchmark_solve_q.py | 7 ++++++- benchmarks/benchmark_surface_flow.py | 8 ++++++-- benchmarks/benchmark_update_h.py | 7 ++++++- benchmarks/conftest.py | 1 + setup.py | 10 +++++++--- src/itzi_core/messenger.py | 1 + src/itzi_core/simulation_builder.py | 6 +++++- 9 files changed, 34 insertions(+), 8 deletions(-) diff --git a/benchmarks/benchmark_rastermetrics.py b/benchmarks/benchmark_rastermetrics.py index a6f512f..6b54e32 100644 --- a/benchmarks/benchmark_rastermetrics.py +++ b/benchmarks/benchmark_rastermetrics.py @@ -11,6 +11,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. """ + import math import numpy as np diff --git a/benchmarks/benchmark_snippets.py b/benchmarks/benchmark_snippets.py index 91d7174..3bfd4d2 100644 --- a/benchmarks/benchmark_snippets.py +++ b/benchmarks/benchmark_snippets.py @@ -11,6 +11,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. """ + import math import numpy as np diff --git a/benchmarks/benchmark_solve_q.py b/benchmarks/benchmark_solve_q.py index ad79880..bac059c 100644 --- a/benchmarks/benchmark_solve_q.py +++ b/benchmarks/benchmark_solve_q.py @@ -11,12 +11,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. """ + import math import numpy as np import pytest -from itzi_core.compute.partial_inertia_q import set_solve_q_tile_size, get_solve_q_tile_size, solve_q +from itzi_core.compute.partial_inertia_q import ( + set_solve_q_tile_size, + get_solve_q_tile_size, + solve_q, +) from itzi_core.data_containers import SurfaceFlowParameters NUM_CELLS_TO_SHAPE: dict[int, tuple[int, int]] = { diff --git a/benchmarks/benchmark_surface_flow.py b/benchmarks/benchmark_surface_flow.py index 9a76d92..22580f6 100644 --- a/benchmarks/benchmark_surface_flow.py +++ b/benchmarks/benchmark_surface_flow.py @@ -114,7 +114,9 @@ def benchmark_surface_flow_n_seconds(eggbox_simulation, n_seconds=30): @pytest.mark.parametrize("num_cells", num_cells_params, ids=num_cells_ids) -@pytest.mark.parametrize("cell_size", [5], ids=["5m"]) # Set as parameter to get it in the output json +@pytest.mark.parametrize( + "cell_size", [5], ids=["5m"] +) # Set as parameter to get it in the output json def test_benchmark_surface_flow_n_steps(benchmark, num_cells, cell_size, n_steps=10): """Run the benchmark for a given number of cells and cell size""" eggbox_sim = setup_eggbox_simulation(num_cells=num_cells, cell_size=cell_size) @@ -124,7 +126,9 @@ def test_benchmark_surface_flow_n_steps(benchmark, num_cells, cell_size, n_steps @pytest.mark.parametrize("num_cells", num_cells_params, ids=num_cells_ids) @pytest.mark.parametrize("cell_size", cell_size_params, ids=cell_size_ids) -@pytest.mark.parametrize("n_seconds", [30], ids=["30s"]) # Set as parameter to get it in the output json +@pytest.mark.parametrize( + "n_seconds", [30], ids=["30s"] +) # Set as parameter to get it in the output json def test_benchmark_surface_flow_n_seconds(benchmark, num_cells, cell_size, n_seconds): """Run the benchmark for a given number of cells and cell size""" results = [] diff --git a/benchmarks/benchmark_update_h.py b/benchmarks/benchmark_update_h.py index e1bc0ef..fad4465 100644 --- a/benchmarks/benchmark_update_h.py +++ b/benchmarks/benchmark_update_h.py @@ -11,12 +11,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. """ + import math import numpy as np import pytest -from itzi_core.compute.partial_inertia_h import set_solve_h_tile_size, get_solve_h_tile_size, solve_h +from itzi_core.compute.partial_inertia_h import ( + set_solve_h_tile_size, + get_solve_h_tile_size, + solve_h, +) from itzi_core.data_containers import SurfaceFlowParameters NUM_CELLS_TO_SHAPE: dict[int, tuple[int, int]] = { diff --git a/benchmarks/conftest.py b/benchmarks/conftest.py index a74704d..e89d01b 100644 --- a/benchmarks/conftest.py +++ b/benchmarks/conftest.py @@ -11,4 +11,5 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. """ + pytest_plugins = ["tests.conftest"] diff --git a/setup.py b/setup.py index d15c0ac..28f8f48 100644 --- a/setup.py +++ b/setup.py @@ -332,12 +332,16 @@ def build_extensions(self): extensions = [ Extension( - "itzi_core.compute.partial_inertia_h", sources=["src/itzi_core/compute/partial_inertia_h.pyx"] + "itzi_core.compute.partial_inertia_h", + sources=["src/itzi_core/compute/partial_inertia_h.pyx"], ), Extension( - "itzi_core.compute.partial_inertia_q", sources=["src/itzi_core/compute/partial_inertia_q.pyx"] + "itzi_core.compute.partial_inertia_q", + sources=["src/itzi_core/compute/partial_inertia_q.pyx"], + ), + Extension( + "itzi_core.compute.rastermetrics", sources=["src/itzi_core/compute/rastermetrics.pyx"] ), - Extension("itzi_core.compute.rastermetrics", sources=["src/itzi_core/compute/rastermetrics.pyx"]), Extension("itzi_core.compute.hydrology", sources=["src/itzi_core/compute/hydrology.pyx"]), Extension("itzi_core.compute.snippets", sources=["benchmarks/snippets.pyx"]), ] diff --git a/src/itzi_core/messenger.py b/src/itzi_core/messenger.py index 822a22a..5547c6b 100644 --- a/src/itzi_core/messenger.py +++ b/src/itzi_core/messenger.py @@ -11,6 +11,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. """ + from typing import Callable, NoReturn import sys import logging diff --git a/src/itzi_core/simulation_builder.py b/src/itzi_core/simulation_builder.py index 03257e2..6584eee 100644 --- a/src/itzi_core/simulation_builder.py +++ b/src/itzi_core/simulation_builder.py @@ -42,7 +42,11 @@ if TYPE_CHECKING: from itzi_core.providers.domain_data import DomainData - from itzi_core.providers.base import RasterInputProvider, RasterOutputProvider, VectorOutputProvider + from itzi_core.providers.base import ( + RasterInputProvider, + RasterOutputProvider, + VectorOutputProvider, + ) from itzi_core.data_containers import ( SimulationConfig, HotstartSimulationState,