32
32
14 : {"dtype" : np .dtype ("int64" ), "scalar_type" : "INT64" },
33
33
15 : {"dtype" : np .dtype ("uint64" ), "scalar_type" : "UINT64" },
34
34
16 : {"dtype" : None , "scalar_type" : "FUNCTION" },
35
- 65536 : {"dtype" : np .dtype ("datetime64[Y]" ), "scalar_type" : "DATETIME64[Y]" },
36
- 65537 : {"dtype" : np .dtype ("datetime64[M]" ), "scalar_type" : "DATETIME64[M]" },
37
- 65538 : {"dtype" : np .dtype ("datetime64[W]" ), "scalar_type" : "DATETIME64[W]" },
38
- 65539 : {"dtype" : np .dtype ("datetime64[D]" ), "scalar_type" : "DATETIME64[D]" },
39
- 65540 : {"dtype" : np .dtype ("datetime64[h]" ), "scalar_type" : "DATETIME64[h]" },
40
- 65541 : {"dtype" : np .dtype ("datetime64[m]" ), "scalar_type" : "DATETIME64[m]" },
41
- 65542 : {"dtype" : np .dtype ("datetime64[s]" ), "scalar_type" : "DATETIME64[s]" },
42
- 65543 : {"dtype" : np .dtype ("datetime64[ms]" ), "scalar_type" : "DATETIME64[ms]" },
43
- 65544 : {"dtype" : np .dtype ("datetime64[us]" ), "scalar_type" : "DATETIME64[us]" },
44
- 65545 : {"dtype" : np .dtype ("datetime64[ns]" ), "scalar_type" : "DATETIME64[ns]" },
45
- 65546 : {"dtype" : np .dtype ("datetime64[ps]" ), "scalar_type" : "DATETIME64[ps]" },
46
- 65547 : {"dtype" : np .dtype ("datetime64[fs]" ), "scalar_type" : "DATETIME64[fs]" },
47
- 65548 : {"dtype" : np .dtype ("datetime64[as]" ), "scalar_type" : "DATETIME64[as]" },
35
+ 65_536 : {"dtype" : np .dtype ("datetime64[Y]" ), "scalar_type" : "DATETIME64[Y]" },
36
+ 65_537 : {"dtype" : np .dtype ("datetime64[M]" ), "scalar_type" : "DATETIME64[M]" },
37
+ 65_538 : {"dtype" : np .dtype ("datetime64[W]" ), "scalar_type" : "DATETIME64[W]" },
38
+ 65_539 : {"dtype" : np .dtype ("datetime64[D]" ), "scalar_type" : "DATETIME64[D]" },
39
+ 65_540 : {"dtype" : np .dtype ("datetime64[h]" ), "scalar_type" : "DATETIME64[h]" },
40
+ 65_541 : {"dtype" : np .dtype ("datetime64[m]" ), "scalar_type" : "DATETIME64[m]" },
41
+ 65_542 : {"dtype" : np .dtype ("datetime64[s]" ), "scalar_type" : "DATETIME64[s]" },
42
+ 65_543 : {"dtype" : np .dtype ("datetime64[ms]" ), "scalar_type" : "DATETIME64[ms]" },
43
+ 65_544 : {"dtype" : np .dtype ("datetime64[us]" ), "scalar_type" : "DATETIME64[us]" },
44
+ 65_545 : {"dtype" : np .dtype ("datetime64[ns]" ), "scalar_type" : "DATETIME64[ns]" },
45
+ 65_546 : {"dtype" : np .dtype ("datetime64[ps]" ), "scalar_type" : "DATETIME64[ps]" },
46
+ 65_547 : {"dtype" : np .dtype ("datetime64[fs]" ), "scalar_type" : "DATETIME64[fs]" },
47
+ 65_548 : {"dtype" : np .dtype ("datetime64[as]" ), "scalar_type" : "DATETIME64[as]" },
48
48
}
49
49
serialize_lookup = {
50
50
v ["dtype" ]: {"type_id" : k , "scalar_type" : v ["scalar_type" ]}
@@ -269,14 +269,13 @@ def pack_array(self, array):
269
269
try :
270
270
type_id = serialize_lookup [array .dtype ]["type_id" ]
271
271
except KeyError :
272
+ # U is for unicode string
272
273
if array .dtype .char == "U" :
273
274
type_id = serialize_lookup [np .dtype ("O" )]["type_id" ]
274
- pass
275
275
else :
276
- raise DataJointError ("Type %s is ambiguous or unknown" % array . dtype )
276
+ raise DataJointError (f "Type { array . dtype } is ambiguous or unknown" )
277
277
278
278
blob += np .array ([type_id , is_complex ], dtype = np .uint32 ).tobytes ()
279
- # array of dtype('O'), U is for unicode string
280
279
if (
281
280
array .dtype .char == "U"
282
281
or serialize_lookup [array .dtype ]["scalar_type" ] == "VOID"
@@ -286,7 +285,6 @@ def pack_array(self, array):
286
285
for it in (self .pack_blob (e ) for e in array .flatten (order = "F" ))
287
286
)
288
287
self .set_dj0 () # not supported by original mym
289
- # array of dtype('c')
290
288
elif serialize_lookup [array .dtype ]["scalar_type" ] == "CHAR" :
291
289
blob += (
292
290
array .view (np .uint8 ).astype (np .uint16 ).tobytes ()
0 commit comments