Skip to content

Commit

Permalink
Remove ignore in favor of noqa (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyroddy committed Oct 31, 2023
1 parent e61b268 commit 3e6b50c
Show file tree
Hide file tree
Showing 27 changed files with 102 additions and 25 deletions.
1 change: 1 addition & 0 deletions examples/arbitrary/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# noqa: D104
2 changes: 1 addition & 1 deletion examples/arbitrary/_denoising_slepian_wavelet.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def denoising_slepian_wavelet(
)

# compute wavelet noise
sigma_j = sleplet.noise._compute_slepian_sigma_j(
sigma_j = sleplet.noise._compute_slepian_sigma_j( # noqa: SLF001
signal.L,
signal.coefficients,
slepian_wavelets.wavelets,
Expand Down
1 change: 1 addition & 0 deletions examples/arbitrary/africa/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# noqa: D104
1 change: 1 addition & 0 deletions examples/arbitrary/south_america/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# noqa: D104
1 change: 1 addition & 0 deletions examples/mesh/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# noqa: D104
1 change: 1 addition & 0 deletions examples/misc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# noqa: D104
2 changes: 1 addition & 1 deletion examples/misc/_denoising_axisym.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def denoising_axisym( # noqa: PLR0913
)

# compute wavelet noise
sigma_j = sleplet.noise._compute_sigma_j(
sigma_j = sleplet.noise._compute_sigma_j( # noqa: SLF001
signal.coefficients,
axisymmetric_wavelets.wavelets[1:],
snr_in,
Expand Down
1 change: 1 addition & 0 deletions examples/polar_cap/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# noqa: D104
1 change: 1 addition & 0 deletions examples/wavelets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# noqa: D104
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,11 @@ isort = {known-first-party = [
]}}
per-file-ignores = {"examples*" = [
"D100",
"D104",
"SLF001",
"T201",
], "src*" = [
"SLF001",
], "tests*" = [
"D100",
"D104",
"S101",
"SLF001",
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ def _create_wavelet_coefficients(
return wavelets, wavelet_coefficients

@pydantic.field_validator("j")
def _check_j(cls, v: int | None, info: pydantic.ValidationInfo) -> int | None: # noqa: ANN101
def _check_j(
cls, # noqa: ANN101
v: int | None,
info: pydantic.ValidationInfo,
) -> int | None:
j_max = pys2let.pys2let_j_max(
info.data["B"],
info.data["L"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ def _create_wavelet_coefficients(
return wavelets, wavelet_coefficients

@pydantic.field_validator("j")
def _check_j(cls, v: int | None, info: pydantic.ValidationInfo) -> int | None: # noqa: ANN101
def _check_j(
cls, # noqa: ANN101
v: int | None,
info: pydantic.ValidationInfo,
) -> int | None:
j_max = pys2let.pys2let_j_max(
info.data["B"],
info.data["L"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ def _create_wavelet_coefficients(
return wavelets, wavelet_coefficients

@pydantic.field_validator("j")
def _check_j(cls, v: int | None, info: pydantic.ValidationInfo) -> int | None: # noqa: ANN101
def _check_j(
cls, # noqa: ANN101
v: int | None,
info: pydantic.ValidationInfo,
) -> int | None:
j_max = pys2let.pys2let_j_max(
info.data["B"],
info.data["L"],
Expand Down
6 changes: 5 additions & 1 deletion src/sleplet/functions/axisymmetric_wavelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.complex_]:
)

@pydantic.field_validator("j")
def _check_j(cls, v: int | None, info: pydantic.ValidationInfo) -> int | None: # noqa: ANN101
def _check_j(
cls, # noqa: ANN101
v: int | None,
info: pydantic.ValidationInfo,
) -> int | None:
j_max = pys2let.pys2let_j_max(
info.data["B"],
info.data["L"],
Expand Down
6 changes: 5 additions & 1 deletion src/sleplet/functions/ridgelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ def _compute_ring(self: typing_extensions.Self) -> npt.NDArray[np.complex_]:
return ring_lm

@pydantic.field_validator("j")
def _check_j(cls, v: int | None, info: pydantic.ValidationInfo) -> int | None: # noqa: ANN101
def _check_j(
cls, # noqa: ANN101
v: int | None,
info: pydantic.ValidationInfo,
) -> int | None:
j_max = pys2let.pys2let_j_max(
info.data["B"],
info.data["L"],
Expand Down
5 changes: 4 additions & 1 deletion src/sleplet/functions/slepian.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ def _validate_rank(self: typing_extensions.Self) -> None:
raise ValueError(msg)

@pydantic.field_validator("rank")
def _check_rank(cls, v: int) -> int: # noqa: ANN101
def _check_rank(
cls, # noqa: ANN101
v: int,
) -> int:
if not isinstance(v, int):
msg = "rank should be an integer"
raise TypeError(msg)
Expand Down
6 changes: 5 additions & 1 deletion src/sleplet/functions/slepian_wavelet_coefficients_africa.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ def _create_wavelet_coefficients(
return wavelets, wavelet_coefficients

@pydantic.field_validator("j")
def _check_j(cls, v: int | None, info: pydantic.ValidationInfo) -> int | None: # noqa: ANN101
def _check_j(
cls, # noqa: ANN101
v: int | None,
info: pydantic.ValidationInfo,
) -> int | None:
j_max = pys2let.pys2let_j_max(
info.data["B"],
info.data["L"] ** 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ def _create_wavelet_coefficients(
return wavelets, wavelet_coefficients

@pydantic.field_validator("j")
def _check_j(cls, v: int | None, info: pydantic.ValidationInfo) -> int | None: # noqa: ANN101
def _check_j(
cls, # noqa: ANN101
v: int | None,
info: pydantic.ValidationInfo,
) -> int | None:
j_max = pys2let.pys2let_j_max(
info.data["B"],
info.data["L"] ** 2,
Expand Down
6 changes: 5 additions & 1 deletion src/sleplet/functions/slepian_wavelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.float_]:
return sleplet.wavelet_methods.create_kappas(self.L**2, self.B, self.j_min)

@pydantic.field_validator("j")
def _check_j(cls, v: int | None, info: pydantic.ValidationInfo) -> int | None: # noqa: ANN101
def _check_j(
cls, # noqa: ANN101
v: int | None,
info: pydantic.ValidationInfo,
) -> int | None:
j_max = pys2let.pys2let_j_max(
info.data["B"],
info.data["L"] ** 2,
Expand Down
12 changes: 10 additions & 2 deletions src/sleplet/functions/spherical_harmonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ def _setup_args(self: typing_extensions.Self) -> None:
self.ell, self.m = self.extra_args

@pydantic.field_validator("ell")
def _check_ell(cls, v: int, info: pydantic.ValidationInfo) -> int: # noqa: ANN101
def _check_ell(
cls, # noqa: ANN101
v: int,
info: pydantic.ValidationInfo,
) -> int:
if not isinstance(v, int):
msg = "ell should be an integer"
raise TypeError(msg)
Expand All @@ -62,7 +66,11 @@ def _check_ell(cls, v: int, info: pydantic.ValidationInfo) -> int: # noqa: ANN1
return v

@pydantic.field_validator("m")
def _check_m(cls, v: int, info: pydantic.ValidationInfo) -> int: # noqa: ANN101
def _check_m(
cls, # noqa: ANN101
v: int,
info: pydantic.ValidationInfo,
) -> int:
if not isinstance(v, int):
msg = "m should be an integer"
raise TypeError(msg)
Expand Down
5 changes: 4 additions & 1 deletion src/sleplet/meshes/mesh_basis_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def _validate_rank(self: typing_extensions.Self) -> None:
raise ValueError(msg)

@pydantic.field_validator("rank")
def _check_rank(cls, v: int) -> int: # noqa: ANN101
def _check_rank(
cls, # noqa: ANN101
v: int,
) -> int:
if not isinstance(v, int):
msg = "rank should be an integer"
raise TypeError(msg)
Expand Down
5 changes: 4 additions & 1 deletion src/sleplet/meshes/mesh_slepian_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ def _validate_rank(self: typing_extensions.Self) -> None:
raise ValueError(msg)

@pydantic.field_validator("rank")
def _check_rank(cls, v: int) -> int: # noqa: ANN101
def _check_rank(
cls, # noqa: ANN101
v: int,
) -> int:
if not isinstance(v, int):
msg = "rank should be an integer"
raise TypeError(msg)
Expand Down
6 changes: 5 additions & 1 deletion src/sleplet/meshes/mesh_slepian_wavelet_coefficients.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ def _create_wavelet_coefficients(
return wavelets, wavelet_coefficients

@pydantic.field_validator("j")
def _check_j(cls, v: int | None, info: pydantic.ValidationInfo) -> int | None: # noqa: ANN101
def _check_j(
cls, # noqa: ANN101
v: int | None,
info: pydantic.ValidationInfo,
) -> int | None:
j_max = pys2let.pys2let_j_max(
info.data["B"],
info.data["mesh"].mesh_eigenvalues.shape[0],
Expand Down
6 changes: 5 additions & 1 deletion src/sleplet/meshes/mesh_slepian_wavelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ def _create_wavelets(self: typing_extensions.Self) -> npt.NDArray[np.float_]:
)

@pydantic.field_validator("j")
def _check_j(cls, v: int | None, info: pydantic.ValidationInfo) -> int | None: # noqa: ANN101
def _check_j(
cls, # noqa: ANN101
v: int | None,
info: pydantic.ValidationInfo,
) -> int | None:
j_max = pys2let.pys2let_j_max(
info.data["B"],
info.data["mesh"].mesh_eigenvalues.shape[0],
Expand Down
20 changes: 16 additions & 4 deletions src/sleplet/slepian/region.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ def _identify_region(self: typing_extensions.Self) -> None:
raise AttributeError(msg)

@pydantic.field_validator("phi_max")
def _check_phi_max(cls, v: float) -> float: # noqa: ANN101
def _check_phi_max(
cls, # noqa: ANN101
v: float,
) -> float:
if v < sleplet._vars.PHI_MIN_DEFAULT:
msg = "phi_max cannot be negative"
raise ValueError(msg)
Expand All @@ -105,7 +108,10 @@ def _check_phi_max(cls, v: float) -> float: # noqa: ANN101
return v

@pydantic.field_validator("phi_min")
def _check_phi_min(cls, v: float) -> float: # noqa: ANN101
def _check_phi_min(
cls, # noqa: ANN101
v: float,
) -> float:
if v < sleplet._vars.PHI_MIN_DEFAULT:
msg = "phi_min cannot be negative"
raise ValueError(msg)
Expand All @@ -118,7 +124,10 @@ def _check_phi_min(cls, v: float) -> float: # noqa: ANN101
return v

@pydantic.field_validator("theta_max")
def _check_theta_max(cls, v: float) -> float: # noqa: ANN101
def _check_theta_max(
cls, # noqa: ANN101
v: float,
) -> float:
if v < sleplet._vars.THETA_MIN_DEFAULT:
msg = "theta_max cannot be negative"
raise ValueError(msg)
Expand All @@ -131,7 +140,10 @@ def _check_theta_max(cls, v: float) -> float: # noqa: ANN101
return v

@pydantic.field_validator("theta_min")
def _check_theta_min(cls, v: float) -> float: # noqa: ANN101
def _check_theta_min(
cls, # noqa: ANN101
v: float,
) -> float:
if v < sleplet._vars.THETA_MIN_DEFAULT:
msg = "theta_min cannot be negative"
raise ValueError(msg)
Expand Down
5 changes: 4 additions & 1 deletion src/sleplet/slepian/slepian_polar_cap.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,10 @@ def _check_order(
return v

@pydantic.field_validator("theta_max")
def _check_theta_max(cls, v: float) -> float: # noqa: ANN101
def _check_theta_max(
cls, # noqa: ANN101
v: float,
) -> float:
if v == 0:
msg = "theta_max cannot be zero"
raise ValueError(msg)
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# noqa: D104

0 comments on commit 3e6b50c

Please sign in to comment.