Skip to content

Commit

Permalink
Merge branch 'copy-chunks-to-staging-area' into write-json
Browse files Browse the repository at this point in the history
  • Loading branch information
rly authored May 9, 2024
2 parents 8881179 + 833b3f3 commit 0ea4fb0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 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
2 changes: 1 addition & 1 deletion lindi/LindiH5ZarrStore/LindiH5ZarrStoreOpts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(frozen=True)
class LindiH5ZarrStoreOpts:
"""
Options for the LindiH5ZarrStore class.
Expand Down
4 changes: 3 additions & 1 deletion lindi/LindiH5pyFile/LindiH5pyFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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":
Expand Down

0 comments on commit 0ea4fb0

Please sign in to comment.