Skip to content

Commit 4a1f3bb

Browse files
authored
Fix some warnings in tests (#391)
1 parent 94a7abe commit 4a1f3bb

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

labrad/decorators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def __init__(self, func, lr_ID, lr_name, returns, unflatten, **params):
102102
# unpack tuples, so this case is not allowed: The first argument
103103
# cannot be a tuple or '?' tag if the second argument is optional.
104104

105-
argspec = inspect.getargspec(self.func)
105+
argspec = inspect.getfullargspec(self.func)
106106
args = argspec.args[2:] # Skip 'self' and context data arguments.
107107

108108
if inspect.isgeneratorfunction(func):
@@ -224,8 +224,8 @@ def messageHandler(lr_ID, lr_name=None, returns=[], lr_num_params=2, **params):
224224
strings of allowed types.
225225
"""
226226
def decorated(f):
227-
args, varargs, varkw, defaults = inspect.getargspec(f)
228-
args = args[lr_num_params:]
227+
argspec = inspect.getfullargspec(f)
228+
args, defaults = argspec.args[lr_num_params:], argspec.defaults
229229

230230
# handle generators as defer.inlineCallbacks
231231
if inspect.isgeneratorfunction(f):

labrad/node/server_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def from_string(conf, filename=None, path=None, platform=sys.platform):
3030
if isinstance(conf, bytes):
3131
conf = conf.decode('utf-8')
3232
scp = ConfigParser()
33-
scp.readfp(io.StringIO(conf))
33+
scp.read_file(io.StringIO(conf))
3434

3535
# general information
3636
name = scp.get('info', 'name', raw=True)

labrad/test/extraction_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def timeIt(f, *a, **kw):
1717
return result
1818

1919
def extractAverage(packets):
20-
data = ''.join(packets)
21-
Is, Qs = np.fromstring(data, dtype='<i2').reshape(-1, 2).astype(int).T
20+
data = b''.join(packets)
21+
Is, Qs = np.frombuffer(data, dtype='<i2').reshape(-1, 2).astype(int).T
2222
return (Is, Qs)
2323

2424
def extract(packets):
@@ -29,7 +29,7 @@ def extract(packets):
2929
mac = '01:23:45:67:89:ab'
3030
eth = 1
3131

32-
packets = [(mac, mac, eth, '\x00'*44) for _ in range(9000)]
32+
packets = [(mac, mac, eth, b'\x00' * 44) for _ in range(9000)]
3333
data, t, endianness = types.flatten(packets)
3434

3535
timeIt(extract, packets)

labrad/types/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def parseSingleType(s):
163163
s.strip(WHITESPACE)
164164
return t
165165

166-
COMMENTS = re.compile('\{[^\{\}]*\}')
166+
COMMENTS = re.compile(r'\{[^\{\}]*\}')
167167

168168
def stripComments(s):
169169
"""Remove comments from a type tag.
@@ -1222,9 +1222,9 @@ def unflattenNDlist(s, dims):
12221222
def _unflatten_as_array(self, s, endianness, elem, dims, size):
12231223
"""Unflatten to numpy array."""
12241224
def make(t, width):
1225-
a = np.fromstring(s.get(size*width), dtype=np.dtype(t))
1225+
a = np.frombuffer(s.get(size*width), dtype=np.dtype(t))
12261226
if endianness != SYSTEM_BYTE_ORDER:
1227-
a.byteswap(True) # inplace
1227+
a = a.byteswap(inplace=False)
12281228
return a
12291229

12301230
if elem == TBool(): a = make('bool', 1)

0 commit comments

Comments
 (0)