Skip to content

Commit 22616a7

Browse files
authored
Merge pull request #123 from labscript-suite/allow-vlen-names
Remove incorrect and unnecessary attempt to be forward-compatible with vlen strings
2 parents c40acc2 + 6158b6e commit 22616a7

1 file changed

Lines changed: 2 additions & 25 deletions

File tree

labscript_utils/properties.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sys
21
import json
32
from base64 import b64encode, b64decode
43
from collections.abc import Iterable, Mapping
@@ -121,37 +120,15 @@ def _get_device_properties(h5_file, device_name):
121120
def _get_con_table_properties(h5_file, device_name):
122121
import h5py
123122
dataset = h5_file['connection table']
124-
125-
# Compare with the name in the connection table
126-
# whether it is np.bytes_ or vlenstr:
127-
namecol_dtype = dataset.dtype['name']
128-
if namecol_dtype.type is np.bytes_:
129-
device_name = device_name.encode('utf8')
130-
elif namecol_dtype is h5py.special_dtype(vlen=str):
131-
pass
132-
else:
133-
raise TypeError(namecol_dtype)
134-
135-
row = dataset[dataset['name'] == device_name][0]
123+
row = dataset[dataset['name'] == device_name.encode('utf8')][0]
136124
json_string = row['properties']
137125
return deserialise(json_string)
138126

139127

140128
def _get_unit_conversion_parameters(h5_file, device_name):
141129
import h5py
142130
dataset = h5_file['connection table']
143-
144-
# Compare with the name in the connection table
145-
# whether it is np.bytes_ or vlenstr:
146-
namecol_dtype = dataset.dtype['name']
147-
if namecol_dtype.type is np.bytes_:
148-
device_name = device_name.encode('utf8')
149-
elif namecol_dtype is h5py.special_dtype(vlen=str):
150-
pass
151-
else:
152-
raise TypeError(namecol_dtype)
153-
154-
row = dataset[dataset['name'] == device_name][0]
131+
row = dataset[dataset['name'] == device_name.encode('utf8')][0]
155132
json_string = row['unit conversion params']
156133
return deserialise(json_string)
157134

0 commit comments

Comments
 (0)