Skip to content

Commit

Permalink
More mypy improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyroddy committed May 24, 2024
1 parent 7961636 commit c6ef8b5
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 21 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ plugins = [
]
strict = true
warn_return_any = false
warn_unreachable = true

[tool.pytest.ini_options]
addopts = [
Expand Down
3 changes: 0 additions & 3 deletions src/sleplet/functions/slepian.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ def _check_rank(
cls, # noqa: ANN101
v: int,
) -> int:
if not isinstance(v, int):
msg = "rank should be an integer"
raise TypeError(msg)
if v < 0:
msg = "rank cannot be negative"
raise ValueError(msg)
Expand Down
6 changes: 0 additions & 6 deletions src/sleplet/functions/spherical_harmonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ def _check_ell(
v: int,
info: pydantic.ValidationInfo,
) -> int:
if not isinstance(v, int):
msg = "ell should be an integer"
raise TypeError(msg)
if v < 0:
msg = "ell should be positive"
raise ValueError(msg)
Expand All @@ -72,9 +69,6 @@ def _check_m(
v: int,
info: pydantic.ValidationInfo,
) -> int:
if not isinstance(v, int):
msg = "m should be an integer"
raise TypeError(msg)
if abs(v) > info.data["ell"]:
msg = "the magnitude of m should be less than ell"
raise ValueError(msg)
Expand Down
3 changes: 0 additions & 3 deletions src/sleplet/meshes/_mesh_slepian_decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ def _detect_method(self: typing_extensions.Self) -> None:

def _validate_rank(self: typing_extensions.Self, rank: int) -> None:
"""Check the requested rank is valid."""
if not isinstance(rank, int):
msg = "rank should be an integer"
raise TypeError(msg)
if rank < 0:
msg = "rank cannot be negative"
raise ValueError(msg)
Expand Down
3 changes: 0 additions & 3 deletions src/sleplet/meshes/mesh_basis_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ def _check_rank(
cls, # noqa: ANN101
v: int,
) -> int:
if not isinstance(v, int):
msg = "rank should be an integer"
raise TypeError(msg)
if v < 0:
msg = "rank cannot be negative"
raise ValueError(msg)
Expand Down
3 changes: 0 additions & 3 deletions src/sleplet/meshes/mesh_slepian_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ def _check_rank(
cls, # noqa: ANN101
v: int,
) -> int:
if not isinstance(v, int):
msg = "rank should be an integer"
raise TypeError(msg)
if v < 0:
msg = "rank cannot be negative"
raise ValueError(msg)
Expand Down
3 changes: 0 additions & 3 deletions src/sleplet/slepian/_slepian_decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ def _detect_method(self: typing_extensions.Self) -> None:

def _validate_rank(self: typing_extensions.Self, rank: int) -> None:
"""Check the requested rank is valid."""
if not isinstance(rank, int):
msg = "rank should be an integer"
raise TypeError(msg)
if rank < 0:
msg = "rank cannot be negative"
raise ValueError(msg)
Expand Down

0 comments on commit c6ef8b5

Please sign in to comment.