Skip to content

Commit

Permalink
fix: partial workaround for #238
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Oct 22, 2023
1 parent 267e6fe commit a76b69d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
0.53.4
- fix: partial workaround for #238
- enh: lazy initialization of .RTDCBase.filters
- enh: lazy initialization of .RTDCBase.basins
- enh: lazy loading of feature list for HDF5 data
Expand Down
12 changes: 11 additions & 1 deletion dclab/rtdc_dataset/fmt_hdf5/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,18 @@ def __enter__(self):
return self

def __exit__(self, type, value, tb):
# close the HDF5 file
self.close()

def close(self):
"""Close the underlying HDF5 file"""
# This is a partial workaround for issue #238
# https://github.com/DC-analysis/dclab/issues/238
# TODO: Refactor .RTDCBase with context managers that call `close`.
self.h5file.close()
if self._basins:
for b in self._basins:
if b._ds is not None:
b._ds.close()

@functools.lru_cache()
def __len__(self):
Expand Down

0 comments on commit a76b69d

Please sign in to comment.