unpin numpy to enable working with numpy version 2 as well#689
unpin numpy to enable working with numpy version 2 as well#689
Conversation
f553399 to
e5f9287
Compare
|
|
||
| elif type_id == "str": | ||
| value = string_(value).astype(str) | ||
| value = value.decode("utf-8") if isinstance(value, bytes) else value |
There was a problem hiding this comment.
If we wish to support arbitrary string payload then we need to think about what happens when decode() raises a UnicodeError
There was a problem hiding this comment.
Please note that the whole hdfdict.py is just a copy of https://github.com/SiggiGue/hdfdict/blob/master/hdfdict/hdfdict.py (which we had to copy because we wanted to have a stable version and there was no release management on the existing tool at the time). I only made changes here that are related to upgrading to numpy>2, so any decoding problems we had before will be the same. We can discuss this elsewhere later.
| name=key, data=yaml.safe_dump(value).encode("utf-8") | ||
| ) | ||
| ds.attrs.create(name=TYPE, data=b"yaml") | ||
| # if this fails again, restructure your data! |
There was a problem hiding this comment.
"restructure your data" should be emitted as a message if it fails again
There was a problem hiding this comment.
Same as above, I did not change the code. Could be made more robust in the future, but not here.
|
@mkuehbach thanks for the comments, but as outlined above, I don't plan to address any shortcomings of the copied |
Connected to the discussion of issue #687 in preparation for amongst other reason NOMAD releases beyond 1.3.17