Skip to content

Commit 3463b02

Browse files
committed
change the v3 name of variablelengthstring to string
1 parent 67c0392 commit 3463b02

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/zarr/core/dtype/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def parse_data_type(
166166
if dtype_spec in VLEN_UTF8_ALIAS:
167167
# If the dtype request is one of the aliases for variable-length UTF-8 strings,
168168
# return that dtype.
169-
return VariableLengthUTF8()
169+
return VariableLengthUTF8() # type: ignore[return-value]
170170
# otherwise, we have either a numpy dtype string, or a zarr v3 dtype string, and in either case
171171
# we can create a numpy dtype from it, and do the dtype inference from that
172172
return get_data_type_from_native_dtype(dtype_spec) # type: ignore[arg-type]

src/zarr/core/dtype/npy/string.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class UTF8Base(ZDType[TDType_co, str], HasObjectCodec):
203203
as data type, but as a base class for other variable length string data types.
204204
"""
205205

206-
_zarr_v3_name: ClassVar[Literal["variable_length_utf8"]] = "variable_length_utf8"
206+
_zarr_v3_name: ClassVar[Literal["string"]] = "string"
207207
object_codec_id: ClassVar[Literal["vlen-utf8"]] = "vlen-utf8"
208208

209209
@classmethod
@@ -230,7 +230,7 @@ def _check_json_v2(
230230
)
231231

232232
@classmethod
233-
def _check_json_v3(cls, data: DTypeJSON) -> TypeGuard[Literal["variable_length_utf8"]]:
233+
def _check_json_v3(cls, data: DTypeJSON) -> TypeGuard[Literal["string"]]:
234234
return data == cls._zarr_v3_name
235235

236236
@classmethod
@@ -254,15 +254,14 @@ def to_json(
254254
self, zarr_format: Literal[2]
255255
) -> DTypeConfig_V2[Literal["|O"], Literal["vlen-utf8"]]: ...
256256
@overload
257-
def to_json(self, zarr_format: Literal[3]) -> Literal["variable_length_utf8"]: ...
257+
def to_json(self, zarr_format: Literal[3]) -> Literal["string"]: ...
258258

259259
def to_json(
260260
self, zarr_format: ZarrFormat
261-
) -> DTypeConfig_V2[Literal["|O"], Literal["vlen-utf8"]] | Literal["variable_length_utf8"]:
261+
) -> DTypeConfig_V2[Literal["|O"], Literal["vlen-utf8"]] | Literal["string"]:
262262
if zarr_format == 2:
263263
return {"name": "|O", "object_codec_id": self.object_codec_id}
264264
elif zarr_format == 3:
265-
v3_unstable_dtype_warning(self)
266265
return self._zarr_v3_name
267266
raise ValueError(f"zarr_format must be 2 or 3, got {zarr_format}") # pragma: no cover
268267

0 commit comments

Comments
 (0)