Skip to content

Commit

Permalink
Use None for default zarr store opts
Browse files Browse the repository at this point in the history
  • Loading branch information
magland committed May 9, 2024
1 parent 1105921 commit 833b3f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lindi/LindiH5ZarrStore/LindiH5ZarrStore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand All @@ -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
Expand All @@ -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://"):
Expand Down
4 changes: 3 additions & 1 deletion lindi/LindiH5pyFile/LindiH5pyFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def from_lindi_file(url_or_path: str, *, mode: Literal["r", "r+"] = "r", staging
return LindiH5pyFile.from_reference_file_system(url_or_path, mode=mode, staging_area=staging_area, local_cache=local_cache)

@staticmethod
def from_hdf5_file(url_or_path: str, *, mode: Literal["r", "r+"] = "r", local_cache: Union[LocalCache, None] = None, zarr_store_opts: LindiH5ZarrStoreOpts = LindiH5ZarrStoreOpts()):
def from_hdf5_file(url_or_path: str, *, mode: Literal["r", "r+"] = "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.
Expand All @@ -59,6 +59,8 @@ def from_hdf5_file(url_or_path: str, *, mode: Literal["r", "r+"] = "r", local_ca
supported, 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+':
Expand Down

0 comments on commit 833b3f3

Please sign in to comment.