Skip to content

Commit

Permalink
check that keys are strings
Browse files Browse the repository at this point in the history
  • Loading branch information
zm711 committed Feb 19, 2024
1 parent a1a5846 commit e2fd822
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion neo/core/baseneo.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def _check_annotations(value):
raise ValueError(f"Invalid annotation. NumPy arrays with dtype {value.dtype.type}" f"are not allowed")
elif isinstance(value, dict):
for key, element in value.items():
_check_annotations(key)
if not isinstance(key, str):
raise TypeError(f"Annotations keys must be strings not of type {type(key)}")
_check_annotations(element)
elif isinstance(value, (list, tuple)):
for element in value:
Expand Down

0 comments on commit e2fd822

Please sign in to comment.