Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sal/core/serialise.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def _decode_array(d):
raise InternalError('Malformed array data found during de-serialisation.')

if encoding == 'base64':
return _np.fromstring(base64.b64decode(data), dtype=dtype).reshape(shape)
return _np.frombuffer(base64.b64decode(data), dtype=dtype).reshape(shape)

if encoding == 'list':
return _np.array(data, dtype=dtype)
Expand Down
4 changes: 2 additions & 2 deletions sal/dataclass/core/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@ def _sanitise_value(self, value):
promotion_table = {
int: np.int64,
float: np.float64,
bool: np.bool
bool: np.bool_
}

supported_types = [
np.int8, np.int16, np.int32, np.int64,
np.uint8, np.uint16, np.uint32, np.uint64,
np.float32, np.float64,
np.bool,
np.bool_,
str
]

Expand Down
4 changes: 2 additions & 2 deletions sal/dataclass/core/scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ def _sanitise_value(self, value):
promotion_table = {
int: np.int64,
float: np.float64,
bool: np.bool
bool: np.bool_
}

supported_types = [
np.int8, np.int16, np.int32, np.int64,
np.uint8, np.uint16, np.uint32, np.uint64,
np.float32, np.float64,
np.bool
np.bool_
]

# promote python types to more specific numpy types
Expand Down
10 changes: 5 additions & 5 deletions sal/tests/dataclass/unit/test_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def setUp(self):
'float_value': float(0.0),
'fp32_value': np.float32(1.0),
'fp64_value': np.float64(2.0),
'numpy_bool_value': np.bool(True),
'numpy_bool_value': np.bool_(True),
'bool_value': bool(True),
'string_value': str('Test string.')
}
Expand All @@ -38,8 +38,8 @@ def setUp(self):
'float_value': np.float64(0.0),
'fp32_value': np.float32(1.0),
'fp64_value': np.float64(2.0),
'numpy_bool_value': np.bool(True),
'bool_value': np.bool(True),
'numpy_bool_value': np.bool_(True),
'bool_value': np.bool_(True),
'string_value': str('Test string.')
}

Expand All @@ -62,8 +62,8 @@ def setUp(self):
'float_value': np.float64(0.0),
'fp32_value': np.float32(1.0),
'fp64_value': np.float64(2.0),
'numpy_bool_value': np.bool(True),
'bool_value': np.bool(True),
'numpy_bool_value': np.bool_(True),
'bool_value': np.bool_(True),
'string_value': str('Test string.')
}
}
Expand Down
4 changes: 2 additions & 2 deletions sal/tests/dataclass/unit/test_scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@pytest.mark.parametrize('value, expected_type',
[(1, np.int64),
(1., np.float64),
(True, np.bool),
(True, np.bool_),
(np.int8(1), np.int8),
(np.int16(1), np.int16),
(np.int32(1), np.int32),
Expand All @@ -18,7 +18,7 @@
(np.uint64(1), np.uint64),
(np.float32(1.), np.float32),
(np.float32(1.), np.float32),
(np.bool(1), np.bool)])
(np.bool_(1), np.bool_)])
def test_scalar_santise(scalar, value, expected_type):

"""
Expand Down