Skip to content

Commit

Permalink
ci(pre-commit.ci): autoupdate (#206)
Browse files Browse the repository at this point in the history
* ci(pre-commit.ci): autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.9 → v0.2.0](astral-sh/ruff-pre-commit@v0.1.9...v0.2.0)
- [github.com/psf/black: 23.12.1 → 24.1.1](psf/black@23.12.1...24.1.1)
- [github.com/abravalheri/validate-pyproject: v0.15 → v0.16](abravalheri/validate-pyproject@v0.15...v0.16)

* style(pre-commit.ci): auto fixes [...]

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Feb 14, 2024
1 parent 4f110df commit 4459d5b
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.2.0
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
rev: v0.16
hooks:
- id: validate-pyproject

Expand Down
1 change: 1 addition & 0 deletions scripts/gather.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""gather metadata from all files in test/data with all nd readers."""

import contextlib
import json
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions scripts/nd2_describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
python scripts/nd2_describe.py > tests/samples_metadata.json
"""

import struct
from dataclasses import asdict
from pathlib import Path
Expand Down
7 changes: 3 additions & 4 deletions src/nd2/_binary.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for binary layers in ND2 files."""

from __future__ import annotations

import io
Expand Down Expand Up @@ -131,12 +132,10 @@ def __init__(self, data: list[BinaryLayer]) -> None:
self._data = data

@overload
def __getitem__(self, key: int) -> BinaryLayer:
...
def __getitem__(self, key: int) -> BinaryLayer: ...

@overload
def __getitem__(self, key: slice) -> list[BinaryLayer]:
...
def __getitem__(self, key: slice) -> list[BinaryLayer]: ...

def __getitem__(self, key: int | slice) -> BinaryLayer | list[BinaryLayer]:
return self._data[key]
Expand Down
1 change: 1 addition & 0 deletions src/nd2/_parse/_chunk_decode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FIXME: this has a lot of code duplication with _chunkmap.py."""

from __future__ import annotations

import mmap
Expand Down
1 change: 1 addition & 0 deletions src/nd2/_parse/_legacy_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
all of this logic is duplicated in _clx_xml.py.
_legacy.py just needs some slight updates to deal with different parsing results.
"""

from __future__ import annotations

import re
Expand Down
1 change: 1 addition & 0 deletions src/nd2/_sdk_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Various raw dict structures likely to be found in an ND2 file."""

from __future__ import annotations

from enum import IntEnum, auto
Expand Down
30 changes: 15 additions & 15 deletions src/nd2/nd2file.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,17 @@ def experiment(self) -> list[ExpLoop]:
@overload
def events(
self, *, orient: Literal["records"] = ..., null_value: Any = ...
) -> ListOfDicts:
...
) -> ListOfDicts: ...

@overload
def events(self, *, orient: Literal["list"], null_value: Any = ...) -> DictOfLists:
...
def events(
self, *, orient: Literal["list"], null_value: Any = ...
) -> DictOfLists: ...

@overload
def events(self, *, orient: Literal["dict"], null_value: Any = ...) -> DictOfDicts:
...
def events(
self, *, orient: Literal["dict"], null_value: Any = ...
) -> DictOfDicts: ...

def events(
self,
Expand Down Expand Up @@ -717,9 +718,11 @@ def frame_metadata(self, seq_index: int | tuple) -> FrameMetadata | dict:
"""
idx = cast(
int,
self._seq_index_from_coords(seq_index)
if isinstance(seq_index, tuple)
else seq_index,
(
self._seq_index_from_coords(seq_index)
if isinstance(seq_index, tuple)
else seq_index
),
)
return self._rdr.frame_metadata(idx)

Expand Down Expand Up @@ -1233,8 +1236,7 @@ def imread(
xarray: Literal[False] = ...,
validate_frames: bool = ...,
read_using_sdk: bool | None = None,
) -> np.ndarray:
...
) -> np.ndarray: ...


@overload
Expand All @@ -1245,8 +1247,7 @@ def imread(
xarray: Literal[True],
validate_frames: bool = ...,
read_using_sdk: bool | None = None,
) -> xr.DataArray:
...
) -> xr.DataArray: ...


@overload
Expand All @@ -1257,8 +1258,7 @@ def imread(
xarray: Literal[False] = ...,
validate_frames: bool = ...,
read_using_sdk: bool | None = None,
) -> dask.array.core.Array:
...
) -> dask.array.core.Array: ...


def imread(
Expand Down
1 change: 1 addition & 0 deletions src/nd2/readers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Reader subclasses for legacy and modern ND2 files."""

from ._legacy.legacy_reader import LegacyReader
from ._modern.modern_reader import ModernReader
from .protocol import ND2Reader
Expand Down
6 changes: 3 additions & 3 deletions src/nd2/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,9 @@ class Volume:
voxelCount: tuple[int, int, int]
componentMaxima: list[float] | None = None
componentMinima: list[float] | None = None
pixelToStageTransformationMatrix: tuple[
float, float, float, float, float, float
] | None = None
pixelToStageTransformationMatrix: (
tuple[float, float, float, float, float, float] | None
) = None

# NIS Microscope Absolute frame in um =
# pixelToStageTransformationMatrix * (X_in_px, Y_in_px, 1) + stagePositionUm
Expand Down
1 change: 1 addition & 0 deletions tests/test_aicsimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
It may need updating if it changes upstream
"""

import sys
from pathlib import Path
from typing import List, Optional, Tuple
Expand Down
2 changes: 1 addition & 1 deletion tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from nd2._parse._chunk_decode import ND2_FILE_SIGNATURE

sys.path.append(str(Path(__file__).parent.parent / "scripts"))
from nd2_describe import get_nd2_stats # noqa: E402
from nd2_describe import get_nd2_stats

try:
import xarray as xr
Expand Down

0 comments on commit 4459d5b

Please sign in to comment.