Skip to content

Commit

Permalink
Use zarr.hierarchy.Group for type hints (ref #587)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcompa committed Oct 23, 2023
1 parent fbaf56e commit f5969e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions fractal_tasks_core/lib_ngff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Optional
from typing import Union

import zarr
import zarr.hierarchy
from pydantic import BaseModel
from pydantic import Field
from pydantic import validator
Expand Down Expand Up @@ -422,7 +422,7 @@ def load_NgffWellMeta(zarr_path: str) -> NgffWellMeta:
raise e


def detect_ome_ngff_type(group: zarr.Group) -> str:
def detect_ome_ngff_type(group: zarr.hierarchy.Group) -> str:
"""
Given a Zarr group, find whether it is an OME-NGFF plate, well or image.
Expand Down
10 changes: 5 additions & 5 deletions fractal_tasks_core/lib_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import Union

import anndata as ad
import zarr
import zarr.hierarchy
from anndata.experimental import write_elem
from zarr.errors import ContainsGroupError
from zarr.errors import GroupNotFoundError
Expand All @@ -36,7 +36,7 @@ def open_zarr_group_with_overwrite(
overwrite: bool,
logger: Optional[logging.Logger] = None,
**open_group_kwargs: Any,
) -> zarr.Group:
) -> zarr.hierarchy.Group:
"""
Wrap `zarr.open_group` and add `overwrite` argument.
Expand Down Expand Up @@ -124,7 +124,7 @@ def open_zarr_group_with_overwrite(


def _write_elem_with_overwrite(
group: zarr.Group,
group: zarr.hierarchy.Group,
key: str,
elem: Any,
*,
Expand Down Expand Up @@ -186,7 +186,7 @@ def _write_elem_with_overwrite(


def write_table(
image_group: zarr.Group,
image_group: zarr.hierarchy.Group,
table_name: str,
table: ad.AnnData,
overwrite: bool = False,
Expand Down Expand Up @@ -300,7 +300,7 @@ def write_table(


def prepare_label_group(
image_group: zarr.Group,
image_group: zarr.hierarchy.Group,
label_name: str,
overwrite: bool = False,
label_attrs: Optional[dict[str, Any]] = None,
Expand Down

0 comments on commit f5969e7

Please sign in to comment.