Skip to content

Commit 4218098

Browse files
Update pyproject.toml and enable minor Ruff rules (#2196)
1 parent 81439dc commit 4218098

File tree

4 files changed

+5
-16
lines changed

4 files changed

+5
-16
lines changed

.github/ci/min_deps_check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def parse_requirements(fname) -> Iterator[tuple[str, int, int, int | None]]:
6060

6161
try:
6262
version_tup = tuple(int(x) for x in version.split("."))
63-
except ValueError:
64-
raise ValueError("non-numerical version: " + row)
63+
except ValueError as e:
64+
raise ValueError("non-numerical version: " + row) from e
6565

6666
if len(version_tup) == 2:
6767
yield (pkg, *version_tup, None) # type: ignore[misc]

parcels/particle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def __init__(
5151

5252
try:
5353
dtype = np.dtype(dtype)
54-
except (TypeError, ValueError):
54+
except (TypeError, ValueError) as e:
5555
if dtype is not _SAME_AS_FIELDSET_TIME_INTERVAL.VALUE:
56-
raise TypeError(f"Variable dtype must be a valid numpy dtype. Got {dtype=!r}")
56+
raise TypeError(f"Variable dtype must be a valid numpy dtype. Got {dtype=!r}") from e
5757

5858
if to_write not in _TO_WRITE_OPTIONS:
5959
raise ValueError(f"to_write must be one of {_TO_WRITE_OPTIONS!r}. Got {to_write=!r}")

parcels/xgcm/grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def check_neighbor(link, position):
515515
try:
516516
neighbor_link = face_links[idx][ax][correct_position]
517517
except (KeyError, IndexError):
518-
raise KeyError(
518+
raise KeyError( # noqa: B904
519519
f"Couldn't find a face link for face {idx!r}in axis {ax!r} at position {correct_position!r}"
520520
)
521521
idx_n, ax_n, rev_n = neighbor_link

pyproject.toml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ parcels = { path = ".", editable = true }
111111
[tool.setuptools]
112112
packages = ["parcels"]
113113

114-
[tool.setuptools.package-data]
115-
parcels = ["parcels/include/*"]
116-
117114
[tool.setuptools_scm]
118115
write_to = "parcels/_version_setup.py"
119116
local_scheme = "no-local-version"
@@ -193,15 +190,7 @@ ignore = [
193190
"D404",
194191
# 1 blank line required between summary line and description (requires writing of summaries)
195192
"D205",
196-
# do not use bare except, specify exception instead
197-
"E722",
198193
"F811",
199-
200-
201-
# TODO: These bugbear issues are to be resolved
202-
"B011", # Do not `assert False`
203-
"B016", # Cannot raise a literal. Did you intend to return it or raise an Exception?
204-
"B904", # Within an `except` clause, raise exceptions
205194
]
206195

207196
[tool.ruff.lint.pydocstyle]

0 commit comments

Comments
 (0)