Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore spontaneous mypy errors for h5py classes. ref #324 #328

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions virtualizarr/readers/hdf/hdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@

h5py = soft_import("h5py", "For reading hdf files", strict=False)
if h5py:
Dataset = h5py.Dataset
Group = h5py.Group
Dataset = h5py.Dataset # type: ignore
Group = h5py.Group # type: ignore
else:
Dataset = dict()
Group = dict()
Dataset = dict() # type: ignore
Group = dict() # type: ignore


class HDFVirtualBackend(VirtualBackend):
Expand Down Expand Up @@ -183,14 +183,14 @@ def _dataset_dims(dataset: Dataset) -> Union[List[str], List[None]]:
rank = len(dataset.shape)
if rank:
for n in range(rank):
num_scales = len(dataset.dims[n])
num_scales = len(dataset.dims[n]) # type: ignore
if num_scales == 1:
dims.append(dataset.dims[n][0].name[1:])
dims.append(dataset.dims[n][0].name[1:]) # type: ignore
elif h5py.h5ds.is_scale(dataset.id):
dims.append(dataset.name[1:])
elif num_scales > 1:
raise ValueError(
f"{dataset.name}: {len(dataset.dims[n])} "
f"{dataset.name}: {len(dataset.dims[n])} " # type: ignore
f"dimension scales attached to dimension #{n}"
)
elif num_scales == 0:
Expand Down Expand Up @@ -287,7 +287,7 @@ def _dataset_to_variable(path: str, dataset: Dataset) -> Optional[Variable]:
fill_value = fill_value.item()
filters = [codec.get_config() for codec in codecs]
zarray = ZArray(
chunks=chunks,
chunks=chunks, # type: ignore
compressor=None,
dtype=dtype,
fill_value=fill_value,
Expand Down
Loading