Skip to content

Commit 0ddb049

Browse files
committed
Correct pre-commit issues
1 parent 6f56881 commit 0ddb049

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

src/zarr/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def parse_bool(data: Any) -> bool:
170170
def parse_dtype(dtype: Any, zarr_format: ZarrFormat) -> np.dtype[Any]:
171171
if "datatype" in type(dtype).__name__.lower():
172172
# Workaround until we have the class in place
173-
return dtype.to_numpy() # TODO: call conversion method
173+
return np.dtype(dtype.to_numpy()) # TODO: call conversion method
174174
if dtype is str or dtype == "str":
175175
if zarr_format == 2:
176176
# special case as object

src/zarr/core/metadata/v3.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,6 @@ def to_numpy_shortname(self) -> str:
663663
}
664664
return data_type_to_numpy[self]
665665

666-
667666
def to_numpy(self) -> np.dtypes.StringDType | np.dtypes.ObjectDType | np.dtype[Any]:
668667
# note: it is not possible to round trip DataType <-> np.dtype
669668
# due to the fact that DataType.string and DataType.bytes both

src/zarr/registry.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
)
2020
from zarr.core.buffer import Buffer, NDBuffer
2121
from zarr.core.common import JSON
22+
from zarr.core.metadata.v3 import DataType
2223

2324
__all__ = [
2425
"Registry",

tests/test_array.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,8 +1447,7 @@ async def test_sharding_coordinate_selection() -> None:
14471447

14481448

14491449
@pytest.mark.xfail(reason="zarr.common.core maps any string to the string type")
1450-
async def test_array_v3_ext_uri_by_string(
1451-
) -> None:
1450+
async def test_array_v3_ext_uri_by_string() -> None:
14521451
"""
14531452
Test the user impact of the extension mechanism
14541453
"""
@@ -1460,11 +1459,10 @@ async def test_array_v3_ext_uri_by_string(
14601459
shape=(12,),
14611460
chunks=(3,),
14621461
)
1463-
assert arr.data_type == None # TODO: import the example dtype
1462+
assert arr.dtype == np.dtype(bool)
14641463

14651464

1466-
async def test_array_v3_ext_uri_by_class(
1467-
) -> None:
1465+
async def test_array_v3_ext_uri_by_class() -> None:
14681466
"""
14691467
Test the user impact of the extension mechanism
14701468
"""

tests/test_metadata/test_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ def test_dtypes(dtype_str: str) -> None:
412412
# return type for vlen types may vary depending on numpy version
413413
assert dt.byte_count is None
414414

415+
415416
async def test_ext_uri() -> None:
416417
metadata_dict = {
417418
"zarr_format": 3,
@@ -424,5 +425,4 @@ async def test_ext_uri() -> None:
424425
"fill_value": 0,
425426
}
426427
m = ArrayV3Metadata.from_dict(metadata_dict)
427-
d = json.loads(m.to_buffer_dict(default_buffer_prototype())["zarr.json"].to_bytes())
428428
assert m.data_type is DataType.example

0 commit comments

Comments
 (0)