Skip to content

Commit c9c8181

Browse files
committed
remove old string logic
1 parent 528a942 commit c9c8181

File tree

5 files changed

+4
-131
lines changed

5 files changed

+4
-131
lines changed

src/zarr/codecs/vlen_utf8.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from zarr.abc.codec import ArrayBytesCodec
1111
from zarr.core.buffer import Buffer, NDBuffer
1212
from zarr.core.common import JSON, parse_named_configuration
13-
from zarr.core.strings import cast_to_string_dtype
1413
from zarr.registry import register_codec
1514

1615
if TYPE_CHECKING:
@@ -49,6 +48,7 @@ def to_dict(self) -> dict[str, JSON]:
4948
def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
5049
return self
5150

51+
# TODO: expand the tests for this function
5252
async def _decode_single(
5353
self,
5454
chunk_bytes: Buffer,
@@ -60,8 +60,7 @@ async def _decode_single(
6060
decoded = _vlen_utf8_codec.decode(raw_bytes)
6161
assert decoded.dtype == np.object_
6262
decoded.shape = chunk_spec.shape
63-
# coming out of the code, we know this is safe, so don't issue a warning
64-
as_string_dtype = cast_to_string_dtype(decoded, safe=True)
63+
as_string_dtype = decoded.astype(chunk_spec.dtype.to_dtype(), copy=False)
6564
return chunk_spec.prototype.nd_buffer.from_numpy_array(as_string_dtype)
6665

6766
async def _encode_single(

src/zarr/core/strings.py

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

tests/test_codecs/test_vlen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from zarr.abc.store import Store
1010
from zarr.codecs import ZstdCodec
1111
from zarr.core.dtype import get_data_type_from_native_dtype
12+
from zarr.core.dtype.npy.string import _NUMPY_SUPPORTS_VLEN_STRING
1213
from zarr.core.metadata.v3 import ArrayV3Metadata
13-
from zarr.core.strings import _NUMPY_SUPPORTS_VLEN_STRING
1414
from zarr.storage import StorePath
1515

1616
numpy_str_dtypes: list[type | str | None] = [None, str, "str", np.dtypes.StrDType, "S", "U"]

tests/test_metadata/test_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
from zarr.core.chunk_key_encodings import DefaultChunkKeyEncoding, V2ChunkKeyEncoding
1313
from zarr.core.config import config
1414
from zarr.core.dtype import get_data_type_from_native_dtype
15+
from zarr.core.dtype.npy.string import _NUMPY_SUPPORTS_VLEN_STRING
1516
from zarr.core.dtype.npy.time import DateTime64
1617
from zarr.core.group import GroupMetadata, parse_node_type
1718
from zarr.core.metadata.v3 import (
1819
ArrayV3Metadata,
1920
parse_dimension_names,
2021
parse_zarr_format,
2122
)
22-
from zarr.core.strings import _NUMPY_SUPPORTS_VLEN_STRING
2323
from zarr.errors import MetadataValidationError
2424

2525
if TYPE_CHECKING:

tests/test_strings.py

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

0 commit comments

Comments
 (0)