Skip to content

Commit 5866eaf

Browse files
authored
Merge branch 'v3' into C4
2 parents ddc14d6 + 1574e8b commit 5866eaf

26 files changed

+96
-98
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ contact_links:
33
- name: ✨ Propose a new major feature
44
url: https://github.com/zarr-developers/zarr-specs
55
about: A new major feature should be discussed in the Zarr specifications repository.
6-
- name: ❓ Discuss something on gitter
7-
url: https://gitter.im/zarr-developers/community
8-
about: For questions like "How do I do X with Zarr?", you can move to our Gitter channel.
6+
- name: ❓ Discuss something on ZulipChat
7+
url: https://ossci.zulipchat.com/
8+
about: For questions like "How do I do X with Zarr?", you can move to our ZulipChat.
99
- name: ❓ Discuss something on GitHub Discussions
1010
url: https://github.com/zarr-developers/zarr-python/discussions
1111
about: For questions like "How do I do X with Zarr?", you can move to GitHub Discussions.

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,22 @@ extend-select = [
213213
"I", # isort
214214
"ISC", # flake8-implicit-str-concat
215215
"PGH", # pygrep-hooks
216+
"PT", # flake8-pytest-style
216217
"PYI", # flake8-pyi
217218
"RSE", # flake8-raise
219+
"RET", # flake8-return
218220
"RUF",
219221
"TCH", # flake8-type-checking
220222
"TRY", # tryceratops
221223
"UP", # pyupgrade
222224
]
223225
ignore = [
226+
"PT004", # deprecated
227+
"PT011", # TODO: apply this rule
228+
"PT012", # TODO: apply this rule
224229
"PYI013",
230+
"RET505",
231+
"RET506",
225232
"RUF005",
226233
"TRY003",
227234
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules

src/zarr/abc/store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ async def _set_many(self, values: Iterable[tuple[str, Buffer]]) -> None:
170170
Insert multiple (key, value) pairs into storage.
171171
"""
172172
await gather(*(self.set(key, value) for key, value in values))
173-
return None
173+
return
174174

175175
@property
176176
@abstractmethod

src/zarr/core/array.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import numpy.typing as npt
1010

1111
from zarr._compat import _deprecate_positional_args
12-
from zarr.abc.codec import Codec, CodecPipeline
1312
from zarr.abc.store import set_or_delete
1413
from zarr.codecs import BytesCodec
1514
from zarr.codecs._v2 import V2Compressor, V2Filters

src/zarr/core/buffer/core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,9 @@ def all_equal(self, other: Any, equal_nan: bool = True) -> bool:
469469
return False
470470
# use array_equal to obtain equal_nan=True functionality
471471
data, other = np.broadcast_arrays(self._data, other)
472-
result = np.array_equal(
472+
return np.array_equal(
473473
self._data, other, equal_nan=equal_nan if self._data.dtype.kind not in "US" else False
474474
)
475-
return result
476475

477476
def fill(self, value: Any) -> None:
478477
self._data.fill(value)

src/zarr/store/memory.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
from collections.abc import AsyncGenerator, MutableMapping
43
from typing import TYPE_CHECKING
54

65
from zarr.abc.store import Store

src/zarr/testing/store.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ def get(self, store: S, key: str) -> Buffer:
3737

3838
raise NotImplementedError
3939

40-
@pytest.fixture(scope="function")
40+
@pytest.fixture
4141
def store_kwargs(self) -> dict[str, Any]:
4242
return {"mode": "r+"}
4343

44-
@pytest.fixture(scope="function")
44+
@pytest.fixture
4545
async def store(self, store_kwargs: dict[str, Any]) -> Store:
4646
return await self.store_cls.open(**store_kwargs)
4747

@@ -97,7 +97,7 @@ def test_store_supports_listing(self, store: S) -> None:
9797

9898
@pytest.mark.parametrize("key", ["c/0", "foo/c/0.0", "foo/0/0"])
9999
@pytest.mark.parametrize("data", [b"\x01\x02\x03\x04", b""])
100-
@pytest.mark.parametrize("byte_range", (None, (0, None), (1, None), (1, 2), (None, 1)))
100+
@pytest.mark.parametrize("byte_range", [None, (0, None), (1, None), (1, 2), (None, 1)])
101101
async def test_get(
102102
self, store: S, key: str, data: bytes, byte_range: None | tuple[int | None, int | None]
103103
) -> None:
@@ -137,12 +137,12 @@ async def test_set_many(self, store: S) -> None:
137137

138138
@pytest.mark.parametrize(
139139
"key_ranges",
140-
(
140+
[
141141
[],
142142
[("zarr.json", (0, 1))],
143143
[("c/0", (0, 1)), ("zarr.json", (0, None))],
144144
[("c/0/0", (0, 1)), ("c/0/1", (None, 2)), ("c/0/2", (0, 3))],
145-
),
145+
],
146146
)
147147
async def test_get_partial_values(
148148
self, store: S, key_ranges: list[tuple[str, tuple[int | None, int | None]]]

tests/v3/conftest.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,31 +46,30 @@ def path_type(request: pytest.FixtureRequest) -> Any:
4646
@pytest.fixture
4747
async def store_path(tmpdir: LEGACY_PATH) -> StorePath:
4848
store = await LocalStore.open(str(tmpdir), mode="w")
49-
p = StorePath(store)
50-
return p
49+
return StorePath(store)
5150

5251

53-
@pytest.fixture(scope="function")
52+
@pytest.fixture
5453
async def local_store(tmpdir: LEGACY_PATH) -> LocalStore:
5554
return await LocalStore.open(str(tmpdir), mode="w")
5655

5756

58-
@pytest.fixture(scope="function")
57+
@pytest.fixture
5958
async def remote_store(url: str) -> RemoteStore:
6059
return await RemoteStore.open(url, mode="w")
6160

6261

63-
@pytest.fixture(scope="function")
62+
@pytest.fixture
6463
async def memory_store() -> MemoryStore:
6564
return await MemoryStore.open(mode="w")
6665

6766

68-
@pytest.fixture(scope="function")
67+
@pytest.fixture
6968
async def zip_store(tmpdir: LEGACY_PATH) -> ZipStore:
7069
return await ZipStore.open(str(tmpdir / "zarr.zip"), mode="w")
7170

7271

73-
@pytest.fixture(scope="function")
72+
@pytest.fixture
7473
async def store(request: pytest.FixtureRequest, tmpdir: LEGACY_PATH) -> Store:
7574
param = request.param
7675
return await parse_store(param, str(tmpdir))
@@ -83,18 +82,17 @@ class AsyncGroupRequest:
8382
attributes: dict[str, Any] = field(default_factory=dict)
8483

8584

86-
@pytest.fixture(scope="function")
85+
@pytest.fixture
8786
async def async_group(request: pytest.FixtureRequest, tmpdir: LEGACY_PATH) -> AsyncGroup:
8887
param: AsyncGroupRequest = request.param
8988

9089
store = await parse_store(param.store, str(tmpdir))
91-
agroup = await AsyncGroup.from_store(
90+
return await AsyncGroup.from_store(
9291
store,
9392
attributes=param.attributes,
9493
zarr_format=param.zarr_format,
9594
exists_ok=False,
9695
)
97-
return agroup
9896

9997

10098
@pytest.fixture(params=["numpy", "cupy"])

tests/v3/test_array.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from zarr.store.common import StorePath
1313

1414

15-
@pytest.mark.parametrize("store", ("local", "memory", "zip"), indirect=["store"])
16-
@pytest.mark.parametrize("zarr_format", (2, 3))
15+
@pytest.mark.parametrize("store", ["local", "memory", "zip"], indirect=["store"])
16+
@pytest.mark.parametrize("zarr_format", [2, 3])
1717
@pytest.mark.parametrize("exists_ok", [True, False])
1818
@pytest.mark.parametrize("extant_node", ["array", "group"])
1919
def test_array_creation_existing_node(
@@ -61,8 +61,8 @@ def test_array_creation_existing_node(
6161
)
6262

6363

64-
@pytest.mark.parametrize("store", ("local", "memory", "zip"), indirect=["store"])
65-
@pytest.mark.parametrize("zarr_format", (2, 3))
64+
@pytest.mark.parametrize("store", ["local", "memory", "zip"], indirect=["store"])
65+
@pytest.mark.parametrize("zarr_format", [2, 3])
6666
def test_array_name_properties_no_group(
6767
store: LocalStore | MemoryStore, zarr_format: ZarrFormat
6868
) -> None:
@@ -72,8 +72,8 @@ def test_array_name_properties_no_group(
7272
assert arr.basename is None
7373

7474

75-
@pytest.mark.parametrize("store", ("local", "memory", "zip"), indirect=["store"])
76-
@pytest.mark.parametrize("zarr_format", (2, 3))
75+
@pytest.mark.parametrize("store", ["local", "memory", "zip"], indirect=["store"])
76+
@pytest.mark.parametrize("zarr_format", [2, 3])
7777
def test_array_name_properties_with_group(
7878
store: LocalStore | MemoryStore, zarr_format: ZarrFormat
7979
) -> None:
@@ -123,7 +123,7 @@ def test_array_v3_fill_value_default(
123123

124124
@pytest.mark.parametrize("store", ["memory"], indirect=True)
125125
@pytest.mark.parametrize(
126-
"dtype_str,fill_value",
126+
("dtype_str", "fill_value"),
127127
[("bool", True), ("uint8", 99), ("float32", -99.9), ("complex64", 3 + 4j)],
128128
)
129129
def test_array_v3_fill_value(store: MemoryStore, fill_value: int, dtype_str: str) -> None:
@@ -201,8 +201,8 @@ async def test_array_v3_nan_fill_value(store: MemoryStore) -> None:
201201
assert len([a async for a in store.list_prefix("/")]) == 0
202202

203203

204-
@pytest.mark.parametrize("store", ("local",), indirect=["store"])
205-
@pytest.mark.parametrize("zarr_format", (2, 3))
204+
@pytest.mark.parametrize("store", ["local"], indirect=["store"])
205+
@pytest.mark.parametrize("zarr_format", [2, 3])
206206
async def test_serializable_async_array(
207207
store: LocalStore | MemoryStore, zarr_format: ZarrFormat
208208
) -> None:
@@ -219,8 +219,8 @@ async def test_serializable_async_array(
219219
# TODO: uncomment the parts of this test that will be impacted by the config/prototype changes in flight
220220

221221

222-
@pytest.mark.parametrize("store", ("local",), indirect=["store"])
223-
@pytest.mark.parametrize("zarr_format", (2, 3))
222+
@pytest.mark.parametrize("store", ["local"], indirect=["store"])
223+
@pytest.mark.parametrize("zarr_format", [2, 3])
224224
def test_serializable_sync_array(store: LocalStore, zarr_format: ZarrFormat) -> None:
225225
expected = Array.create(
226226
store=store, shape=(100,), chunks=(10,), zarr_format=zarr_format, dtype="i4"

tests/v3/test_chunk_grids.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66

77
@pytest.mark.parametrize(
8-
"shape", ((0,), (0,) * 2, (1, 2, 0, 4, 5), (10, 0), (10,), (100,) * 3, (1000000,), (10000,) * 2)
8+
"shape", [(0,), (0,) * 2, (1, 2, 0, 4, 5), (10, 0), (10,), (100,) * 3, (1000000,), (10000,) * 2]
99
)
10-
@pytest.mark.parametrize("itemsize", (1, 2, 4))
10+
@pytest.mark.parametrize("itemsize", [1, 2, 4])
1111
def test_guess_chunks(shape: tuple[int, ...], itemsize: int) -> None:
1212
chunks = _guess_chunks(shape, itemsize)
1313
chunk_size = np.prod(chunks) * itemsize

0 commit comments

Comments
 (0)