Skip to content

Commit

Permalink
Add suggestions from Scientific Python (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyroddy authored May 24, 2024
1 parent 5919fb2 commit bf35bcd
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/workflows/examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- main
- renovate/**
pull_request:
workflow_dispatch:

concurrency:
cancel-in-progress: true
Expand Down
28 changes: 23 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ paths.source = [
[tool.mypy]
disallow_subclassing_any = false
disallow_untyped_decorators = false
enable_error_code = [
"ignore-without-code",
"redundant-expr",
"truthy-bool",
]
explicit_package_bases = true
ignore_missing_imports = true
plugins = [
Expand All @@ -118,20 +123,33 @@ plugins = [
]
strict = true
warn_return_any = false
warn_unreachable = true

[tool.pytest.ini_options]
addopts = """
--color=yes
--import-mode=importlib
--verbose
"""
addopts = [
"--color=yes",
"--import-mode=importlib",
"--strict-config",
"--strict-markers",
"--verbose",
"-ra",
]
filterwarnings = [
"error",
]
log_cli_level = "INFO"
minversion = 6
testpaths = [
"tests",
]
xfail_strict = true

[tool.ruff]
fix = true
force-exclude = true
src = [
"src",
]
lint.ignore = [
"COM812",
"D105",
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 bf35bcd

Please sign in to comment.