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

Pass parent properties to extended dataset/attribute #321

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

rly
Copy link
Contributor

@rly rly commented Mar 25, 2020

Fix #320
'dtype', 'shape', 'dims' are passed to extended dataset if not specified
'shape' and 'dims' are passed to extended attribute if not specified

I also added TODOs in the code for testing compatibility between the extended dataset/attribute's dtype/shape/dims with the parent's values. Should we test for those? If so, I will make a separate issue ticket and PR.

e.g., if the parent dataset has dtype 'int', the extending dataset should not be allowed to be defined with dtype 'text'. However, if the parent dataset has dtype 'numeric', the extending dataset should be allowed to refined the dtype to be 'int'.

For shape, I think we should only allow pruning of options, not expansion of options. e.g., if the parent dataset has shape [None], the extending dataset should be allowed to be defined with shape [3] but not [[None], [None, None]].

rly added 2 commits March 24, 2020 19:03
dtype, shape, dims are passed to extended dataset
shape and dims are passed to extended attribute
@codecov
Copy link

codecov bot commented Mar 25, 2020

Codecov Report

Merging #321 into dev will increase coverage by 0.03%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #321      +/-   ##
==========================================
+ Coverage   75.42%   75.46%   +0.03%     
==========================================
  Files          33       33              
  Lines        6646     6664      +18     
  Branches     1452     1462      +10     
==========================================
+ Hits         5013     5029      +16     
  Misses       1229     1229              
- Partials      404      406       +2     
Impacted Files Coverage Δ
src/hdmf/spec/spec.py 74.45% <88.88%> (+0.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 16a1b7a...33efc38. Read the comment docs.

Copy link
Contributor

@ajtritt ajtritt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fill in the TODOs

if self.dtype is None:
self['dtype'] = inc_spec.dtype
else:
# TODO: test whether child dtype is compatible with parent dtype
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add check to make sure child is a subset of parent

if self.shape is None:
self['shape'] = inc_spec.shape
elif inc_spec.shape is not None:
# TODO: test whether child shape is compatible with parent shape
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add check to make sure child is a subset of parent

if my_attribute.shape is None:
my_attribute['shape'] = attribute.shape
else:
# TODO: test whether child shape is compatible with parent shape
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add check to make sure child is a subset of parent

if my_attribute.dims is None:
my_attribute['dims'] = attribute.dims
else:
# TODO: test whether child dims is compatible with parent dims
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add check to make sure child is a subset of parent

@rly rly marked this pull request as draft June 24, 2020 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overridden dataset dtype and shape are not passed from parent to child
2 participants