Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import pydantic.v1 with v2 #207

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/africa.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"],
Expand Down
4 changes: 2 additions & 2 deletions src/sleplet/functions/axisymmetric_wavelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"],
Expand Down
4 changes: 2 additions & 2 deletions src/sleplet/functions/coefficients.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/dirac_delta.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/sleplet/functions/directional_spin_wavelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"],
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/earth.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/elongated_gaussian.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/flm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/fp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/gaussian.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/harmonic_gaussian.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/identity.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/noise_earth.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/sleplet/functions/ridgelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"],
Expand Down
4 changes: 2 additions & 2 deletions src/sleplet/functions/slepian.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/slepian_africa.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/slepian_dirac_delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/slepian_identity.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/slepian_noise_africa.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/slepian_noise_south_america.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/slepian_south_america.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/sleplet/functions/slepian_wavelet_coefficients_africa.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/sleplet/functions/slepian_wavelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/sleplet/functions/south_america.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/sleplet/functions/spherical_harmonic.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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"]:
Expand Down
Loading
Loading