Skip to content
Snippets Groups Projects

fix by TB: microphone_to_memory does not work otherwise

Merged Fabian Reister requested to merge fix/assert-error into master
1 unresolved thread
1 file
+ 14
4
Compare changes
  • Side-by-side
  • Inline
@@ -28,11 +28,21 @@ def pythonic_to_aron_ice(
return AronDataIceTypes.bool(value)
elif isinstance(value, np.int64):
return AronDataIceTypes.long(int(value))
elif isinstance(value, int) or isinstance(value, np.int32):
assert 'invalid value - expected int' not in str(AronIceTypes.int(int(value))), \
f'Casting {value} to int failed. Did you intend to use np.int64 instead, ' \
'but assigned a plain int value, or converted the value somewhere in the meantime?'
elif isinstance(value, np.int32):
return AronIceTypes.int(int(value))
elif isinstance(value, int):
# because python is treating int and long the same, we need to differentiate between the two
if 'invalid value - expected int' in str(AronIceTypes.int(int(value))):
# try to convert it to AronInt -> if it fails this is a long
assert 'invalid value - expected int' not in str(AronIceTypes.long(int(value))), \
f'Casting {value} to long failed. Did you intend to use np.int64 instead, ' \
'but assigned a plain int value, or converted the value somewhere in the meantime?'
return AronIceTypes.long(int(value))
else:
assert 'invalid value - expected int' not in str(AronIceTypes.int(int(value))), \
f'Casting {value} to int failed. Did you intend to use np.int64 instead, ' \
'but assigned a plain int value, or converted the value somewhere in the meantime?'
return AronIceTypes.int(int(value))
elif isinstance(value, np.float64):
return AronDataIceTypes.double(float(value))
elif isinstance(value, float) or isinstance(value, np.float32):
Loading