Skip to content

Commit 22da195

Browse files
committed
feat(archive): also handle h5 files
Fixes #285
1 parent 9a56b68 commit 22da195

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pyneuroml/archive/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def get_model_file_list(
126126
:returns: value of lems_def_dir so that the temporary directory can be
127127
cleaned up. strings are immuatable in Python so the variable cannot be
128128
modified in the function.
129-
:raises ValueError: if a file that does not have ".xml" or ".nml" as extension is encountered
129+
:raises ValueError: if a file that does not have ".xml", ".nml", or ".h5" as extension is encountered
130130
"""
131131
logger.debug(f"Processing {rootfile}")
132132

@@ -148,7 +148,7 @@ def get_model_file_list(
148148
logger.debug(f"Appending: {relrootfile}")
149149
filelist.append(relrootfile)
150150

151-
if rootfile.endswith(".nml"):
151+
if rootfile.endswith(".nml") or rootfile.endswith(".h5"):
152152
if pathlib.Path(rootfile).is_absolute():
153153
rootdoc = read_neuroml2_file(rootfile)
154154
else:
@@ -183,7 +183,9 @@ def get_model_file_list(
183183
lems_def_dir = get_model_file_list(inc, filelist, rootdir, lems_def_dir)
184184

185185
else:
186-
raise ValueError(f"File must have a .xml or .nml extension. We got: {rootfile}")
186+
raise ValueError(
187+
f"File must have a .xml, .nml, or .h5 extension. We got: {rootfile}"
188+
)
187189

188190
return lems_def_dir
189191

0 commit comments

Comments
 (0)