Skip to content

Commit eb93c24

Browse files
committed
Merge branch 'main' of github.com:zarr-developers/zarr-python into feat/store-paths
2 parents e68a341 + 329612e commit eb93c24

File tree

20 files changed

+191
-235
lines changed

20 files changed

+191
-235
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

pyproject.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ extend-select = [
214214
"B", # flake8-bugbear
215215
"C4", # flake8-comprehensions
216216
"FLY", # flynt
217+
"FURB", # refurb
217218
"G", # flake8-logging-format
218219
"I", # isort
219220
"ISC", # flake8-implicit-str-concat
@@ -329,4 +330,15 @@ ignore = [
329330

330331
[tool.numpydoc_validation]
331332
# See https://numpydoc.readthedocs.io/en/latest/validation.html#built-in-validation-checks for list of checks
332-
checks = ["GL06", "GL07", "GL10", "PR03", "PR05", "PR06"]
333+
checks = [
334+
"GL06",
335+
"GL07",
336+
"GL09",
337+
"GL10",
338+
"SS02",
339+
"SS04",
340+
"PR02",
341+
"PR03",
342+
"PR05",
343+
"PR06",
344+
]

src/zarr/abc/codec.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
8585
8686
Parameters
8787
----------
88-
chunk_spec : ArraySpec
88+
array_spec : ArraySpec
8989
9090
Returns
9191
-------
@@ -99,11 +99,11 @@ def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: Chun
9999
100100
Parameters
101101
----------
102-
shape: ChunkCoords
102+
shape : ChunkCoords
103103
The array shape
104-
dtype: np.dtype[Any]
104+
dtype : np.dtype[Any]
105105
The array data type
106-
chunk_grid: ChunkGrid
106+
chunk_grid : ChunkGrid
107107
The array chunk grid
108108
"""
109109
...
@@ -292,11 +292,11 @@ def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: Chun
292292
293293
Parameters
294294
----------
295-
shape: ChunkCoords
295+
shape : ChunkCoords
296296
The array shape
297-
dtype: np.dtype[Any]
297+
dtype : np.dtype[Any]
298298
The array data type
299-
chunk_grid: ChunkGrid
299+
chunk_grid : ChunkGrid
300300
The array chunk grid
301301
"""
302302
...
@@ -308,7 +308,7 @@ def compute_encoded_size(self, byte_length: int, array_spec: ArraySpec) -> int:
308308
309309
Parameters
310310
----------
311-
input_byte_length : int
311+
byte_length : int
312312
array_spec : ArraySpec
313313
314314
Returns
@@ -327,7 +327,7 @@ async def decode(
327327
328328
Parameters
329329
----------
330-
chunks_and_specs : Iterable[tuple[Buffer | None, ArraySpec]]
330+
chunk_bytes_and_specs : Iterable[tuple[Buffer | None, ArraySpec]]
331331
Ordered set of encoded chunks with their accompanying chunk spec.
332332
333333
Returns
@@ -346,7 +346,7 @@ async def encode(
346346
347347
Parameters
348348
----------
349-
chunks_and_specs : Iterable[tuple[NDBuffer | None, ArraySpec]]
349+
chunk_arrays_and_specs : Iterable[tuple[NDBuffer | None, ArraySpec]]
350350
Ordered set of to-be-encoded chunks with their accompanying chunk spec.
351351
352352
Returns

src/zarr/abc/store.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from abc import ABC, abstractmethod
44
from asyncio import gather
5+
from itertools import starmap
56
from typing import TYPE_CHECKING, NamedTuple, Protocol, runtime_checkable
67

78
if TYPE_CHECKING:
@@ -178,7 +179,7 @@ def with_mode(self, mode: AccessModeLiteral) -> Self:
178179
179180
Parameters
180181
----------
181-
mode: AccessModeLiteral
182+
mode : AccessModeLiteral
182183
The new mode to use.
183184
184185
Returns
@@ -298,7 +299,7 @@ async def _set_many(self, values: Iterable[tuple[str, Buffer]]) -> None:
298299
"""
299300
Insert multiple (key, value) pairs into storage.
300301
"""
301-
await gather(*(self.set(key, value) for key, value in values))
302+
await gather(*starmap(self.set, values))
302303
return
303304

304305
@property

src/zarr/api/asynchronous.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969

7070
def _get_shape_chunks(a: ArrayLike | Any) -> tuple[ChunkCoords | None, ChunkCoords | None]:
71-
"""helper function to get the shape and chunks from an array-like object"""
71+
"""Helper function to get the shape and chunks from an array-like object"""
7272
shape = None
7373
chunks = None
7474

@@ -86,7 +86,7 @@ def _get_shape_chunks(a: ArrayLike | Any) -> tuple[ChunkCoords | None, ChunkCoor
8686

8787

8888
def _like_args(a: ArrayLike, kwargs: dict[str, Any]) -> dict[str, Any]:
89-
"""set default values for shape and chunks if they are not present in the array-like object"""
89+
"""Set default values for shape and chunks if they are not present in the array-like object"""
9090

9191
new = kwargs.copy()
9292

@@ -121,7 +121,7 @@ def _like_args(a: ArrayLike, kwargs: dict[str, Any]) -> dict[str, Any]:
121121
def _handle_zarr_version_or_format(
122122
*, zarr_version: ZarrFormat | None, zarr_format: ZarrFormat | None
123123
) -> ZarrFormat | None:
124-
"""handle the deprecated zarr_version kwarg and return zarr_format"""
124+
"""Handle the deprecated zarr_version kwarg and return zarr_format"""
125125
if zarr_format is not None and zarr_version is not None and zarr_format != zarr_version:
126126
raise ValueError(
127127
f"zarr_format {zarr_format} does not match zarr_version {zarr_version}, please only set one"
@@ -135,7 +135,7 @@ def _handle_zarr_version_or_format(
135135

136136

137137
def _default_zarr_version() -> ZarrFormat:
138-
"""return the default zarr_version"""
138+
"""Return the default zarr_version"""
139139
return cast(ZarrFormat, int(config.get("default_zarr_version", 3)))
140140

141141

@@ -152,9 +152,9 @@ async def consolidate_metadata(
152152
153153
Parameters
154154
----------
155-
store: StoreLike
155+
store : StoreLike
156156
The store-like object whose metadata you wish to consolidate.
157-
path: str, optional
157+
path : str, optional
158158
A path to a group in the store to consolidate at. Only children
159159
below that group will be consolidated.
160160
@@ -341,13 +341,13 @@ async def save(
341341
----------
342342
store : Store or str
343343
Store or path to directory in file system or name of zip file.
344-
args : ndarray
344+
*args : ndarray
345345
NumPy arrays with data to save.
346346
zarr_format : {2, 3, None}, optional
347347
The zarr format to use when saving.
348348
path : str or None, optional
349349
The path within the group where the arrays will be saved.
350-
kwargs
350+
**kwargs
351351
NumPy arrays with data to save.
352352
"""
353353
zarr_format = _handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format)
@@ -386,7 +386,7 @@ async def save_array(
386386
storage_options : dict
387387
If using an fsspec URL to create the store, these will be passed to
388388
the backend implementation. Ignored otherwise.
389-
kwargs
389+
**kwargs
390390
Passed through to :func:`create`, e.g., compressor.
391391
"""
392392
zarr_format = (
@@ -423,7 +423,7 @@ async def save_group(
423423
----------
424424
store : Store or str
425425
Store or path to directory in file system or name of zip file.
426-
args : ndarray
426+
*args : ndarray
427427
NumPy arrays with data to save.
428428
zarr_format : {2, 3, None}, optional
429429
The zarr format to use when saving.
@@ -432,7 +432,7 @@ async def save_group(
432432
storage_options : dict
433433
If using an fsspec URL to create the store, these will be passed to
434434
the backend implementation. Ignored otherwise.
435-
kwargs
435+
**kwargs
436436
NumPy arrays with data to save.
437437
"""
438438
zarr_format = (
@@ -479,7 +479,7 @@ async def array(
479479
----------
480480
data : array_like
481481
The data to fill the array with.
482-
kwargs
482+
**kwargs
483483
Passed through to :func:`create`.
484484
485485
Returns

0 commit comments

Comments
 (0)