Skip to content

Commit

Permalink
Unwrap TermSetWrapper in ObjectMapper and no the IO
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Mar 15, 2024
1 parent f092cbb commit a35665f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/hdmf/backends/hdf5/h5tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1103,10 +1103,6 @@ def write_dataset(self, **kwargs): # noqa: C901
data = data.data
else:
options['io_settings'] = {}
if isinstance(data, TermSetWrapper):
# This is for when the wrapped item is a dataset
# (refer to objectmapper.py for wrapped attributes)
data = data.value
attributes = builder.attributes
options['dtype'] = builder.dtype
dset = None
Expand Down
1 change: 1 addition & 0 deletions src/hdmf/build/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def __init__(self, **kwargs):
name, groups, datasets, links, attributes, parent, source = getargs(
'name', 'groups', 'datasets', 'links', 'attributes', 'parent', 'source', kwargs)
# NOTE: if groups, datasets, or links are dicts, their keys are unused
# breakpoint()
groups = self.__to_list(groups)
datasets = self.__to_list(datasets)
links = self.__to_list(links)
Expand Down
1 change: 0 additions & 1 deletion src/hdmf/build/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,6 @@ def build(self, **kwargs):
if manager is None:
manager = BuildManager(self)
builder = obj_mapper.build(container, manager, builder=builder, source=source, spec_ext=spec_ext, export=export)

# add additional attributes (namespace, data_type, object_id) to builder
namespace, data_type = self.get_container_ns_dt(container)
builder.set_attribute('namespace', namespace)
Expand Down
4 changes: 4 additions & 0 deletions src/hdmf/build/objectmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,10 @@ def build(self, **kwargs):
msg = 'could not resolve dtype for %s \'%s\'' % (type(container).__name__, container.name)
raise Exception(msg) from ex
builder = DatasetBuilder(name, bldr_data, parent=parent, source=source, dtype=dtype)
if isinstance(builder, DatasetBuilder) and isinstance(builder.data, TermSetWrapper):
builder.data = builder.data.value
else:
pass

# Add attributes from the specification extension to the list of attributes
all_attrs = self.__spec.attributes + getattr(spec_ext, 'attributes', tuple())
Expand Down

0 comments on commit a35665f

Please sign in to comment.