Skip to content

Commit a205862

Browse files
authored
Merge pull request #60 from kiranshila/py38-dev
Fix references to deprecated collections classes
2 parents b1462c1 + 2894690 commit a205862

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/casperfpga.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import socket
55
from time import strptime
66
import string
7-
import collections
7+
from collections.abc import Callable
88

99
from . import register
1010
from . import sbram
@@ -625,7 +625,7 @@ def _create_memory_devices(self, device_dict, memorymap_dict, legacy_reg_map=Tru
625625
except KeyError:
626626
pass
627627
else:
628-
if not isinstance(known_device_class, collections.Callable):
628+
if not isinstance(known_device_class, Callable):
629629
raise TypeError('%s is not a callable Memory class - '
630630
'that\'s a problem.' % known_device_class)
631631

@@ -692,7 +692,7 @@ def _create_casper_adc_devices(self, device_dict, initialise=False, **kwargs):
692692
except KeyError:
693693
pass
694694
else:
695-
if not isinstance(known_device_class, collections.Callable):
695+
if not isinstance(known_device_class, Callable):
696696
errmsg = '{} is not a callable ADC Class'.format(known_device_class)
697697
raise TypeError(errmsg)
698698

src/i2c/i2c_sn.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy as np, logging, time, struct
2-
import collections,crcmod
2+
import crcmod
3+
from collections.abc import Iterable
34

45
logger = logging.getLogger(__name__)
56

@@ -31,7 +32,7 @@ def write(self,reg=None,data=None):
3132
def crc8(self,data,poly=0x131,initVal=0):
3233

3334
crc = initVal
34-
if isinstance(data,collections.Iterable):
35+
if isinstance(data, Iterable):
3536
for d in data:
3637
crc = self.crc8(d,poly,crc)
3738
return crc

src/i2c_sn.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy as np, logging, time, struct
2-
import collections,crcmod
2+
import crcmod
3+
from collections.abc import Iterable
34

45
logger = logging.getLogger(__name__)
56

@@ -33,7 +34,7 @@ def write(self,reg=None,data=None):
3334
def crc8(self,data,poly=0x131,initVal=0):
3435

3536
crc = initVal
36-
if isinstance(data,collections.Iterable):
37+
if isinstance(data, Iterable):
3738
for d in data:
3839
crc = self.crc8(d,poly,crc)
3940
return crc

0 commit comments

Comments
 (0)