Skip to content

Commit 1b18793

Browse files
committed
When calling load with paths a path that does not exist won't raise an 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
1 parent 5d106de commit 1b18793

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

cadet/cadet.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,12 @@ def recursively_load( h5file, path, func, paths):
145145
ans = Dict()
146146
if paths is not None:
147147
for path in paths:
148-
item = h5file[path]
149-
if isinstance(item, h5py._hl.dataset.Dataset):
150-
ans[path[1:]] = item[()]
151-
elif isinstance(item, h5py._hl.group.Group):
152-
ans[path[1:]] = recursively_load(h5file, path + '/', func, None)
148+
item = h5file.get(path, None)
149+
if item is not None:
150+
if isinstance(item, h5py._hl.dataset.Dataset):
151+
ans[path[1:]] = item[()]
152+
elif isinstance(item, h5py._hl.group.Group):
153+
ans[path[1:]] = recursively_load(h5file, path + '/', func, None)
153154
else:
154155
for key_original in h5file[path].keys():
155156
key = func(key_original)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="CADET",
8-
version="0.4",
8+
version="0.5",
99
author="William Heymann",
1010
author_email="[email protected]",
1111
description="CADET is a python interface to the CADET chromatography simulator",

0 commit comments

Comments
 (0)