We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 404aaf3 commit 41deff1Copy full SHA for 41deff1
ismrmrd/hdf5.py
@@ -158,7 +158,13 @@ def __del__(self):
158
self.close()
159
except:
160
pass
161
-
+
162
+ def __enter__(self):
163
+ return self
164
165
+ def __exit__(self, exc_type, exc_val, exc_tb):
166
+ self.close()
167
168
@property
169
def _dataset(self):
170
if self._dataset_name not in self._file:
@@ -167,7 +173,7 @@ def _dataset(self):
173
174
def list(self):
175
return self._dataset.keys()
176
171
177
def close(self):
172
178
self._file.close()
179
0 commit comments