|
1 | | -import sys |
2 | 1 | import json |
3 | 2 | from base64 import b64encode, b64decode |
4 | 3 | from collections.abc import Iterable, Mapping |
@@ -121,37 +120,15 @@ def _get_device_properties(h5_file, device_name): |
121 | 120 | def _get_con_table_properties(h5_file, device_name): |
122 | 121 | import h5py |
123 | 122 | 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] |
136 | 124 | json_string = row['properties'] |
137 | 125 | return deserialise(json_string) |
138 | 126 |
|
139 | 127 |
|
140 | 128 | def _get_unit_conversion_parameters(h5_file, device_name): |
141 | 129 | import h5py |
142 | 130 | 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] |
155 | 132 | json_string = row['unit conversion params'] |
156 | 133 | return deserialise(json_string) |
157 | 134 |
|
|
0 commit comments