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

Don't override col_cls in DynamicTable.add_column #1091

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- Added `TypeConfigurator` to automatically wrap fields with `TermSetWrapper` according to a configuration file. @mavaylon1 [#1016](https://github.com/hdmf-dev/hdmf/pull/1016)
- Updated `TermSetWrapper` to support validating a single field within a compound array. @mavaylon1 [#1061](https://github.com/hdmf-dev/hdmf/pull/1061)

### Bug fixes
- Fixed issue with `DynamicTable.add_column` not allowing subclasses of `DynamicTableRegion` or `EnumData`. @rly [#1091](https://github.com/hdmf-dev/hdmf/pull/1091)

## HDMF 3.13.0 (March 20, 2024)

### Enhancements
Expand Down
8 changes: 5 additions & 3 deletions src/hdmf/common/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,11 +821,13 @@ def add_column(self, **kwargs): # noqa: C901
raise ValueError("column '%s' cannot be both a table region "
"and come from an enumerable set of elements" % name)
if table is not False:
col_cls = DynamicTableRegion
if col_cls is None:
col_cls = DynamicTableRegion
if isinstance(table, DynamicTable):
ckwargs['table'] = table
if enum is not False:
col_cls = EnumData
if col_cls is None:
col_cls = EnumData
if isinstance(enum, (list, tuple, np.ndarray, VectorData)):
ckwargs['elements'] = enum

Expand Down Expand Up @@ -873,7 +875,7 @@ def add_column(self, **kwargs): # noqa: C901
if col in self.__uninit_cols:
self.__uninit_cols.pop(col)

if col_cls is EnumData:
if issubclass(col_cls, EnumData):
columns.append(col.elements)
col.elements.parent = self

Expand Down
Loading