Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
themperek authored and DavidLP committed Feb 8, 2021
1 parent a6b0ff0 commit 502a999
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions basil/HL/RegisterHardwareLayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import logging
from copy import deepcopy
import collections
from collections.abc import Iterable
import array
from collections import namedtuple
from six import integer_types
Expand Down Expand Up @@ -242,7 +242,7 @@ def _set(self, reg, value):
if 'properties' in descr and [i for i in read_only if i in descr['properties']]:
raise IOError('Register is read-only')
if 'properties' in descr and [i for i in is_byte_array if i in descr['properties']]:
if not isinstance(value, collections.Iterable):
if not isinstance(value, Iterable):
raise ValueError('For array byte_register iterable object is needed')
value = array.array('B', value).tolist()
self.set_bytes(value, **descr)
Expand Down
2 changes: 1 addition & 1 deletion basil/TL/Visa.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
import visa
import pyvisa as visa
import logging

from basil.TL.TransferLayer import TransferLayer
Expand Down
2 changes: 1 addition & 1 deletion basil/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def bitvector_to_byte_array(bitvector):
def bitarray_to_byte_array(bitarr):
ba = bitarray(bitarr, endian=bitarr.endian())
ba.reverse() # this flip the byte order and the bit order of each byte
bs = np.fromstring(ba.tobytes(), dtype=np.uint8) # byte padding happens here, bitarray.tobytes()
bs = np.frombuffer(ba.tobytes(), dtype=np.uint8) # byte padding happens here, bitarray.tobytes()
bs = (bs * 0x0202020202 & 0x010884422010) % 1023
return array('B', bs.astype(np.uint8))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_BitLogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_get_item_with_slice(self):
bl = BitLogic.from_value(12, size=9, fmt='Q')
self.assertEqual(bl[3:1], bitarray('011'))
self.assertEqual(bl[:], bitarray('001100000'))
self.assertEqual(bl[bl.length():], bitarray('001100000'))
self.assertEqual(bl[len(bl):], bitarray('001100000'))
self.assertEqual(bl[len(bl):], bitarray('001100000'))
self.assertEqual(bl[len(bl):0], bitarray('001100000'))

Expand Down

0 comments on commit 502a999

Please sign in to comment.