Skip to content

Commit

Permalink
be less strict when parsing off-spec snirf files
Browse files Browse the repository at this point in the history
don't raise an exception for DataType and DataTypeLabel values
that are not in the specification. Use None instead.
  • Loading branch information
emiddell committed Apr 15, 2024
1 parent 3f5a6dc commit 42b06f1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cedalion/io/snirf.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def parse_data_type(value):
try:
return DataType(value)
except Exception:
raise ValueError(f"unsupported DataType '{value}'")
log.warning(f"unsupported DataType '{value}'")
return None


def parse_data_type_label(value):
Expand All @@ -120,7 +121,8 @@ def parse_data_type_label(value):
try:
return DataTypeLabel(value)
except Exception:
raise ValueError(f"unsupported DataTypeLabel '{value}'")
log.warning(f"unsupported DataTypeLabel '{value}'")
return None


# result container for read_snirf. Corresponds to pysnirf's NirsElement but
Expand Down

0 comments on commit 42b06f1

Please sign in to comment.