Skip to content
Snippets Groups Projects
Commit ebe10697 authored by Colm Talbot's avatar Colm Talbot
Browse files

Resolve "Cannot save editable installs with hdf5 without conda"

parent 968397fc
No related branches found
No related tags found
No related merge requests found
......@@ -278,19 +278,22 @@ def encode_for_hdf5(key, item):
elif item is None:
output = "__none__"
elif isinstance(item, list):
item_array = np.array(item)
if len(item) == 0:
output = item
elif isinstance(item[0], (str, bytes)) or item[0] is None:
elif np.issubdtype(item_array.dtype, np.number):
output = np.array(item)
elif issubclass(item_array.dtype.type, str) or item[0] is None:
output = list()
for value in item:
if isinstance(value, str):
output.append(value.encode("utf-8"))
elif isinstance(value, bytes):
output.append(value)
else:
elif value is None:
output.append(b"__none__")
elif isinstance(item[0], (int, float, complex)):
output = np.array(item)
else:
output.append(str(value).encode("utf-8"))
else:
raise ValueError(f'Cannot save {key}: {type(item)} type')
elif isinstance(item, PriorDict):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment