@@ -903,7 +903,7 @@ async def open(
903903 store_path = await make_store_path (store )
904904 metadata_dict = await get_array_metadata (store_path , zarr_format = zarr_format )
905905 # TODO: remove this cast when we have better type hints
906- _metadata_dict = cast (ArrayV3MetadataDict , metadata_dict )
906+ _metadata_dict = cast (" ArrayV3MetadataDict" , metadata_dict )
907907 return cls (store_path = store_path , metadata = _metadata_dict )
908908
909909 @property
@@ -1399,7 +1399,7 @@ async def _set_selection(
13991399 if isinstance (array_like , np ._typing ._SupportsArrayFunc ):
14001400 # TODO: need to handle array types that don't support __array_function__
14011401 # like PyTorch and JAX
1402- array_like_ = cast (np ._typing ._SupportsArrayFunc , array_like )
1402+ array_like_ = cast (" np._typing._SupportsArrayFunc" , array_like )
14031403 value = np .asanyarray (value , dtype = self .metadata .dtype , like = array_like_ )
14041404 else :
14051405 if not hasattr (value , "shape" ):
@@ -1413,7 +1413,7 @@ async def _set_selection(
14131413 value = value .astype (dtype = self .metadata .dtype , order = "A" )
14141414 else :
14151415 value = np .array (value , dtype = self .metadata .dtype , order = "A" )
1416- value = cast (NDArrayLike , value )
1416+ value = cast (" NDArrayLike" , value )
14171417 # We accept any ndarray like object from the user and convert it
14181418 # to a NDBuffer (or subclass). From this point onwards, we only pass
14191419 # Buffer and NDBuffer between components.
@@ -2436,11 +2436,11 @@ def __getitem__(self, selection: Selection) -> NDArrayLikeOrScalar:
24362436 """
24372437 fields , pure_selection = pop_fields (selection )
24382438 if is_pure_fancy_indexing (pure_selection , self .ndim ):
2439- return self .vindex [cast (CoordinateSelection | MaskSelection , selection )]
2439+ return self .vindex [cast (" CoordinateSelection | MaskSelection" , selection )]
24402440 elif is_pure_orthogonal_indexing (pure_selection , self .ndim ):
24412441 return self .get_orthogonal_selection (pure_selection , fields = fields )
24422442 else :
2443- return self .get_basic_selection (cast (BasicSelection , pure_selection ), fields = fields )
2443+ return self .get_basic_selection (cast (" BasicSelection" , pure_selection ), fields = fields )
24442444
24452445 def __setitem__ (self , selection : Selection , value : npt .ArrayLike ) -> None :
24462446 """Modify data for an item or region of the array.
@@ -2535,11 +2535,11 @@ def __setitem__(self, selection: Selection, value: npt.ArrayLike) -> None:
25352535 """
25362536 fields , pure_selection = pop_fields (selection )
25372537 if is_pure_fancy_indexing (pure_selection , self .ndim ):
2538- self .vindex [cast (CoordinateSelection | MaskSelection , selection )] = value
2538+ self .vindex [cast (" CoordinateSelection | MaskSelection" , selection )] = value
25392539 elif is_pure_orthogonal_indexing (pure_selection , self .ndim ):
25402540 self .set_orthogonal_selection (pure_selection , value , fields = fields )
25412541 else :
2542- self .set_basic_selection (cast (BasicSelection , pure_selection ), value , fields = fields )
2542+ self .set_basic_selection (cast (" BasicSelection" , pure_selection ), value , fields = fields )
25432543
25442544 @_deprecate_positional_args
25452545 def get_basic_selection (
@@ -3657,7 +3657,7 @@ def update_attributes(self, new_attributes: dict[str, JSON]) -> Array:
36573657 # TODO: remove this cast when type inference improves
36583658 new_array = sync (self ._async_array .update_attributes (new_attributes ))
36593659 # TODO: remove this cast when type inference improves
3660- _new_array = cast (AsyncArray [ArrayV2Metadata ] | AsyncArray [ArrayV3Metadata ], new_array )
3660+ _new_array = cast (" AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]" , new_array )
36613661 return type (self )(_new_array )
36623662
36633663 def __repr__ (self ) -> str :
@@ -4252,7 +4252,7 @@ async def init_array(
42524252 serializer = serializer ,
42534253 dtype = dtype_parsed ,
42544254 )
4255- sub_codecs = cast (tuple [Codec , ...], (* array_array , array_bytes , * bytes_bytes ))
4255+ sub_codecs = cast (" tuple[Codec, ...]" , (* array_array , array_bytes , * bytes_bytes ))
42564256 codecs_out : tuple [Codec , ...]
42574257 if shard_shape_parsed is not None :
42584258 index_location = None
@@ -4523,7 +4523,7 @@ def _parse_keep_array_attr(
45234523 compressors = "auto"
45244524 if serializer == "keep" :
45254525 if zarr_format == 3 and data .metadata .zarr_format == 3 :
4526- serializer = cast (SerializerLike , data .serializer )
4526+ serializer = cast (" SerializerLike" , data .serializer )
45274527 else :
45284528 serializer = "auto"
45294529 if fill_value is None :
@@ -4701,7 +4701,7 @@ def _parse_chunk_encoding_v3(
47014701 if isinstance (filters , dict | Codec ):
47024702 maybe_array_array = (filters ,)
47034703 else :
4704- maybe_array_array = cast (Iterable [Codec | dict [str , JSON ]], filters )
4704+ maybe_array_array = cast (" Iterable[Codec | dict[str, JSON]]" , filters )
47054705 out_array_array = tuple (_parse_array_array_codec (c ) for c in maybe_array_array )
47064706
47074707 if serializer == "auto" :
@@ -4718,7 +4718,7 @@ def _parse_chunk_encoding_v3(
47184718 if isinstance (compressors , dict | Codec ):
47194719 maybe_bytes_bytes = (compressors ,)
47204720 else :
4721- maybe_bytes_bytes = cast (Iterable [Codec | dict [str , JSON ]], compressors )
4721+ maybe_bytes_bytes = cast (" Iterable[Codec | dict[str, JSON]]" , compressors )
47224722
47234723 out_bytes_bytes = tuple (_parse_bytes_bytes_codec (c ) for c in maybe_bytes_bytes )
47244724
0 commit comments