Skip to content

Commit 80a83a1

Browse files
committed
Merge branch 'v3' into generalize-stateful-store
* v3: remove outdated v2 source code and tests from v3 branch (zarr-developers#2182) Fix/empty listdir (zarr-developers#2225) Bump pypa/gh-action-pypi-publish in the actions group (zarr-developers#2219) Added Attributes.asdict (zarr-developers#2221)
2 parents ae42bff + 30e2bc3 commit 80a83a1

File tree

578 files changed

+28
-29206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

578 files changed

+28
-29206
lines changed

.github/workflows/releases.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
with:
5656
name: releases
5757
path: dist
58-
- uses: pypa/gh-action-pypi-publish@v1.10.1
58+
- uses: pypa/gh-action-pypi-publish@v1.10.2
5959
with:
6060
user: __token__
6161
password: ${{ secrets.pypi_password }}

src/zarr/core/array_spec.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from dataclasses import dataclass
44
from typing import TYPE_CHECKING, Any, Literal
55

6+
import numpy as np
7+
68
from zarr.core.common import parse_fill_value, parse_order, parse_shapelike
79

810
if TYPE_CHECKING:
9-
import numpy as np
10-
1111
from zarr.core.buffer import BufferPrototype
1212
from zarr.core.common import ChunkCoords
1313

@@ -29,11 +29,12 @@ def __init__(
2929
prototype: BufferPrototype,
3030
) -> None:
3131
shape_parsed = parse_shapelike(shape)
32+
dtype_parsed = np.dtype(dtype)
3233
fill_value_parsed = parse_fill_value(fill_value)
3334
order_parsed = parse_order(order)
3435

3536
object.__setattr__(self, "shape", shape_parsed)
36-
object.__setattr__(self, "dtype", dtype)
37+
object.__setattr__(self, "dtype", dtype_parsed)
3738
object.__setattr__(self, "fill_value", fill_value_parsed)
3839
object.__setattr__(self, "order", order_parsed)
3940
object.__setattr__(self, "prototype", prototype)

src/zarr/core/attributes.py

+3
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ def put(self, d: dict[str, JSON]) -> None:
5151
{'a': 3, 'c': 4}
5252
"""
5353
self._obj = self._obj.update_attributes(d)
54+
55+
def asdict(self) -> dict[str, JSON]:
56+
return dict(self._obj.metadata.attributes)

src/zarr/store/local.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,15 @@ async def clear(self) -> None:
9393

9494
async def empty(self) -> bool:
9595
try:
96-
subpaths = os.listdir(self.root)
96+
with os.scandir(self.root) as it:
97+
for entry in it:
98+
if entry.is_file():
99+
# stop once a file is found
100+
return False
97101
except FileNotFoundError:
98102
return True
99103
else:
100-
return not subpaths
104+
return True
101105

102106
def __str__(self) -> str:
103107
return f"file://{self.root}"

src/zarr/v2/__init__.py

-54
This file was deleted.

src/zarr/v2/_storage/__init__.py

Whitespace-only changes.

src/zarr/v2/_storage/absstore.py

-224
This file was deleted.

0 commit comments

Comments
 (0)