Skip to content

Commit

Permalink
feat(archive): also handle h5 files
Browse files Browse the repository at this point in the history
Fixes #285
  • Loading branch information
sanjayankur31 committed Dec 6, 2023
1 parent 9a56b68 commit 22da195
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pyneuroml/archive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def get_model_file_list(
:returns: value of lems_def_dir so that the temporary directory can be
cleaned up. strings are immuatable in Python so the variable cannot be
modified in the function.
:raises ValueError: if a file that does not have ".xml" or ".nml" as extension is encountered
:raises ValueError: if a file that does not have ".xml", ".nml", or ".h5" as extension is encountered
"""
logger.debug(f"Processing {rootfile}")

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

if rootfile.endswith(".nml"):
if rootfile.endswith(".nml") or rootfile.endswith(".h5"):
if pathlib.Path(rootfile).is_absolute():
rootdoc = read_neuroml2_file(rootfile)
else:
Expand Down Expand Up @@ -183,7 +183,9 @@ def get_model_file_list(
lems_def_dir = get_model_file_list(inc, filelist, rootdir, lems_def_dir)

else:
raise ValueError(f"File must have a .xml or .nml extension. We got: {rootfile}")
raise ValueError(
f"File must have a .xml, .nml, or .h5 extension. We got: {rootfile}"
)

return lems_def_dir

Expand Down

0 comments on commit 22da195

Please sign in to comment.