Skip to content

Commit 78f22b9

Browse files
committed
Merge branch 'v3' of github.com:zarr-developers/zarr-python into add-array-storage-helpers
2 parents 45f27b1 + ee2a3c6 commit 78f22b9

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

.github/workflows/releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
with:
5656
name: releases
5757
path: dist
58-
- uses: pypa/[email protected].1
58+
- uses: pypa/[email protected].2
5959
with:
6060
user: __token__
6161
password: ${{ secrets.pypi_password }}

src/zarr/core/attributes.py

Lines changed: 3 additions & 0 deletions
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)

tests/v3/test_attributes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ def test_put() -> None:
1111
attrs.put({"a": 3, "c": 4})
1212
expected = {"a": 3, "c": 4}
1313
assert dict(attrs) == expected
14+
15+
16+
def test_asdict() -> None:
17+
store = zarr.store.MemoryStore({}, mode="w")
18+
attrs = zarr.core.attributes.Attributes(
19+
zarr.Group.from_store(store, attributes={"a": 1, "b": 2})
20+
)
21+
result = attrs.asdict()
22+
assert result == {"a": 1, "b": 2}

0 commit comments

Comments
 (0)