[Feature]: Add function to reset a field to None #1029
Labels
category: enhancement
improvements of code or code behavior
priority: low
alternative solution already working and/or relevant to only specific user(s)
What would you like to see added to HDMF?
AbstractContainer.reset_parent
andLabelledDict.pop
allow users to remove objects from aMultiContainerInterface
, which is useful during modification and export of an NWB file. However, child objects that are not in aLabelledDict
, e.g.,NWBFile.units
cannot be removed this way. The workaround is to do:This is not ideal, because we normally discourage users from tampering with the
fields
attribute.What solution would you like?
Perhaps
reset_parent
should look into the parent object and if it is in the parent object in thefields
dictionary, then reset the value infields
.Or perhaps even more intuitively, simply allow
nwbfile.units = None
which would handle resetting the value infields
(if it is allowed to be None) and callnwbfile.units.reset_parent()
. This is related to #868Do you have any interest in helping implement the feature?
Yes.
The text was updated successfully, but these errors were encountered: