From b88e8d6126e7490cfe905e1be17381f8290ca340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20BRIOL?= Date: Sun, 8 Sep 2024 10:16:53 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Apply=20pre-commit=20hooks.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CODE_OF_CONDUCT.md | 2 +- scripts/stubgen.py | 3 +- src/pyinterp/backends/xarray.py | 2 +- src/pyinterp/core/__init__.pyi | 2 +- src/pyinterp/core/array.pyi | 8 +-- src/pyinterp/core/include/pyinterp/axis.hpp | 4 +- .../core/include/pyinterp/bivariate.hpp | 8 +-- .../core/include/pyinterp/dateutils.hpp | 9 ++-- .../core/include/pyinterp/detail/axis.hpp | 14 +++-- .../pyinterp/detail/axis/container.hpp | 28 +++++----- .../pyinterp/detail/geometry/crossover.hpp | 4 +- .../pyinterp/detail/geometry/rtree.hpp | 34 ++++++------- .../pyinterp/detail/interpolation/akima.hpp | 8 +-- .../pyinterp/detail/interpolation/bicubic.hpp | 4 +- .../detail/interpolation/bilinear.hpp | 4 +- .../pyinterp/detail/interpolation/cspline.hpp | 8 +-- .../detail/interpolation/cspline_base.hpp | 6 +-- .../detail/interpolation/cspline_periodic.hpp | 4 +- .../detail/interpolation/interpolator_1d.hpp | 12 ++--- .../detail/interpolation/interpolator_2d.hpp | 4 +- .../detail/interpolation/polynomial.hpp | 13 +++-- .../pyinterp/detail/interpolation/steffen.hpp | 8 +-- .../include/pyinterp/detail/isviewstream.hpp | 4 +- .../core/include/pyinterp/detail/math.hpp | 8 +-- .../include/pyinterp/detail/math/bicubic.hpp | 4 +- .../detail/math/radial_basis_functions.hpp | 16 +++--- .../include/pyinterp/detail/math/spline2d.hpp | 4 +- .../pyinterp/detail/math/trivariate.hpp | 12 ++--- .../pyinterp/detail/math/window_functions.hpp | 4 +- src/pyinterp/core/include/pyinterp/fill.hpp | 16 +++--- src/pyinterp/core/include/pyinterp/frame.hpp | 4 +- .../include/pyinterp/geodetic/algorithm.hpp | 18 +++---- .../include/pyinterp/geodetic/line_string.hpp | 14 +++-- .../core/include/pyinterp/geodetic/point.hpp | 12 ++--- .../core/include/pyinterp/geohash/int64.hpp | 12 ++--- .../core/include/pyinterp/geohash/string.hpp | 35 ++++++------- src/pyinterp/core/include/pyinterp/period.hpp | 14 +++-- .../core/include/pyinterp/quadrivariate.hpp | 4 +- src/pyinterp/core/include/pyinterp/rtree.hpp | 51 +++++++++---------- .../include/pyinterp/streaming_histogram.hpp | 4 +- .../core/include/pyinterp/temporal_axis.hpp | 13 +++-- .../core/include/pyinterp/trivariate.hpp | 4 +- .../core/lib/geodetic/line_string.cpp | 12 ++--- src/pyinterp/core/lib/geodetic/rtree.cpp | 20 ++++---- src/pyinterp/core/lib/geohash/int64.cpp | 16 +++--- src/pyinterp/core/lib/geohash/string.cpp | 31 +++++------ src/pyinterp/core/module/bicubic.cpp | 8 +-- src/pyinterp/orbit.py | 4 +- .../statistics/descriptive_descriptive.py | 3 +- .../statistics/streaming_histogram.py | 3 +- src/pyinterp/tests/__init__.py | 2 +- src/pyinterp/tests/core/test_dateutils.py | 2 +- src/pyinterp/tests/core/test_geodetic.py | 2 +- .../tests/test_orbit_interpolation.py | 4 +- 54 files changed, 261 insertions(+), 288 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index d267279e..653ea211 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal +level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards diff --git a/scripts/stubgen.py b/scripts/stubgen.py index dbd0b49b..281c4958 100644 --- a/scripts/stubgen.py +++ b/scripts/stubgen.py @@ -2,7 +2,6 @@ Generates stubs for the core modules. ===================================== """ -from typing import List import os import pathlib import re @@ -62,7 +61,7 @@ def fix_core_geodetic(src: pathlib.Path): stream.writelines(lines) -def fix_core_fill(src: pathlib.Path, grids: List[str]): +def fix_core_fill(src: pathlib.Path, grids: list[str]): core = src / 'pyinterp' / 'core' / 'fill.pyi' with core.open('r') as stream: lines = stream.readlines() diff --git a/src/pyinterp/backends/xarray.py b/src/pyinterp/backends/xarray.py index f9a44022..9f1b4b6a 100644 --- a/src/pyinterp/backends/xarray.py +++ b/src/pyinterp/backends/xarray.py @@ -10,7 +10,7 @@ """ from __future__ import annotations -from typing import Hashable +from collections.abc import Hashable import pickle import numpy diff --git a/src/pyinterp/core/__init__.pyi b/src/pyinterp/core/__init__.pyi index dc7ea957..7034dceb 100644 --- a/src/pyinterp/core/__init__.pyi +++ b/src/pyinterp/core/__init__.pyi @@ -1224,7 +1224,7 @@ class Period: Array1DPeriod = numpy.ndarray[ - Literal['N'], + tuple[int], numpy.dtype[Period] # type: ignore[type-var] ] diff --git a/src/pyinterp/core/array.pyi b/src/pyinterp/core/array.pyi index 48a6235d..3b1bd80b 100644 --- a/src/pyinterp/core/array.pyi +++ b/src/pyinterp/core/array.pyi @@ -2,10 +2,10 @@ from typing import Any, Literal import numpy -_1D = Literal['N'] -_2D = Literal['N', 'M'] -_3D = Literal['N', 'M', 'O'] -_4D = Literal['N', 'M', 'O', 'P'] +_1D = tuple[int] +_2D = tuple[int, int] +_3D = tuple[int, int, int] +_4D = tuple[int, int, int, int] Array1DBool = numpy.ndarray[_1D, numpy.dtype[numpy.bool_]] Array1DFloat32 = numpy.ndarray[_1D, numpy.dtype[numpy.float32]] diff --git a/src/pyinterp/core/include/pyinterp/axis.hpp b/src/pyinterp/core/include/pyinterp/axis.hpp index b846c036..c887bd30 100644 --- a/src/pyinterp/core/include/pyinterp/axis.hpp +++ b/src/pyinterp/core/include/pyinterp/axis.hpp @@ -123,8 +123,8 @@ class Axis : public detail::Axis, /// points on the axis or the value -1 if the *bounded* parameter is set /// to false and the index looked for is located outside the limits of the /// axis. - auto find_index(const pybind11::array_t &coordinates, bool bounded) const - -> pybind11::array_t { + auto find_index(const pybind11::array_t &coordinates, + bool bounded) const -> pybind11::array_t { detail::check_array_ndim("coordinates", 1, coordinates); auto size = coordinates.size(); diff --git a/src/pyinterp/core/include/pyinterp/bivariate.hpp b/src/pyinterp/core/include/pyinterp/bivariate.hpp index bc36a5a5..3cae9bdc 100644 --- a/src/pyinterp/core/include/pyinterp/bivariate.hpp +++ b/src/pyinterp/core/include/pyinterp/bivariate.hpp @@ -112,8 +112,8 @@ template