@@ -1175,8 +1175,9 @@ A fixed-length unicode dtype is also available, e.g.::
1175
1175
For variable-length strings, the ``object `` dtype can be used, but a codec must be
1176
1176
provided to encode the data (see also :ref: `tutorial_objects ` below). At the time of
1177
1177
writing there are four codecs available that can encode variable length string
1178
- objects: :class: `numcodecs.VLenUTF8 `, :class: `numcodecs.JSON `, :class: `numcodecs.MsgPack `.
1179
- and :class: `numcodecs.Pickle `. E.g. using ``VLenUTF8 ``::
1178
+ objects: :class: `numcodecs.vlen.VLenUTF8 `, :class: `numcodecs.json.JSON `,
1179
+ :class: `numcodecs.msgpacks.MsgPack `. and :class: `numcodecs.pickles.Pickle `.
1180
+ E.g. using ``VLenUTF8 ``::
1180
1181
1181
1182
>>> import numcodecs
1182
1183
>>> z = zarr.array(text_data, dtype=object, object_codec=numcodecs.VLenUTF8())
@@ -1201,8 +1202,8 @@ is a short-hand for ``dtype=object, object_codec=numcodecs.VLenUTF8()``, e.g.::
1201
1202
'Helló, világ!', 'Zdravo svete!', 'เฮลโลเวิลด์'], dtype=object)
1202
1203
1203
1204
Variable-length byte strings are also supported via ``dtype=object ``. Again an
1204
- ``object_codec `` is required, which can be one of :class: `numcodecs.VLenBytes ` or
1205
- :class: `numcodecs.Pickle `. For convenience, ``dtype=bytes `` (or ``dtype=str `` on Python
1205
+ ``object_codec `` is required, which can be one of :class: `numcodecs.vlen. VLenBytes ` or
1206
+ :class: `numcodecs.pickles. Pickle `. For convenience, ``dtype=bytes `` (or ``dtype=str `` on Python
1206
1207
2.7) can be used as a short-hand for ``dtype=object, object_codec=numcodecs.VLenBytes() ``,
1207
1208
e.g.::
1208
1209
@@ -1218,7 +1219,7 @@ e.g.::
1218
1219
b'\xe0\xb9\x80\xe0\xb8\xae\xe0\xb8\xa5\xe0\xb9\x82\xe0\xb8\xa5\xe0\xb9\x80\xe0\xb8\xa7\xe0\xb8\xb4\xe0\xb8\xa5\xe0\xb8\x94\xe0\xb9\x8c'], dtype=object)
1219
1220
1220
1221
If you know ahead of time all the possible string values that can occur, you could
1221
- also use the :class: `numcodecs.Categorize ` codec to encode each unique string value as an
1222
+ also use the :class: `numcodecs.categorize. Categorize ` codec to encode each unique string value as an
1222
1223
integer. E.g.::
1223
1224
1224
1225
>>> categorize = numcodecs.Categorize(greetings, dtype=object)
@@ -1245,7 +1246,7 @@ The best codec to use will depend on what type of objects are present in the arr
1245
1246
1246
1247
At the time of writing there are three codecs available that can serve as a general
1247
1248
purpose object codec and support encoding of a mixture of object types:
1248
- :class: `numcodecs.JSON `, :class: `numcodecs.MsgPack `. and :class: `numcodecs.Pickle `.
1249
+ :class: `numcodecs.json. JSON `, :class: `numcodecs.msgpacks. MsgPack `. and :class: `numcodecs.pickles .Pickle `.
1249
1250
1250
1251
For example, using the JSON codec::
1251
1252
@@ -1258,7 +1259,7 @@ For example, using the JSON codec::
1258
1259
array([42, 'foo', list(['bar', 'baz', 'qux']), {'a': 1, 'b': 2.2}, None], dtype=object)
1259
1260
1260
1261
Not all codecs support encoding of all object types. The
1261
- :class: `numcodecs.Pickle ` codec is the most flexible, supporting encoding any type
1262
+ :class: `numcodecs.pickles. Pickle ` codec is the most flexible, supporting encoding any type
1262
1263
of Python object. However, if you are sharing data with anyone other than yourself, then
1263
1264
Pickle is not recommended as it is a potential security risk. This is because malicious
1264
1265
code can be embedded within pickled data. The JSON and MsgPack codecs do not have any
@@ -1270,7 +1271,7 @@ Ragged arrays
1270
1271
1271
1272
If you need to store an array of arrays, where each member array can be of any length
1272
1273
and stores the same primitive type (a.k.a. a ragged array), the
1273
- :class: `numcodecs.VLenArray ` codec can be used, e.g.::
1274
+ :class: `numcodecs.vlen. VLenArray ` codec can be used, e.g.::
1274
1275
1275
1276
>>> z = zarr.empty(4, dtype=object, object_codec=numcodecs.VLenArray(int))
1276
1277
>>> z
0 commit comments