11from __future__ import annotations
22
33import hashlib
4+ from collections .abc import Generator , Mapping
45from types import MappingProxyType
5- from typing import Dict , Generator , List , Mapping , Optional , Union
6+ from typing import Optional , Union
67
78import pyarrow as pa
89import zarr
@@ -110,7 +111,7 @@ def __init__(
110111 ) -> None :
111112
112113 if images is not None :
113- self ._images : Dict [str , Union [SpatialImage , MultiscaleSpatialImage ]] = {}
114+ self ._images : dict [str , Union [SpatialImage , MultiscaleSpatialImage ]] = {}
114115 for k , v in images .items ():
115116 ndim = len (get_dims (v ))
116117 if ndim == 3 :
@@ -123,7 +124,7 @@ def __init__(
123124 raise ValueError ("Only czyx and cyx images supported" )
124125
125126 if labels is not None :
126- self ._labels : Dict [str , Union [SpatialImage , MultiscaleSpatialImage ]] = {}
127+ self ._labels : dict [str , Union [SpatialImage , MultiscaleSpatialImage ]] = {}
127128 for k , v in labels .items ():
128129 ndim = len (get_dims (v ))
129130 if ndim == 2 :
@@ -136,19 +137,19 @@ def __init__(
136137 raise ValueError (f"Invalid label dimensions: { ndim } " )
137138
138139 if polygons is not None :
139- self ._polygons : Dict [str , GeoDataFrame ] = {}
140+ self ._polygons : dict [str , GeoDataFrame ] = {}
140141 for k , v in polygons .items ():
141142 Polygon_s .validate (v )
142143 self ._polygons [k ] = v
143144
144145 if shapes is not None :
145- self ._shapes : Dict [str , AnnData ] = {}
146+ self ._shapes : dict [str , AnnData ] = {}
146147 for k , v in shapes .items ():
147148 Shape_s .validate (v )
148149 self ._shapes [k ] = v
149150
150151 if points is not None :
151- self ._points : Dict [str , pa .Table ] = {}
152+ self ._points : dict [str , pa .Table ] = {}
152153 for k , v in points .items ():
153154 Point_s .validate (v )
154155 self ._points [k ] = v
@@ -160,7 +161,7 @@ def __init__(
160161 def write (
161162 self ,
162163 file_path : str ,
163- storage_options : Optional [Union [JSONDict , List [JSONDict ]]] = None ,
164+ storage_options : Optional [Union [JSONDict , list [JSONDict ]]] = None ,
164165 ) -> None :
165166 """Write to Zarr file."""
166167
@@ -249,7 +250,7 @@ def shapes(self) -> Mapping[str, AnnData]:
249250 """Return shapes as a mapping of name to shape data."""
250251 return self ._shapes
251252
252- def _non_empty_elements (self ) -> List [str ]:
253+ def _non_empty_elements (self ) -> list [str ]:
253254 """Get the names of the elements that are not empty.
254255
255256 Returns
0 commit comments