-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix classification of attributes as new/overridden and issue with custom spec keys #503
Conversation
e.g. an NWB file with NWBGroupSpec, NWBDatasetSpec, etc. using 'neurodata_type_def' instead of 'data_type_def' searches for 'neurodata_type_def' in the cached hdmf-common schema which contains 'data_type_def'
Codecov Report
@@ Coverage Diff @@
## dev #503 +/- ##
==========================================
- Coverage 85.47% 84.48% -1.00%
==========================================
Files 41 38 -3
Lines 8213 7700 -513
Branches 1770 1657 -113
==========================================
- Hits 7020 6505 -515
- Misses 842 861 +19
+ Partials 351 334 -17
Continue to review full report at Codecov.
|
This should resolve the error in PyNWB mentioned here: #550 (comment) |
|
||
def is_many(self): | ||
return self.quantity not in (1, ZERO_OR_ONE) | ||
|
||
@classmethod | ||
def get_data_type_spec(cls, data_type_def): | ||
def get_data_type_spec(cls, data_type_def): # unused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume 'unused' means they are never called anywhere. Are you leaving these here just in case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is a note-to-self. Reading the code, one might think it would be used in every data_type spec, but actually it is not used anywhere.
Motivation
Fix #501, address part of #502, and fix another related bug where cached HDMF schema loaded from a NWB file were not being resolved correctly.
When extracting HDMF out of PyNWB, a few keys were renamed to be more general, e.g., 'neurodata_type_def' -> 'data_type_def', and subclasses of
GroupSpec
,DatasetSpec
, andSpecNamespace
in HDMF were created in PyNWB. These NWB-specific subclasses are used when reading the hdmf-common schema cached within a file, but the cached schema uses 'data_type_def' instead of 'neurodata_type_def'. This prevented hdmf-common specs from being resolved correctly so that attributes, datasets, groups, and links defined by a base type within hdmf-common were in some cases not inherited by a type that extends the base type.I also refactored parts of spec.py, added comments, and added additional tests to push code coverage of spec.py from 79% to 83% and namespace.py from 79% to 90%.
Checklist
flake8
from the source directory.