Skip to content

Commit

Permalink
When calling load with paths a path that does not exist won't raise a…
Browse files Browse the repository at this point in the history
…n error, this is meant to be a safe way to limit what paths the system can load from the file and not create errors if the limited path does not exist
  • Loading branch information
Immudzen committed Jul 9, 2020
1 parent 5d106de commit 1b18793
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions cadet/cadet.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,12 @@ def recursively_load( h5file, path, func, paths):
ans = Dict()
if paths is not None:
for path in paths:
item = h5file[path]
if isinstance(item, h5py._hl.dataset.Dataset):
ans[path[1:]] = item[()]
elif isinstance(item, h5py._hl.group.Group):
ans[path[1:]] = recursively_load(h5file, path + '/', func, None)
item = h5file.get(path, None)
if item is not None:
if isinstance(item, h5py._hl.dataset.Dataset):
ans[path[1:]] = item[()]
elif isinstance(item, h5py._hl.group.Group):
ans[path[1:]] = recursively_load(h5file, path + '/', func, None)
else:
for key_original in h5file[path].keys():
key = func(key_original)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="CADET",
version="0.4",
version="0.5",
author="William Heymann",
author_email="[email protected]",
description="CADET is a python interface to the CADET chromatography simulator",
Expand Down

0 comments on commit 1b18793

Please sign in to comment.