Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Nov 7, 2024
1 parent cd5fe22 commit 51d8798
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/hdmf_zarr/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def write_builder(self, **kwargs):
exhaust_dci=exhaust_dci,
export_source=export_source,
)
self.write_attributes(self.__file, f_builder.attributes, export_source) # the same as set_attributes in HDMF
self.write_attributes(self.__file, f_builder.attributes) # the same as set_attributes in HDMF
self.__dci_queue.exhaust_queue() # Write any remaining DataChunkIterators that have been queued
self._written_builders.set_written(f_builder)
self.logger.debug("Done writing %s '%s' to path '%s'" %
Expand Down Expand Up @@ -559,19 +559,17 @@ def write_group(self, **kwargs):
self.write_link(group, sub_builder, export_source)

attributes = builder.attributes
self.write_attributes(group, attributes, export_source=export_source)
self.write_attributes(group, attributes)
self._written_builders.set_written(builder) # record that the builder has been written
return group

@docval({'name': 'obj', 'type': (Group, Array), 'doc': 'the Zarr object to add attributes to'},
{'name': 'attributes',
'type': dict,
'doc': 'a dict containing the attributes on the Group or Dataset, indexed by attribute name'},
{'name': 'export_source', 'type': str,
'doc': 'The source of the builders when exporting', 'default': None})
'doc': 'a dict containing the attributes on the Group or Dataset, indexed by attribute name'})
def write_attributes(self, **kwargs):
"""Set (i.e., write) the attributes on a given Zarr Group or Array."""
obj, attributes, export_source = getargs('obj', 'attributes', 'export_source', kwargs)
obj, attributes = getargs('obj', 'attributes', kwargs)

for key, value in attributes.items():
# Case 1: list, set, tuple type attributes
Expand Down Expand Up @@ -1134,7 +1132,7 @@ def write_dataset(self, **kwargs): # noqa: C901
else:
dset = self.__scalar_fill__(parent, name, data, options)
if not linked:
self.write_attributes(dset, attributes, export_source)
self.write_attributes(dset, attributes)
# record that the builder has been written
self._written_builders.set_written(builder)
# Exhaust the DataChunkIterator if the dataset was given this way. Note this is a no-op
Expand Down

0 comments on commit 51d8798

Please sign in to comment.