__init__ states that users should use the from_* factory methods instead. Who is responsible for closing objects that are being opened there? E.g., in from_zarr_store the factory methods opens the zarr store, but other than the returned LindiH5pyFile object, no-one else has access/owns the file.
For factory methods that require an already opened file to be handed in, I agree, that LINIDI should not just close it. But for cases where LINDI functions open the file (and in particular when the opened file/store is not being exposed to the caller), I think it should be the role of LINDI to close.
__init__
states that users should use thefrom_*
factory methods instead. Who is responsible for closing objects that are being opened there? E.g., infrom_zarr_store
the factory methods opens the zarr store, but other than the returnedLindiH5pyFile
object, no-one else has access/owns the file.https://github.com/NeurodataWithoutBorders/lindi/blob/fe51dbc3aafe7c2a35b392fc93059387e96319a6/lindi/LindiH5pyFile/LindiH5pyFile.py#L52-L59
For factory methods that require an already opened file to be handed in, I agree, that LINIDI should not just close it. But for cases where LINDI functions open the file (and in particular when the opened file/store is not being exposed to the caller), I think it should be the role of LINDI to close.
_Originally posted by @oruebel in https://github.com/NeurodataWithoutBorders/lindi/pull/21#discussion_r1533084286_