-
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
Don't override col_cls in DynamicTable.add_column #1091
Conversation
Will this be in by next milestone? |
Please let us know when it gets in. We are relying on it for implementation of ndx-hed. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1091 +/- ##
==========================================
- Coverage 90.88% 90.87% -0.01%
==========================================
Files 42 42
Lines 9532 9537 +5
Branches 1922 1926 +4
==========================================
+ Hits 8663 8667 +4
Misses 576 576
- Partials 293 294 +1 ☔ View full report in Codecov by Sentry. |
Motivation
Issue: If a user creates a schema that extends
DynamicTableRegion
orEnumData
and tries to create a column with that subclass as the column class, the column is instead created with the baseDynamicTableRegion
orEnumData
class.For example, if a user creates a new type
CustomDTR
that extends theDynamicTableRegion
type, and then they create aDynamicTable
and callsadd_column
with the column class being set to the new type (col_cls=CustomDTR
), then the new column for this table currently has typeDynamicTableRegion
.See new test:
test_add_custom_dtr_column
Another use case: if a user creates a new type
CustomDTR
that extends theDynamicTableRegion
type, and they create a new typeCustomTable
that extendsDynamicTable
and contains a column with typeCustomDTR
, then the auto-generated column for this table currently has typeDynamicTableRegion
.See test:
test_custom_dtr_class
To make this work correctly in this PR, I updated
add_column
to use the passedcol_cls
instead of assumingtable=True
meanscol_cls=DynamicTableRegion
. In order to do that, I also had to change the default value forcol_cls
away fromVectorData
. That default was set in more places than was needed anyway. I also had to move when the check that the passedcol_cls
equals theclass
included in a pre-defined column in__columns__
occurs, so that it is checked aftercol_cls
is appropriately set, not before.Checklist
CHANGELOG.md
with your changes?