Skip to content

Commit

Permalink
Use np.bool_ instead of np.bool8
Browse files Browse the repository at this point in the history
  • Loading branch information
maffoo committed Sep 2, 2024
1 parent 0adfb75 commit 5cfd921
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion labrad/test/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def compareValueArrays(a, b):
(ValueArray([1.0, 2], ''), np.array([1.0, 2]),
np.testing.assert_array_almost_equal),
# Numpy scalar types
(np.bool8(True), True, None)
(np.bool_(True), True, None)
]
for input, expected, comparison_func in tests:
unflat = T.unflatten(*T.flatten(input))
Expand Down
4 changes: 2 additions & 2 deletions labrad/types/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,12 +598,12 @@ def __unflatten__(self, s, endianness):
return bool(ord(s.get(1)))

def __flatten__(self, b, endianness):
if not isinstance(b, (bool, np.bool8)):
if not isinstance(b, (bool, np.bool_)):
raise FlatteningError(b, self)
return b'\x01' if b else b'\x00', self

registerType(bool, TBool())
registerType(np.bool8, TBool())
registerType(np.bool_, TBool())

class TInt(Type, Singleton):
"""A signed 32-bit integer."""
Expand Down

0 comments on commit 5cfd921

Please sign in to comment.