Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent references not set for obj.metadata #460

Closed
achilleas-k opened this issue Apr 29, 2020 · 0 comments · Fixed by #462
Closed

Parent references not set for obj.metadata #460

achilleas-k opened this issue Apr 29, 2020 · 0 comments · Fixed by #462
Labels

Comments

@achilleas-k
Copy link
Member

When accessing an object's metadata, the _parent reference is never set. See the Block.metadata property for example:

return Section(None, self._h5group.open_group("metadata"))

Objects accessed through a Container, on the other hand, always get instantiated with a parent reference:

return self._itemclass(self._parent, item)

This causes issues when attempting to traverse the parent chain:

nixpy/nixio/entity.py

Lines 108 to 115 in 9b63d54

def definition(self, d):
util.check_attr_type(d, str)
self._h5group.set_attr("definition", d)
par = self._parent
while isinstance(par, Entity):
par = par._parent
if par.time_auto_update:
self.force_updated_at()

We either need to make metadata Section instantiation always set the parent or have a dynamic way of creating the parent link when it's missing.

This is the source of the bug in a recent Neo PR:
NeuralEnsemble/python-neo#806

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant