Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Jul 10, 2024
1 parent d816311 commit fc464cc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/hdmf/backends/hdf5/h5_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ def __next__(self):
return self._get_ref(super().__next__())

def append(self, arg):
breakpoint()
append_data(self.dataset, arg)

Check warning on line 150 in src/hdmf/backends/hdf5/h5_utils.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/backends/hdf5/h5_utils.py#L150

Added line #L150 was not covered by tests


Expand Down
1 change: 0 additions & 1 deletion src/hdmf/backends/hdf5/h5tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,6 @@ def write_dataset(self, **kwargs): # noqa: C901
data = builder.data
dataio = None
options = dict() # dict with additional
breakpoint()
if isinstance(data, H5DataIO):
options['io_settings'] = data.io_settings
dataio = data
Expand Down
1 change: 0 additions & 1 deletion src/hdmf/backends/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def write(self, **kwargs):

"""Write a container to the IO source."""
f_builder = self.__manager.build(container, source=self.__source, root=True)
breakpoint()
self.write_builder(f_builder, **kwargs)

@docval({'name': 'src_io', 'type': 'hdmf.backends.io.HDMFIO',
Expand Down
8 changes: 6 additions & 2 deletions src/hdmf/build/objectmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
ConstructError)
from .manager import Proxy, BuildManager
from .warnings import MissingRequiredBuildWarning, DtypeConversionWarning, IncorrectQuantityBuildWarning
from hdmf.backends.hdf5.h5_utils import H5DataIO

from ..container import AbstractContainer, Data, DataRegion
from ..term_set import TermSetWrapper
from ..data_utils import DataIO, AbstractDataChunkIterator
Expand Down Expand Up @@ -771,7 +773,6 @@ def build(self, **kwargs):
# TODO: Check the BuildManager as refinements should probably be resolved rather than be passed in via spec_ext
all_attrs = list({a.name: a for a in all_attrs[::-1]}.values())
self.__add_attributes(builder, all_attrs, container, manager, source, export)
# breakpoint()
return builder

def __check_dset_spec(self, orig, ext):
Expand Down Expand Up @@ -821,7 +822,8 @@ def __set_dataset_to_refs(self, builder, dtype, shape, container, build_manager)
% (builder.__class__.__name__, builder.name))

def _filler():
builder.data = self.__get_ref_builder(builder, dtype, shape, container, build_manager)
data = self.__get_ref_builder(builder, dtype, shape, container, build_manager)
builder.data = data

Check warning on line 826 in src/hdmf/build/objectmapper.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/build/objectmapper.py#L825-L826

Added lines #L825 - L826 were not covered by tests

return _filler

Expand Down Expand Up @@ -890,6 +892,8 @@ def __get_ref_builder(self, builder, dtype, shape, container, build_manager):
for d in container.data:
target_builder = self.__get_target_builder(d, build_manager, builder)
bldr_data.append(ReferenceBuilder(target_builder))
if isinstance(container.data, H5DataIO):
bldr_data = H5DataIO(bldr_data, **container.data.get_io_params())

Check warning on line 896 in src/hdmf/build/objectmapper.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/build/objectmapper.py#L896

Added line #L896 was not covered by tests
else:
self.logger.debug("Setting %s '%s' data to reference builder"
% (builder.__class__.__name__, builder.name))
Expand Down
17 changes: 5 additions & 12 deletions tests/unit/test_io_hdf5_h5tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2964,27 +2964,20 @@ def test_append_dataset_of_references(self):
num_bazs = 10
for i in range(num_bazs):
bazs.append(Baz(name='baz%d' % i))
wrapped_bazs = H5DataIO(bazs)
array_bazs=np.array(bazs)
wrapped_bazs = H5DataIO(array_bazs, maxshape=(None,))
baz_data = BazData(name='baz_data1', data=wrapped_bazs)
bucket = BazBucket(name='bucket1', bazs=bazs.copy(), baz_data=baz_data)
breakpoint()

with HDF5IO(self.paths[0], manager=get_baz_buildmanager(), mode='w') as write_io:
write_io.write(bucket)

with HDF5IO(self.paths[0], manager=get_baz_buildmanager(), mode='a') as read_io:
read_bucket1 = read_io.read()
new_baz = Baz(name='baz000')
breakpoint()
DoR = read_bucket1.baz_data.data
DoR.append(new_baz)
breakpoint()

#
# read_container = reader.read()
# new_baz = Baz(name='baz0')
# DoR = read_bucket1.baz_data.data
# DoR.append(new_baz)
ref = read_bucket1.baz_data.data.dataset[0]
DoR.append(ref)
self.assertEqual(len(read_bucket1.baz_data.data), 11)

def test_append_external_link_data(self):
"""Test that exporting a written container after adding a link with link_data=True creates external links."""
Expand Down

0 comments on commit fc464cc

Please sign in to comment.