Skip to content

Commit 211eef7

Browse files
committed
docs(dtype): correct Bytes inheritance and scalar serialization claims
Assisted-by: Codex:GPT-6
1 parent d6bb68f commit 211eef7

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,8 @@ class Bytes(ZDType[np.dtypes.ObjectDType, bytes], HasObjectCodec):
13271327
13281328
Wraps the NumPy "object" data type. Scalars for this data type are instances of ``bytes``.
13291329
1330-
This data type inherits from `VariableLengthBytes` for backwards compatibility.
1330+
This data type accepts the legacy ``variable_length_bytes`` name when reading
1331+
Zarr V3 metadata. It is a separate class from `VariableLengthBytes`.
13311332
13321333
Attributes
13331334
----------
@@ -1369,13 +1370,13 @@ def from_native_dtype(cls, dtype: TBaseDType) -> Self:
13691370
13701371
Returns
13711372
-------
1372-
VariableLengthBytes
1373-
An instance of VariableLengthBytes.
1373+
Bytes
1374+
An instance of Bytes.
13741375
13751376
Raises
13761377
------
13771378
DataTypeValidationError
1378-
If the dtype is not compatible with VariableLengthBytes.
1379+
If the dtype is not compatible with Bytes.
13791380
"""
13801381
if cls._check_native_dtype(dtype):
13811382
return cls()
@@ -1385,7 +1386,7 @@ def from_native_dtype(cls, dtype: TBaseDType) -> Self:
13851386

13861387
def to_native_dtype(self) -> np.dtypes.ObjectDType:
13871388
"""
1388-
Create a NumPy object dtype from this VariableLengthBytes ZDType.
1389+
Create a NumPy object dtype from this Bytes ZDType.
13891390
13901391
Returns
13911392
-------
@@ -1549,7 +1550,7 @@ def default_scalar(self) -> bytes:
15491550

15501551
def to_json_scalar(self, data: object, *, zarr_format: ZarrFormat) -> str:
15511552
"""
1552-
Convert a scalar to a JSON-serializable tuple of integers.
1553+
Convert a scalar to a JSON-serializable base64-encoded string.
15531554
15541555
This method encodes the given scalar as bytes and then
15551556
encodes the bytes as a base64-encoded string.

0 commit comments

Comments
 (0)