Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for h5py >=3.0.0. #411

Merged
merged 2 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ The **signac** package follows `semantic versioning <https://semver.org/>`_.
Version 1
=========

next
----

Added
+++++

- Support for h5py version 3 (#411).

[1.5.0] -- 2020-09-20
---------------------

Expand Down
6 changes: 6 additions & 0 deletions signac/core/h5store.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def _h5set(store, grp, key, value, path=None):

def _h5get(store, grp, key, path=None):
"""Retrieve the underlying data for a key from its h5py container."""
import h5py
path = path + '/' + key if path else key
result = grp[key]

Expand All @@ -153,6 +154,11 @@ def _h5get(store, grp, key, path=None):
return None
elif shape:
return result
elif h5py.version.version_tuple.major >= 3 and \
h5py.check_dtype(vlen=result.dtype) is str:
# h5py >=3.0.0 returns strings as bytes. This returns str for
# consistency with past behavior in signac.
return result.asstr()[()]
else:
return result[()]
except AttributeError:
Expand Down