Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the numpy dtype in get_type if the array is empty #318

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/hdmf/validate/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def get_type(data):
elif isinstance(data, ReferenceBuilder):
return 'object'
elif isinstance(data, np.ndarray):
return get_type(data[0])
if len(data) > 0:
return get_type(data[0])
else:
return data.dtype
if not hasattr(data, '__len__'):
return type(data).__name__
else:
Expand Down