Skip to content

Commit aaccfbd

Browse files
ci(pre-commit.ci): autoupdate (#298)
* ci(pre-commit.ci): autoupdate updates: - [github.com/adhtruong/mirrors-typos: v1.45.0 → v1.48.0](adhtruong/mirrors-typos@v1.45.0...v1.48.0) - [github.com/astral-sh/ruff-pre-commit: v0.15.9 → v0.15.20](astral-sh/ruff-pre-commit@v0.15.9...v0.15.20) - [github.com/pre-commit/mirrors-mypy: v1.20.0 → v2.1.0](pre-commit/mirrors-mypy@v1.20.0...v2.1.0) * ci: update pre-commit hooks and dependencies; refactor frame handling in ND2File and ModernReader --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Talley Lambert <talley.lambert@gmail.com>
1 parent 8bb24d4 commit aaccfbd

5 files changed

Lines changed: 14 additions & 8 deletions

File tree

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ repos:
1010
- id: validate-pyproject
1111

1212
- repo: https://github.com/adhtruong/mirrors-typos
13-
rev: v1.45.0
13+
rev: v1.48.0
1414
hooks:
1515
- id: typos
1616
args: [--force-exclude] # omit --write-changes
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.15.9
19+
rev: v0.16.0
2020
hooks:
2121
- id: ruff-check
2222
- id: ruff-format
2323

2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.20.0
25+
rev: v2.3.0
2626
hooks:
2727
- id: mypy
2828
files: "^src/"

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ legacy = [
3535
"imagecodecs>=2021.2.26",
3636
"imagecodecs>=2021.8.26; python_version >= '3.10'",
3737
"imagecodecs>=2022.7.31; python_version >= '3.11'",
38-
"imagecodecs>=2023.9.18; python_version >= '3.12'",
39-
"imagecodecs>=2024.9.22; python_version >= '3.13'",
38+
"imagecodecs>=2024.6.1; python_version >= '3.12'",
39+
"imagecodecs>=2024.12.30; python_version >= '3.13'",
4040
]
4141
tiff = ["tifffile>=2021.7.2"]
4242
ome-zarr = [
@@ -53,6 +53,9 @@ test = [
5353
"nd2[tiff]",
5454
"dask[array]>=2023.5.0",
5555
"imagecodecs>=2023.1.23",
56+
# older versions no longer ship wheels for these pythons
57+
"imagecodecs>=2024.6.1; python_version >= '3.12'",
58+
"imagecodecs>=2024.12.30; python_version >= '3.13'",
5659
"lxml>=5.3.0",
5760
"psutil>=5.9.8",
5861
"pytest-codspeed>=4.1.1",

src/nd2/_nd2file.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,10 @@ def read_frame(self, frame_index: SupportsInt) -> np.ndarray:
12521252
!!! Tip "new in version 0.8.0"
12531253
"""
12541254
frame = self._rdr.read_frame(int(frame_index))
1255-
frame.shape = self._raw_frame_shape
1255+
# NOTE: use reshape rather than in-place `frame.shape = ...`,
1256+
# which numpy deprecated in v2.5. The reader always returns something
1257+
# that can be reshaped without a copy.
1258+
frame = frame.reshape(self._raw_frame_shape)
12561259
return frame.transpose((2, 0, 1, 3)).squeeze()
12571260

12581261
@cached_property

src/nd2/_parse/_clx_xml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _float_or_nan(x: str) -> float:
3333

3434

3535
# functions to cast CLxvariants to python types
36-
_XMLCAST: dict[str | None | bytes, Callable[[Any], Scalar]] = {
36+
_XMLCAST: dict[str | bytes | None, Callable[[Any], Scalar]] = {
3737
"bool": lambda x: x.lower() in {"true", "1"},
3838
"CLxByteArray": lambda x: bytearray(x, "utf8"),
3939
"CLxStringW": str,

src/nd2/_readers/_modern/modern_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _cached_frame_times(self) -> list[float]:
272272
warnings.warn(f"Failed to load frame times: {e}", stacklevel=2)
273273
self._frame_times = []
274274

275-
return cast("list[float]", self._frame_times)
275+
return self._frame_times
276276

277277
def voxel_size(self) -> tuple[float, float, float]:
278278
meta = self.metadata()

0 commit comments

Comments
 (0)