From 1bcf36ebee3267f3b487afb84fdc350371317c6f Mon Sep 17 00:00:00 2001 From: Patrick Roddy Date: Mon, 18 Sep 2023 16:05:31 +0200 Subject: [PATCH] Import `pydantic.v1` with `v2` (#207) https://github.com/pydantic/pydantic#pydantic-v110-vs-v2 --- .pre-commit-config.yaml | 2 +- pyproject.toml | 2 +- src/sleplet/functions/africa.py | 2 +- .../axisymmetric_wavelet_coefficients_africa.py | 4 ++-- .../axisymmetric_wavelet_coefficients_earth.py | 4 ++-- .../axisymmetric_wavelet_coefficients_south_america.py | 4 ++-- src/sleplet/functions/axisymmetric_wavelets.py | 4 ++-- src/sleplet/functions/coefficients.py | 4 ++-- src/sleplet/functions/dirac_delta.py | 2 +- src/sleplet/functions/directional_spin_wavelets.py | 4 ++-- src/sleplet/functions/earth.py | 2 +- src/sleplet/functions/elongated_gaussian.py | 2 +- src/sleplet/functions/flm.py | 2 +- src/sleplet/functions/fp.py | 2 +- src/sleplet/functions/gaussian.py | 2 +- src/sleplet/functions/harmonic_gaussian.py | 2 +- src/sleplet/functions/identity.py | 2 +- src/sleplet/functions/noise_earth.py | 2 +- src/sleplet/functions/ridgelets.py | 4 ++-- src/sleplet/functions/slepian.py | 4 ++-- src/sleplet/functions/slepian_africa.py | 2 +- src/sleplet/functions/slepian_dirac_delta.py | 2 +- src/sleplet/functions/slepian_identity.py | 2 +- src/sleplet/functions/slepian_noise_africa.py | 2 +- src/sleplet/functions/slepian_noise_south_america.py | 2 +- src/sleplet/functions/slepian_south_america.py | 2 +- .../functions/slepian_wavelet_coefficients_africa.py | 4 ++-- .../slepian_wavelet_coefficients_south_america.py | 4 ++-- src/sleplet/functions/slepian_wavelets.py | 4 ++-- src/sleplet/functions/south_america.py | 2 +- src/sleplet/functions/spherical_harmonic.py | 6 +++--- src/sleplet/functions/squashed_gaussian.py | 2 +- src/sleplet/functions/wmap.py | 2 +- src/sleplet/meshes/_mesh_slepian_decomposition.py | 2 +- src/sleplet/meshes/mesh.py | 2 +- src/sleplet/meshes/mesh_basis_functions.py | 4 ++-- src/sleplet/meshes/mesh_coefficients.py | 4 ++-- src/sleplet/meshes/mesh_field.py | 2 +- src/sleplet/meshes/mesh_harmonic_coefficients.py | 2 +- src/sleplet/meshes/mesh_noise_field.py | 2 +- src/sleplet/meshes/mesh_slepian.py | 2 +- src/sleplet/meshes/mesh_slepian_coefficients.py | 2 +- src/sleplet/meshes/mesh_slepian_field.py | 2 +- src/sleplet/meshes/mesh_slepian_functions.py | 4 ++-- src/sleplet/meshes/mesh_slepian_noise_field.py | 2 +- .../meshes/mesh_slepian_wavelet_coefficients.py | 4 ++-- src/sleplet/meshes/mesh_slepian_wavelets.py | 4 ++-- src/sleplet/plotting/_create_plot_mesh.py | 2 +- src/sleplet/plotting/_create_plot_sphere.py | 2 +- src/sleplet/slepian/_slepian_decomposition.py | 2 +- src/sleplet/slepian/region.py | 10 +++++----- src/sleplet/slepian/slepian_arbitrary.py | 2 +- src/sleplet/slepian/slepian_functions.py | 2 +- src/sleplet/slepian/slepian_limit_lat_lon.py | 2 +- src/sleplet/slepian/slepian_polar_cap.py | 6 +++--- 55 files changed, 79 insertions(+), 79 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b92968aa8..cbe9d3154 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,7 +40,7 @@ repos: hooks: - id: blacken-docs additional_dependencies: - - black==23.7.0 + - black==23.9.1 - repo: https://github.com/codespell-project/codespell rev: v2.2.5 hooks: diff --git a/pyproject.toml b/pyproject.toml index bc02728ce..9bdf2b939 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ "platformdirs>=3.2.0", "plotly>=5.14.0", "pooch>=1.7.0", - "pydantic<2", + "pydantic>=2.3.0", "pys2let>=2.2.6", "pyssht>=1.5.2", "scipy>=1.10.1", diff --git a/src/sleplet/functions/africa.py b/src/sleplet/functions/africa.py index dea2431ed..0f8fcc61f 100644 --- a/src/sleplet/functions/africa.py +++ b/src/sleplet/functions/africa.py @@ -1,7 +1,7 @@ """Contains the `Africa` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._data.create_earth_flm diff --git a/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py b/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py index b01e1670b..3c0a28c91 100644 --- a/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py +++ b/src/sleplet/functions/axisymmetric_wavelet_coefficients_africa.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import sleplet._string_methods @@ -79,7 +79,7 @@ def _create_wavelet_coefficients( return wavelets, wavelet_coefficients @pydantic.validator("j") - def _check_j(cls, v, values): + def _check_j(cls, v, values): # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["L"], diff --git a/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py b/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py index 27438a4fa..ff5a43ad8 100644 --- a/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py +++ b/src/sleplet/functions/axisymmetric_wavelet_coefficients_earth.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import sleplet._string_methods @@ -76,7 +76,7 @@ def _create_wavelet_coefficients( return wavelets, wavelet_coefficients @pydantic.validator("j") - def _check_j(cls, v, values): + def _check_j(cls, v, values): # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["L"], diff --git a/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py b/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py index 215b605fd..e332281c7 100644 --- a/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py +++ b/src/sleplet/functions/axisymmetric_wavelet_coefficients_south_america.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import sleplet._string_methods @@ -78,7 +78,7 @@ def _create_wavelet_coefficients( return wavelets, wavelet_coefficients @pydantic.validator("j") - def _check_j(cls, v, values): + def _check_j(cls, v, values): # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["L"], diff --git a/src/sleplet/functions/axisymmetric_wavelets.py b/src/sleplet/functions/axisymmetric_wavelets.py index e6ada2031..f22e97780 100644 --- a/src/sleplet/functions/axisymmetric_wavelets.py +++ b/src/sleplet/functions/axisymmetric_wavelets.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import sleplet._string_methods @@ -69,7 +69,7 @@ def _create_wavelets(self) -> npt.NDArray[np.complex_]: ) @pydantic.validator("j") - def _check_j(cls, v, values): + def _check_j(cls, v, values): # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["L"], diff --git a/src/sleplet/functions/coefficients.py b/src/sleplet/functions/coefficients.py index a2188110e..23de8bba1 100644 --- a/src/sleplet/functions/coefficients.py +++ b/src/sleplet/functions/coefficients.py @@ -4,7 +4,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._convolution_methods import sleplet._mask_methods @@ -114,7 +114,7 @@ def _add_details_to_name(self) -> None: self.name += f"_L{self.L}" @pydantic.validator("coefficients", check_fields=False) - def _check_coefficients(cls, v, values): + def _check_coefficients(cls, v, values): # noqa: N805 if ( values["region"] and not set(values["name"].split("_")) & _COEFFICIENTS_TO_NOT_MASK diff --git a/src/sleplet/functions/dirac_delta.py b/src/sleplet/functions/dirac_delta.py index 0d90df9cb..85c412403 100644 --- a/src/sleplet/functions/dirac_delta.py +++ b/src/sleplet/functions/dirac_delta.py @@ -1,7 +1,7 @@ """Contains the `DiracDelta` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._string_methods diff --git a/src/sleplet/functions/directional_spin_wavelets.py b/src/sleplet/functions/directional_spin_wavelets.py index dcad4159b..8da9b1aff 100644 --- a/src/sleplet/functions/directional_spin_wavelets.py +++ b/src/sleplet/functions/directional_spin_wavelets.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import pyssht as ssht @@ -83,7 +83,7 @@ def _create_wavelets(self) -> npt.NDArray[np.complex_]: return wavelets @pydantic.validator("j") - def _check_j(cls, v, values): + def _check_j(cls, v, values): # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["L"], diff --git a/src/sleplet/functions/earth.py b/src/sleplet/functions/earth.py index 9c3c764ef..ff886c39b 100644 --- a/src/sleplet/functions/earth.py +++ b/src/sleplet/functions/earth.py @@ -1,7 +1,7 @@ """Contains the `Earth` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._data.create_earth_flm import sleplet._string_methods diff --git a/src/sleplet/functions/elongated_gaussian.py b/src/sleplet/functions/elongated_gaussian.py index be2dec284..e32e0bd32 100644 --- a/src/sleplet/functions/elongated_gaussian.py +++ b/src/sleplet/functions/elongated_gaussian.py @@ -1,7 +1,7 @@ """Contains the `ElongatedGaussian` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/functions/flm.py b/src/sleplet/functions/flm.py index 1a3983e83..0f5afaef3 100644 --- a/src/sleplet/functions/flm.py +++ b/src/sleplet/functions/flm.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._validation diff --git a/src/sleplet/functions/fp.py b/src/sleplet/functions/fp.py index 375471b23..b2d3d4d83 100644 --- a/src/sleplet/functions/fp.py +++ b/src/sleplet/functions/fp.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._mask_methods import sleplet._validation diff --git a/src/sleplet/functions/gaussian.py b/src/sleplet/functions/gaussian.py index 81ffb6618..8b75c321c 100644 --- a/src/sleplet/functions/gaussian.py +++ b/src/sleplet/functions/gaussian.py @@ -1,7 +1,7 @@ """Contains the `Gaussian` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._string_methods diff --git a/src/sleplet/functions/harmonic_gaussian.py b/src/sleplet/functions/harmonic_gaussian.py index dd2e0d955..f00292cb9 100644 --- a/src/sleplet/functions/harmonic_gaussian.py +++ b/src/sleplet/functions/harmonic_gaussian.py @@ -1,7 +1,7 @@ """Contains the `HarmonicGaussian` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._string_methods diff --git a/src/sleplet/functions/identity.py b/src/sleplet/functions/identity.py index 0f46a53e7..2fe60fca0 100644 --- a/src/sleplet/functions/identity.py +++ b/src/sleplet/functions/identity.py @@ -1,7 +1,7 @@ """Contains the `Identity` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/functions/noise_earth.py b/src/sleplet/functions/noise_earth.py index 52aaa0c36..37cd5eead 100644 --- a/src/sleplet/functions/noise_earth.py +++ b/src/sleplet/functions/noise_earth.py @@ -1,7 +1,7 @@ """Contains the `NoiseEarth` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/functions/ridgelets.py b/src/sleplet/functions/ridgelets.py index 218d0c6ff..72d0f1b94 100644 --- a/src/sleplet/functions/ridgelets.py +++ b/src/sleplet/functions/ridgelets.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import pyssht as ssht import scipy.special @@ -104,7 +104,7 @@ def _compute_ring(self) -> npt.NDArray[np.complex_]: return ring_lm @pydantic.validator("j") - def _check_j(cls, v, values): + def _check_j(cls, v, values): # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["L"], diff --git a/src/sleplet/functions/slepian.py b/src/sleplet/functions/slepian.py index 5ca0b755e..4e8e80bf4 100644 --- a/src/sleplet/functions/slepian.py +++ b/src/sleplet/functions/slepian.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._validation import sleplet.slepian_methods @@ -73,7 +73,7 @@ def _validate_rank(self) -> None: raise ValueError(f"rank should be less than {limit}") @pydantic.validator("rank") - def _check_rank(cls, v): + def _check_rank(cls, v): # noqa: N805 if not isinstance(v, int): raise TypeError("rank should be an integer") if v < 0: diff --git a/src/sleplet/functions/slepian_africa.py b/src/sleplet/functions/slepian_africa.py index 8aaeba1bf..47c6899fd 100644 --- a/src/sleplet/functions/slepian_africa.py +++ b/src/sleplet/functions/slepian_africa.py @@ -1,7 +1,7 @@ """Contains the `SlepianAfrica` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/functions/slepian_dirac_delta.py b/src/sleplet/functions/slepian_dirac_delta.py index df6643ef3..1aa676511 100644 --- a/src/sleplet/functions/slepian_dirac_delta.py +++ b/src/sleplet/functions/slepian_dirac_delta.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._string_methods diff --git a/src/sleplet/functions/slepian_identity.py b/src/sleplet/functions/slepian_identity.py index d0b83eecf..044a998f0 100644 --- a/src/sleplet/functions/slepian_identity.py +++ b/src/sleplet/functions/slepian_identity.py @@ -1,7 +1,7 @@ """Contains the `SlepianIdentity` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/functions/slepian_noise_africa.py b/src/sleplet/functions/slepian_noise_africa.py index 2aa084ca3..8c8d987f5 100644 --- a/src/sleplet/functions/slepian_noise_africa.py +++ b/src/sleplet/functions/slepian_noise_africa.py @@ -1,7 +1,7 @@ """Contains the `SlepianNoiseAfrica` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/functions/slepian_noise_south_america.py b/src/sleplet/functions/slepian_noise_south_america.py index c5d9978ea..b4d431a71 100644 --- a/src/sleplet/functions/slepian_noise_south_america.py +++ b/src/sleplet/functions/slepian_noise_south_america.py @@ -1,7 +1,7 @@ """Contains the `SlepianNoiseSouthAmerica` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/functions/slepian_south_america.py b/src/sleplet/functions/slepian_south_america.py index 13648dd80..fb4920245 100644 --- a/src/sleplet/functions/slepian_south_america.py +++ b/src/sleplet/functions/slepian_south_america.py @@ -1,7 +1,7 @@ """Contains the `SlepianSouthAmerica` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/functions/slepian_wavelet_coefficients_africa.py b/src/sleplet/functions/slepian_wavelet_coefficients_africa.py index 9fe932575..4d68ee79e 100644 --- a/src/sleplet/functions/slepian_wavelet_coefficients_africa.py +++ b/src/sleplet/functions/slepian_wavelet_coefficients_africa.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import sleplet._string_methods @@ -89,7 +89,7 @@ def _create_wavelet_coefficients( return wavelets, wavelet_coefficients @pydantic.validator("j") - def _check_j(cls, v, values): + def _check_j(cls, v, values): # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["L"] ** 2, diff --git a/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py b/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py index d55460fce..af670c99a 100644 --- a/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py +++ b/src/sleplet/functions/slepian_wavelet_coefficients_south_america.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import sleplet._string_methods @@ -89,7 +89,7 @@ def _create_wavelet_coefficients( return wavelets, wavelet_coefficients @pydantic.validator("j") - def _check_j(cls, v, values): + def _check_j(cls, v, values): # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["L"] ** 2, diff --git a/src/sleplet/functions/slepian_wavelets.py b/src/sleplet/functions/slepian_wavelets.py index c17b70915..d6f35eaec 100644 --- a/src/sleplet/functions/slepian_wavelets.py +++ b/src/sleplet/functions/slepian_wavelets.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import sleplet._string_methods @@ -63,7 +63,7 @@ def _create_wavelets(self) -> npt.NDArray[np.float_]: return sleplet.wavelet_methods.create_kappas(self.L**2, self.B, self.j_min) @pydantic.validator("j") - def _check_j(cls, v, values): + def _check_j(cls, v, values): # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["L"] ** 2, diff --git a/src/sleplet/functions/south_america.py b/src/sleplet/functions/south_america.py index 5ca99653e..febaf55d9 100644 --- a/src/sleplet/functions/south_america.py +++ b/src/sleplet/functions/south_america.py @@ -1,7 +1,7 @@ """Contains the `SouthAmerica` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._data.create_earth_flm diff --git a/src/sleplet/functions/spherical_harmonic.py b/src/sleplet/functions/spherical_harmonic.py index 422ef522c..4f738b5f6 100644 --- a/src/sleplet/functions/spherical_harmonic.py +++ b/src/sleplet/functions/spherical_harmonic.py @@ -1,7 +1,7 @@ """Contains the `SphericalHarmonic` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._string_methods @@ -44,7 +44,7 @@ def _setup_args(self) -> None: self.ell, self.m = self.extra_args @pydantic.validator("ell") - def _check_ell(cls, v, values): + def _check_ell(cls, v, values): # noqa: N805 if not isinstance(v, int): raise TypeError("ell should be an integer") if v < 0: @@ -54,7 +54,7 @@ def _check_ell(cls, v, values): return v @pydantic.validator("m") - def _check_m(cls, v, values): + def _check_m(cls, v, values): # noqa: N805 if not isinstance(v, int): raise TypeError("m should be an integer") if abs(v) > values["ell"]: diff --git a/src/sleplet/functions/squashed_gaussian.py b/src/sleplet/functions/squashed_gaussian.py index 290d67456..179a6066c 100644 --- a/src/sleplet/functions/squashed_gaussian.py +++ b/src/sleplet/functions/squashed_gaussian.py @@ -1,7 +1,7 @@ """Contains the `SquashedGaussian` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/functions/wmap.py b/src/sleplet/functions/wmap.py index 64b18c769..433f44134 100644 --- a/src/sleplet/functions/wmap.py +++ b/src/sleplet/functions/wmap.py @@ -1,7 +1,7 @@ """Contains the `Wmap` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._data.create_wmap_flm import sleplet._string_methods diff --git a/src/sleplet/meshes/_mesh_slepian_decomposition.py b/src/sleplet/meshes/_mesh_slepian_decomposition.py index 27fe66aee..3a9e669f4 100644 --- a/src/sleplet/meshes/_mesh_slepian_decomposition.py +++ b/src/sleplet/meshes/_mesh_slepian_decomposition.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._integration_methods import sleplet._validation diff --git a/src/sleplet/meshes/mesh.py b/src/sleplet/meshes/mesh.py index e3fce5f84..13c07be53 100644 --- a/src/sleplet/meshes/mesh.py +++ b/src/sleplet/meshes/mesh.py @@ -1,7 +1,7 @@ """Contains the `Mesh` class.""" import dataclasses -import pydantic +import pydantic.v1 as pydantic import sleplet._mesh_methods import sleplet._plotly_methods diff --git a/src/sleplet/meshes/mesh_basis_functions.py b/src/sleplet/meshes/mesh_basis_functions.py index 59d923db1..8222e8bca 100644 --- a/src/sleplet/meshes/mesh_basis_functions.py +++ b/src/sleplet/meshes/mesh_basis_functions.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._validation import sleplet.harmonic_methods @@ -60,7 +60,7 @@ def _validate_rank(self) -> None: raise ValueError(f"rank should be less than or equal to {limit}") @pydantic.validator("rank") - def _check_rank(cls, v): + def _check_rank(cls, v): # noqa: N805 if not isinstance(v, int): raise TypeError("rank should be an integer") if v < 0: diff --git a/src/sleplet/meshes/mesh_coefficients.py b/src/sleplet/meshes/mesh_coefficients.py index 11ee21539..e0b388230 100644 --- a/src/sleplet/meshes/mesh_coefficients.py +++ b/src/sleplet/meshes/mesh_coefficients.py @@ -4,7 +4,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._mask_methods import sleplet._string_methods @@ -47,7 +47,7 @@ def _add_details_to_name(self) -> None: self.name += "_zoom" @pydantic.validator("coefficients", check_fields=False) - def _check_coefficients(cls, v, values): + def _check_coefficients(cls, v, values): # noqa: N805 if ( values["region"] and _COEFFICIENTS_TO_NOT_MASK not in cls.__class__.__name__.lower() diff --git a/src/sleplet/meshes/mesh_field.py b/src/sleplet/meshes/mesh_field.py index 6e6ce83a0..483320ade 100644 --- a/src/sleplet/meshes/mesh_field.py +++ b/src/sleplet/meshes/mesh_field.py @@ -2,7 +2,7 @@ import igl import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._validation import sleplet.harmonic_methods diff --git a/src/sleplet/meshes/mesh_harmonic_coefficients.py b/src/sleplet/meshes/mesh_harmonic_coefficients.py index 6c350e5dd..a1671d562 100644 --- a/src/sleplet/meshes/mesh_harmonic_coefficients.py +++ b/src/sleplet/meshes/mesh_harmonic_coefficients.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._validation import sleplet.noise diff --git a/src/sleplet/meshes/mesh_noise_field.py b/src/sleplet/meshes/mesh_noise_field.py index 70e4609ba..e9a1a7b4a 100644 --- a/src/sleplet/meshes/mesh_noise_field.py +++ b/src/sleplet/meshes/mesh_noise_field.py @@ -1,7 +1,7 @@ """Contains the `MeshNoiseField` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/meshes/mesh_slepian.py b/src/sleplet/meshes/mesh_slepian.py index 4368fb46a..14bee2098 100644 --- a/src/sleplet/meshes/mesh_slepian.py +++ b/src/sleplet/meshes/mesh_slepian.py @@ -7,7 +7,7 @@ import numpy.linalg as LA # noqa: N812 import numpy.typing as npt import platformdirs -import pydantic +import pydantic.v1 as pydantic import sleplet._array_methods import sleplet._data.setup_pooch diff --git a/src/sleplet/meshes/mesh_slepian_coefficients.py b/src/sleplet/meshes/mesh_slepian_coefficients.py index c381abcfc..bec94d260 100644 --- a/src/sleplet/meshes/mesh_slepian_coefficients.py +++ b/src/sleplet/meshes/mesh_slepian_coefficients.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._validation import sleplet.noise diff --git a/src/sleplet/meshes/mesh_slepian_field.py b/src/sleplet/meshes/mesh_slepian_field.py index f72019041..f090ccd57 100644 --- a/src/sleplet/meshes/mesh_slepian_field.py +++ b/src/sleplet/meshes/mesh_slepian_field.py @@ -1,7 +1,7 @@ """Contains the `MeshSlepianField` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._validation import sleplet.meshes.mesh_field diff --git a/src/sleplet/meshes/mesh_slepian_functions.py b/src/sleplet/meshes/mesh_slepian_functions.py index 09100d72b..36185c08f 100644 --- a/src/sleplet/meshes/mesh_slepian_functions.py +++ b/src/sleplet/meshes/mesh_slepian_functions.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._validation import sleplet.slepian_methods @@ -62,7 +62,7 @@ def _validate_rank(self) -> None: raise ValueError(f"rank should be less than or equal to {limit}") @pydantic.validator("rank") - def _check_rank(cls, v): + def _check_rank(cls, v): # noqa: N805 if not isinstance(v, int): raise TypeError("rank should be an integer") if v < 0: diff --git a/src/sleplet/meshes/mesh_slepian_noise_field.py b/src/sleplet/meshes/mesh_slepian_noise_field.py index e4f9db927..3eec0bbce 100644 --- a/src/sleplet/meshes/mesh_slepian_noise_field.py +++ b/src/sleplet/meshes/mesh_slepian_noise_field.py @@ -1,7 +1,7 @@ """Contains the `MeshSlepianNoiseField` class.""" import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._string_methods import sleplet._validation diff --git a/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py b/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py index b4b4c6caf..189be55cd 100644 --- a/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py +++ b/src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import sleplet._string_methods @@ -74,7 +74,7 @@ def _create_wavelet_coefficients( return wavelets, wavelet_coefficients @pydantic.validator("j") - def _check_j(cls, v, values): + def _check_j(cls, v, values): # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["mesh"].mesh_eigenvalues.shape[0], diff --git a/src/sleplet/meshes/mesh_slepian_wavelets.py b/src/sleplet/meshes/mesh_slepian_wavelets.py index 5ee93707e..0b47674b1 100644 --- a/src/sleplet/meshes/mesh_slepian_wavelets.py +++ b/src/sleplet/meshes/mesh_slepian_wavelets.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pys2let import sleplet._string_methods @@ -60,7 +60,7 @@ def _create_wavelets(self) -> npt.NDArray[np.float_]: ) @pydantic.validator("j") - def _check_j(cls, v, values) -> int | None: + def _check_j(cls, v, values) -> int | None: # noqa: N805 j_max = pys2let.pys2let_j_max( values["B"], values["mesh"].mesh_eigenvalues.shape[0], diff --git a/src/sleplet/plotting/_create_plot_mesh.py b/src/sleplet/plotting/_create_plot_mesh.py index 10bfaef7c..fe4e58e23 100644 --- a/src/sleplet/plotting/_create_plot_mesh.py +++ b/src/sleplet/plotting/_create_plot_mesh.py @@ -7,7 +7,7 @@ import numpy.typing as npt import plotly.graph_objs as go import plotly.io as pio -import pydantic +import pydantic.v1 as pydantic import sleplet._mask_methods import sleplet._mesh_methods diff --git a/src/sleplet/plotting/_create_plot_sphere.py b/src/sleplet/plotting/_create_plot_sphere.py index eb9f6b49b..091619fc9 100644 --- a/src/sleplet/plotting/_create_plot_sphere.py +++ b/src/sleplet/plotting/_create_plot_sphere.py @@ -6,7 +6,7 @@ import numpy.typing as npt import plotly.graph_objs as go import plotly.io as pio -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._plotly_methods diff --git a/src/sleplet/slepian/_slepian_decomposition.py b/src/sleplet/slepian/_slepian_decomposition.py index 61d685c5a..5d31c4343 100644 --- a/src/sleplet/slepian/_slepian_decomposition.py +++ b/src/sleplet/slepian/_slepian_decomposition.py @@ -3,7 +3,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._integration_methods diff --git a/src/sleplet/slepian/region.py b/src/sleplet/slepian/region.py index 321a734ec..bae5e59fa 100644 --- a/src/sleplet/slepian/region.py +++ b/src/sleplet/slepian/region.py @@ -1,7 +1,7 @@ """Contains the `Region` class.""" import logging -import pydantic +import pydantic.v1 as pydantic import sleplet._bool_methods import sleplet._string_methods @@ -87,7 +87,7 @@ def _identify_region(self) -> None: ) @pydantic.validator("phi_max") - def _check_phi_max(cls, v): + def _check_phi_max(cls, v): # noqa: N805 if v < sleplet._vars.PHI_MIN_DEFAULT: raise ValueError("phi_max cannot be negative") if v > sleplet._vars.PHI_MAX_DEFAULT: @@ -98,7 +98,7 @@ def _check_phi_max(cls, v): return v @pydantic.validator("phi_min") - def _check_phi_min(cls, v): + def _check_phi_min(cls, v): # noqa: N805 if v < sleplet._vars.PHI_MIN_DEFAULT: raise ValueError("phi_min cannot be negative") if v > sleplet._vars.PHI_MAX_DEFAULT: @@ -109,7 +109,7 @@ def _check_phi_min(cls, v): return v @pydantic.validator("theta_max") - def _check_theta_max(cls, v): + def _check_theta_max(cls, v): # noqa: N805 if v < sleplet._vars.THETA_MIN_DEFAULT: raise ValueError("theta_max cannot be negative") if v > sleplet._vars.THETA_MAX_DEFAULT: @@ -120,7 +120,7 @@ def _check_theta_max(cls, v): return v @pydantic.validator("theta_min") - def _check_theta_min(cls, v): + def _check_theta_min(cls, v): # noqa: N805 if v < sleplet._vars.THETA_MIN_DEFAULT: raise ValueError("theta_min cannot be negative") if v > sleplet._vars.THETA_MAX_DEFAULT: diff --git a/src/sleplet/slepian/slepian_arbitrary.py b/src/sleplet/slepian/slepian_arbitrary.py index 12acef802..9d5f0a666 100644 --- a/src/sleplet/slepian/slepian_arbitrary.py +++ b/src/sleplet/slepian/slepian_arbitrary.py @@ -7,7 +7,7 @@ import numpy.linalg as LA # noqa: N812 import numpy.typing as npt import platformdirs -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._array_methods diff --git a/src/sleplet/slepian/slepian_functions.py b/src/sleplet/slepian/slepian_functions.py index e49e07f71..bba5c6f29 100644 --- a/src/sleplet/slepian/slepian_functions.py +++ b/src/sleplet/slepian/slepian_functions.py @@ -4,7 +4,7 @@ import numpy as np import numpy.typing as npt -import pydantic +import pydantic.v1 as pydantic import sleplet._validation diff --git a/src/sleplet/slepian/slepian_limit_lat_lon.py b/src/sleplet/slepian/slepian_limit_lat_lon.py index 7f2cd60c6..b8d119a56 100644 --- a/src/sleplet/slepian/slepian_limit_lat_lon.py +++ b/src/sleplet/slepian/slepian_limit_lat_lon.py @@ -6,7 +6,7 @@ import numpy.linalg as LA # noqa: N812 import numpy.typing as npt import platformdirs -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._array_methods diff --git a/src/sleplet/slepian/slepian_polar_cap.py b/src/sleplet/slepian/slepian_polar_cap.py index af0bc348a..c6ee21965 100644 --- a/src/sleplet/slepian/slepian_polar_cap.py +++ b/src/sleplet/slepian/slepian_polar_cap.py @@ -9,7 +9,7 @@ import numpy.linalg as LA # noqa: N812 import numpy.typing as npt import platformdirs -import pydantic +import pydantic.v1 as pydantic import pyssht as ssht import sleplet._data.setup_pooch @@ -383,13 +383,13 @@ def _clean_evals_and_evecs( return eigenvalues, eigenvectors @pydantic.validator("order") - def _check_order(cls, v, values): + def _check_order(cls, v, values): # noqa: N805 if v is not None and (np.abs(v) >= values["L"]).any(): raise ValueError(f"Order magnitude should be less than {values['L']}") return v @pydantic.validator("theta_max") - def _check_theta_max(cls, v): + def _check_theta_max(cls, v): # noqa: N805 if v == 0: raise ValueError("theta_max cannot be zero") return v