Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ default_language_version:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
rev: v0.16.1
hooks:
- id: ruff-check
args: ["--fix", "--show-fixes"]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
rev: v2.4.3
hooks:
- id: codespell
args: ["-L", "fo,ihs,kake,te", "-S", "fixture"]
Expand All @@ -32,7 +32,7 @@ repos:
exclude: mkdocs.yml
- id: trailing-whitespace
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.22.1
rev: v0.23.2
hooks:
# Markdown structure/hygiene. Rule selection and ignores are in
# .markdownlint-cli2.jsonc; complements ci/lint_docs.py (RST residue,
Expand Down Expand Up @@ -68,7 +68,7 @@ repos:
types: [python]
files: ^(src|tests)/
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.26.1
rev: v1.29.0
hooks:
- id: zizmor
- repo: https://github.com/twisted/towncrier
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/api/synchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ def from_array(
write_data: bool = True,
name: str | None = None,
chunks: ChunksLike | Literal["auto", "keep"] = "keep",
shards: ShardsLike | None | Literal["keep"] = "keep",
shards: ShardsLike | Literal["keep"] | None = "keep",
filters: FiltersLike | Literal["keep"] = "keep",
compressors: CompressorsLike | Literal["keep"] = "keep",
serializer: SerializerLike | Literal["keep"] = "keep",
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/codecs/sharding.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ def _encode_partial_sync(
# `_sentinel` distinguishes "not computed yet" from a memoized `None`
# (an empty chunk).
_sentinel = object()
scalar_complete_result: Buffer | None | object = _sentinel
scalar_complete_result: Buffer | object | None = _sentinel

for chunk_coords, chunk_sel, out_sel, is_complete_chunk in indexer:
if is_scalar and is_complete_chunk:
Expand Down
6 changes: 3 additions & 3 deletions src/zarr/core/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2181,7 +2181,7 @@ def filters(self) -> tuple[Numcodec, ...] | tuple[ArrayArrayCodec, ...]:
return self.async_array.filters

@property
def serializer(self) -> None | ArrayBytesCodec:
def serializer(self) -> ArrayBytesCodec | None:
"""
Array-to-bytes codec to use for serializing the chunks into bytes.
"""
Expand Down Expand Up @@ -4072,7 +4072,7 @@ async def from_array(
write_data: bool = True,
name: str | None = None,
chunks: ChunksLike | Literal["auto", "keep"] = "keep",
shards: ShardsLike | None | Literal["keep"] = "keep",
shards: ShardsLike | Literal["keep"] | None = "keep",
filters: FiltersLike | Literal["keep"] = "keep",
compressors: CompressorsLike | Literal["keep"] = "keep",
serializer: SerializerLike | Literal["keep"] = "keep",
Expand Down Expand Up @@ -4763,7 +4763,7 @@ async def create_array(
def _parse_keep_array_attr(
data: AnyArray | npt.ArrayLike,
chunks: ChunksLike | Literal["auto", "keep"],
shards: ShardsLike | None | Literal["keep"],
shards: ShardsLike | Literal["keep"] | None,
filters: FiltersLike | Literal["keep"],
compressors: CompressorsLike | Literal["keep"],
serializer: SerializerLike | Literal["keep"],
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/testing/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def arrays(
if arrays is None:
arrays = numpy_arrays(shapes=shapes)
nparray = draw(arrays, label="array data")
dim_names: None | list[str | None] = None
dim_names: list[str | None] | None = None
serializer: SerializerLike = "auto"
compressors_unsearched: CompressorsLike = "auto"

Expand Down Expand Up @@ -328,7 +328,7 @@ def arrays(
else:
chunks_param = draw(chunk_shapes(shape=nparray.shape), label="chunk shape")

if all(s > c and c > 1 for s, c in zip(nparray.shape, chunks_param, strict=True)):
if all(s > c > 1 for s, c in zip(nparray.shape, chunks_param, strict=True)):
shard_shape = draw(
st.none() | shard_shapes(shape=nparray.shape, chunk_shape=chunks_param),
label="shard shape",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ async def test_open_group_unspecified_version(tmp_path: Path, zarr_format: ZarrF
@pytest.mark.parametrize("n_args", [10, 1, 0])
@pytest.mark.parametrize("n_kwargs", [10, 1, 0])
@pytest.mark.parametrize("path", [None, "some_path"])
def test_save(store: Store, n_args: int, n_kwargs: int, path: None | str) -> None:
def test_save(store: Store, n_args: int, n_kwargs: int, path: str | None) -> None:
data = np.arange(10)
args = [np.arange(10) for _ in range(n_args)]
kwargs = {f"arg_{i}": data for i in range(n_kwargs)}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_codecs/test_blosc.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_tunable_attrs_param(
# contaminating the BloscCodec construction below with that warning.
if shuffle == "legacy-enum":
with pytest.warns(DeprecationWarning, match="BloscShuffle.shuffle"):
shuffle_arg: None | BloscShuffleLiteral | str = BloscShuffle.shuffle
shuffle_arg: BloscShuffleLiteral | str | None = BloscShuffle.shuffle
else:
shuffle_arg = shuffle

Expand Down
2 changes: 1 addition & 1 deletion tests/test_dtype_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def test_entrypoint_dtype(zarr_format: ZarrFormat) -> None:
)
def test_parse_data_type(
data_type: ZDType[Any, Any],
json_style: tuple[ZarrFormat, None | Literal["internal", "metadata"]],
json_style: tuple[ZarrFormat, Literal["internal", "metadata"] | None],
dtype_parser_func: Any,
) -> None:
"""
Expand Down
1 change: 0 additions & 1 deletion tests/test_store/test_object.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# ruff: noqa: E402
import re
from pathlib import Path
from typing import TypedDict
Expand Down
4 changes: 2 additions & 2 deletions tests/test_unified_chunk_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2784,8 +2784,8 @@ def test_rectilinear_roundtrip(json_input: RectilinearChunkGridMetadataJSON) ->

pytest.importorskip("hypothesis")

import hypothesis.strategies as st # noqa: E402
from hypothesis import event, given, settings # noqa: E402
import hypothesis.strategies as st
from hypothesis import event, given, settings


@st.composite
Expand Down
Loading