diff --git a/lindi/LindiH5ZarrStore/LindiH5ZarrStore.py b/lindi/LindiH5ZarrStore/LindiH5ZarrStore.py index 82373eb..47f9168 100644 --- a/lindi/LindiH5ZarrStore/LindiH5ZarrStore.py +++ b/lindi/LindiH5ZarrStore/LindiH5ZarrStore.py @@ -69,7 +69,7 @@ def __init__( def from_file( hdf5_file_name_or_url: str, *, - opts: LindiH5ZarrStoreOpts = LindiH5ZarrStoreOpts(), + opts: Union[LindiH5ZarrStoreOpts, None] = None, url: Union[str, None] = None, local_cache: Union[LocalCache, None] = None ): @@ -80,7 +80,7 @@ def from_file( ---------- hdf5_file_name_or_url : str The name of the HDF5 file or a URL to the HDF5 file. - opts : LindiH5ZarrStoreOpts + opts : LindiH5ZarrStoreOpts or None Options for the store. url : str or None If hdf5_file_name_or_url is a local file name, then this can @@ -93,6 +93,8 @@ def from_file( A local cache to use when reading chunks from a remote file. If None, then no local cache is used. """ + if opts is None: + opts = LindiH5ZarrStoreOpts() # default options if hdf5_file_name_or_url.startswith( "http://" ) or hdf5_file_name_or_url.startswith("https://"): diff --git a/lindi/LindiH5ZarrStore/LindiH5ZarrStoreOpts.py b/lindi/LindiH5ZarrStore/LindiH5ZarrStoreOpts.py index 07a3ea8..a99341a 100644 --- a/lindi/LindiH5ZarrStore/LindiH5ZarrStoreOpts.py +++ b/lindi/LindiH5ZarrStore/LindiH5ZarrStoreOpts.py @@ -2,7 +2,7 @@ from dataclasses import dataclass -@dataclass +@dataclass(frozen=True) class LindiH5ZarrStoreOpts: """ Options for the LindiH5ZarrStore class. diff --git a/lindi/LindiH5pyFile/LindiH5pyFile.py b/lindi/LindiH5pyFile/LindiH5pyFile.py index 16baecb..aa891a1 100644 --- a/lindi/LindiH5pyFile/LindiH5pyFile.py +++ b/lindi/LindiH5pyFile/LindiH5pyFile.py @@ -55,7 +55,7 @@ def from_lindi_file(url_or_path: str, *, mode: LindiFileMode = "r", staging_area return LindiH5pyFile.from_reference_file_system(url_or_path, mode=mode, staging_area=staging_area, local_cache=local_cache, local_file_path=local_file_path) @staticmethod - def from_hdf5_file(url_or_path: str, *, mode: LindiFileMode = "r", local_cache: Union[LocalCache, None] = None, zarr_store_opts: LindiH5ZarrStoreOpts = LindiH5ZarrStoreOpts()): + def from_hdf5_file(url_or_path: str, *, mode: LindiFileMode = "r", local_cache: Union[LocalCache, None] = None, zarr_store_opts: Union[LindiH5ZarrStoreOpts, None] = None): """ Create a LindiH5pyFile from a URL or path to an HDF5 file. @@ -68,6 +68,8 @@ def from_hdf5_file(url_or_path: str, *, mode: LindiFileMode = "r", local_cache: h5py.File for more information on the modes, by default "r". local_cache : Union[LocalCache, None], optional The local cache to use for caching data chunks, by default None. + zarr_store_opts : Union[LindiH5ZarrStoreOpts, None], optional + The options to use for the zarr store, by default None. """ from ..LindiH5ZarrStore.LindiH5ZarrStore import LindiH5ZarrStore # avoid circular import if mode != "r":