@@ -25,10 +25,24 @@ class CastingError(Exception):
25
25
26
26
# np.sctypes is deprecated in numpy 2.0 and np.core.sctypes should not be used instead.
27
27
sctypes = {
28
- 'int' : [np .int8 , np .int16 , np .int32 , np .int64 ],
29
- 'uint' : [np .uint8 , np .uint16 , np .uint32 , np .uint64 ],
30
- 'float' : [np .float16 , np .float32 , np .float64 , np .longdouble ],
31
- 'complex' : [np .complex64 , np .complex128 , np .complex256 ],
28
+ 'int' : [
29
+ getattr (np , dtype ) for dtype in ('int8' , 'int16' , 'int32' , 'int64' ) if hasattr (np , dtype )
30
+ ],
31
+ 'uint' : [
32
+ getattr (np , dtype )
33
+ for dtype in ('uint8' , 'uint16' , 'uint32' , 'uint64' )
34
+ if hasattr (np , dtype )
35
+ ],
36
+ 'float' : [
37
+ getattr (np , dtype )
38
+ for dtype in ('float16' , 'float32' , 'float64' , 'float96' , 'float128' )
39
+ if hasattr (np , dtype )
40
+ ],
41
+ 'complex' : [
42
+ getattr (np , dtype )
43
+ for dtype in ('complex64' , 'complex128' , 'complex192' , 'complex256' )
44
+ if hasattr (np , dtype )
45
+ ],
32
46
'others' : [bool , object , bytes , str , np .void ],
33
47
}
34
48
0 commit comments