hdmf
hdmf copied to clipboard
Allow reassigning and resetting AbstractContainer attributes/fields
Motivation
Fix #411, fix #865
Major change to allow setting attributes on Container objects to new values, including None. If the attributes were read from a file (i.e. container_source is not None
), then a warning is raised.
Note that we currently do a lot of validation at the constructor level (type validation, shape validation) in docval. We do not do that for each setter. This can result in errors on write if the user is not careful. We could instead move validation of attributes to outside of docval and into the setter. That is significantly more development, but I think worthwhile in the long run. I will open a separate issue for this.
Checklist
- [x] Did you update CHANGELOG.md with your changes?
- [x] Have you checked our Contributing document?
- [x] Have you ensured the PR clearly describes the problem and the solution?
- [x] Is your contribution compliant with our coding style? This can be checked running
ruff
from the source directory. - [x] Have you checked to ensure that there aren't other open Pull Requests for the same change?
- [x] Have you included the relevant issue number using "Fix #XXX" notation where XXX is the issue number? By including "Fix #XXX" you allow GitHub to close issue #XXX when the PR is merged.