Skip to content

Commit

Permalink
Add support for h5py >=3.0.0. (#411)
Browse files Browse the repository at this point in the history
* Add support for h5py >=3.0.0.

* Update changelog.
  • Loading branch information
bdice authored Nov 3, 2020
1 parent 6b16246 commit 7b0392b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
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

0 comments on commit 7b0392b

Please sign in to comment.