Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Aug 21, 2024
1 parent 8f9777e commit 07d879f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
3 changes: 1 addition & 2 deletions src/hdmf/backends/hdf5/h5_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,10 @@ def shape(self):

def append(self, arg):
# Get Builder
builder = self.io.manager.builders[arg.object_id]
builder = self.io.manager.get_builder(arg)

# Get HDF5 Reference
ref = self.io._create_ref(builder)
breakpoint()
append_data(self.dataset, ref)


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 @@ -1513,7 +1513,6 @@ def __get_ref(self, **kwargs):
else:
self.logger.debug("Getting reference for %s '%s'" % (container.__class__.__name__, container.name))
builder = self.manager.build(container)
breakpoint()
path = self.__get_path(builder)

self.logger.debug("Getting reference at path '%s'" % path)
Expand Down
10 changes: 3 additions & 7 deletions src/hdmf/build/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ def __init__(self, type_map):
self.__containers = dict()
self.__active_builders = set()
self.__type_map = type_map
self.__ref_queue = deque() # a queue of the ReferenceBuilders that need to be added

@property
def builders(self):
return self.__builders
self.__ref_queue = deque() # a queue of the ReferenceBuilders that need to be addedq

@property
def namespace_catalog(self):
Expand Down Expand Up @@ -202,7 +198,7 @@ def prebuilt(self, **kwargs):
''' Save the Builder for a given AbstractContainer for future use '''
container, builder = getargs('container', 'builder', kwargs)
container_id = self.__conthash__(container)
self.__builders[container.object_id] = builder
self.__builders[container_id] = builder
builder_id = self.__bldrhash__(builder)
self.__containers[builder_id] = container

Expand Down Expand Up @@ -267,7 +263,7 @@ def get_builder(self, **kwargs):
"""Return the prebuilt builder for the given container or None if it does not exist."""
container = getargs('container', kwargs)
container_id = self.__conthash__(container)
result = self.__builders.get(container.object_id)
result = self.__builders.get(container_id)
return result

@docval({'name': 'builder', 'type': (DatasetBuilder, GroupBuilder),
Expand Down
3 changes: 2 additions & 1 deletion src/hdmf/build/objectmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
ConstructError)
from .manager import Proxy, BuildManager

from .warnings import MissingRequiredBuildWarning, DtypeConversionWarning, IncorrectQuantityBuildWarning
from .warnings import (MissingRequiredBuildWarning, DtypeConversionWarning, IncorrectQuantityBuildWarning,
IncorrectDatasetShapeBuildWarning)
from hdmf.backends.hdf5.h5_utils import H5DataIO

from ..container import AbstractContainer, Data, DataRegion
Expand Down
14 changes: 6 additions & 8 deletions tests/unit/test_io_hdf5_h5tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2972,18 +2972,16 @@ def test_append_dataset_of_references(self):
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()
with HDF5IO(self.paths[0], manager=get_baz_buildmanager(), mode='a') as append_io:
read_bucket1 = append_io.read()
new_baz = Baz(name='new')
read_bucket1.add_baz(new_baz)
read_io.write(read_bucket1)
append_io.write(read_bucket1)

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

with HDF5IO(self.paths[0], manager=get_baz_buildmanager(), mode='r') as read_io:
read_bucket1 = read_io.read()
Expand Down

0 comments on commit 07d879f

Please sign in to comment.