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

Add doc to H5DataIO.dataset setter #1154

Merged
merged 5 commits into from
Jul 26, 2024
Merged

Add doc to H5DataIO.dataset setter #1154

merged 5 commits into from
Jul 26, 2024

Conversation

rly
Copy link
Contributor

@rly rly commented Jul 26, 2024

Motivation

While reading through the code for H5DataIO, I was confused about the purpose of the dataset property and how it differs from data since it is not used locally:

self.__dataset = None
@property
def dataset(self):
return self.__dataset
@dataset.setter
def dataset(self, val):
if self.__dataset is not None:
raise ValueError("Cannot overwrite H5DataIO.dataset")
self.__dataset = val

It turns out dataset was added for a very specific use case where a user wants to create an empty hdf5 dataset, write it to disk, and have access to the handle to that dataset without having to close and reopen the file -- #747

To prevent myself and others from retracing those steps to understand this code, I added a docstring.

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Does the PR clearly describe the problem and the solution?
  • Have you reviewed our Contributing Guide?
  • Does the PR use "Fix #XXX" notation to tell GitHub to close the relevant issue numbered XXX when the PR is merged?

Copy link

codecov bot commented Jul 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.83%. Comparing base (dfb1df7) to head (b95ae85).
Report is 27 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1154   +/-   ##
=======================================
  Coverage   88.83%   88.83%           
=======================================
  Files          45       45           
  Lines        9784     9784           
  Branches     2779     2779           
=======================================
  Hits         8692     8692           
  Misses        776      776           
  Partials      316      316           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rly rly merged commit 77be0cc into dev Jul 26, 2024
29 checks passed
@rly rly deleted the rly-patch-2 branch July 26, 2024 17:25
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.

2 participants