3434from  zarr .core .attributes  import  Attributes 
3535from  zarr .core .buffer  import  (
3636    BufferPrototype ,
37-     NDArrayLike ,
37+     NDArrayOrScalarLike ,
3838    NDBuffer ,
3939    default_buffer_prototype ,
4040)
@@ -1255,7 +1255,7 @@ async def _get_selection(
12551255        prototype : BufferPrototype ,
12561256        out : NDBuffer  |  None  =  None ,
12571257        fields : Fields  |  None  =  None ,
1258-     ) ->  NDArrayLike :
1258+     ) ->  NDArrayOrScalarLike :
12591259        # check fields are sensible 
12601260        out_dtype  =  check_fields (fields , self .dtype )
12611261
@@ -1305,7 +1305,7 @@ async def getitem(
13051305        selection : BasicSelection ,
13061306        * ,
13071307        prototype : BufferPrototype  |  None  =  None ,
1308-     ) ->  NDArrayLike :
1308+     ) ->  NDArrayOrScalarLike :
13091309        """ 
13101310        Asynchronous function that retrieves a subset of the array's data based on the provided selection. 
13111311
@@ -1318,7 +1318,7 @@ async def getitem(
13181318
13191319        Returns 
13201320        ------- 
1321-         NDArrayLike  
1321+         NDArrayOrScalarLike  
13221322            The retrieved subset of the array's data. 
13231323
13241324        Examples 
@@ -1396,11 +1396,11 @@ async def _set_selection(
13961396            # ), f"shape of value doesn't match indexer shape. Expected {indexer.shape}, got {value.shape}" 
13971397            if  not  hasattr (value , "dtype" ) or  value .dtype .name  !=  self .metadata .dtype .name :
13981398                if  hasattr (value , "astype" ):
1399-                     # Handle things that are already NDArrayLike  more efficiently 
1399+                     # Handle things that are already NDArrayOrScalarLike  more efficiently 
14001400                    value  =  value .astype (dtype = self .metadata .dtype , order = "A" )
14011401                else :
14021402                    value  =  np .array (value , dtype = self .metadata .dtype , order = "A" )
1403-         value  =  cast (NDArrayLike , value )
1403+         value  =  cast (NDArrayOrScalarLike , value )
14041404        # We accept any ndarray like object from the user and convert it 
14051405        # to a NDBuffer (or subclass). From this point onwards, we only pass 
14061406        # Buffer and NDBuffer between components. 
@@ -2260,7 +2260,7 @@ def _iter_chunk_regions(
22602260
22612261    def  __array__ (
22622262        self , dtype : npt .DTypeLike  |  None  =  None , copy : bool  |  None  =  None 
2263-     ) ->  NDArrayLike :
2263+     ) ->  NDArrayOrScalarLike :
22642264        """ 
22652265        This method is used by numpy when converting zarr.Array into a numpy array. 
22662266        For more information, see https://numpy.org/devdocs/user/basics.interoperability.html#the-array-method 
@@ -2278,7 +2278,7 @@ def __array__(
22782278
22792279        return  arr_np 
22802280
2281-     def  __getitem__ (self , selection : Selection ) ->  NDArrayLike :
2281+     def  __getitem__ (self , selection : Selection ) ->  NDArrayOrScalarLike :
22822282        """Retrieve data for an item or region of the array. 
22832283
22842284        Parameters 
@@ -2289,7 +2289,7 @@ def __getitem__(self, selection: Selection) -> NDArrayLike:
22892289
22902290        Returns 
22912291        ------- 
2292-         NDArrayLike  
2292+         NDArrayOrScalarLike  
22932293             An array-like containing the data for the requested region. 
22942294
22952295        Examples 
@@ -2536,7 +2536,7 @@ def get_basic_selection(
25362536        out : NDBuffer  |  None  =  None ,
25372537        prototype : BufferPrototype  |  None  =  None ,
25382538        fields : Fields  |  None  =  None ,
2539-     ) ->  NDArrayLike :
2539+     ) ->  NDArrayOrScalarLike :
25402540        """Retrieve data for an item or region of the array. 
25412541
25422542        Parameters 
@@ -2554,7 +2554,7 @@ def get_basic_selection(
25542554
25552555        Returns 
25562556        ------- 
2557-         NDArrayLike  
2557+         NDArrayOrScalarLike  
25582558            An array-like containing the data for the requested region. 
25592559
25602560        Examples 
@@ -2756,7 +2756,7 @@ def get_orthogonal_selection(
27562756        out : NDBuffer  |  None  =  None ,
27572757        fields : Fields  |  None  =  None ,
27582758        prototype : BufferPrototype  |  None  =  None ,
2759-     ) ->  NDArrayLike :
2759+     ) ->  NDArrayOrScalarLike :
27602760        """Retrieve data by making a selection for each dimension of the array. For 
27612761        example, if an array has 2 dimensions, allows selecting specific rows and/or 
27622762        columns. The selection for each dimension can be either an integer (indexing a 
@@ -2778,7 +2778,7 @@ def get_orthogonal_selection(
27782778
27792779        Returns 
27802780        ------- 
2781-         NDArrayLike  
2781+         NDArrayOrScalarLike  
27822782            An array-like containing the data for the requested selection. 
27832783
27842784        Examples 
@@ -2992,7 +2992,7 @@ def get_mask_selection(
29922992        out : NDBuffer  |  None  =  None ,
29932993        fields : Fields  |  None  =  None ,
29942994        prototype : BufferPrototype  |  None  =  None ,
2995-     ) ->  NDArrayLike :
2995+     ) ->  NDArrayOrScalarLike :
29962996        """Retrieve a selection of individual items, by providing a Boolean array of the 
29972997        same shape as the array against which the selection is being made, where True 
29982998        values indicate a selected item. 
@@ -3012,7 +3012,7 @@ def get_mask_selection(
30123012
30133013        Returns 
30143014        ------- 
3015-         NDArrayLike  
3015+         NDArrayOrScalarLike  
30163016            An array-like containing the data for the requested selection. 
30173017
30183018        Examples 
@@ -3154,7 +3154,7 @@ def get_coordinate_selection(
31543154        out : NDBuffer  |  None  =  None ,
31553155        fields : Fields  |  None  =  None ,
31563156        prototype : BufferPrototype  |  None  =  None ,
3157-     ) ->  NDArrayLike :
3157+     ) ->  NDArrayOrScalarLike :
31583158        """Retrieve a selection of individual items, by providing the indices 
31593159        (coordinates) for each selected item. 
31603160
@@ -3172,7 +3172,7 @@ def get_coordinate_selection(
31723172
31733173        Returns 
31743174        ------- 
3175-         NDArrayLike  
3175+         NDArrayOrScalarLike  
31763176            An array-like containing the data for the requested coordinate selection. 
31773177
31783178        Examples 
@@ -3325,7 +3325,7 @@ def set_coordinate_selection(
33253325            value  =  np .array (value ).reshape (- 1 )
33263326
33273327        if  not  is_scalar (value , self .dtype ) and  (
3328-             isinstance (value , NDArrayLike ) and  indexer .shape  !=  value .shape 
3328+             isinstance (value , NDArrayOrScalarLike ) and  indexer .shape  !=  value .shape 
33293329        ):
33303330            raise  ValueError (
33313331                f"Attempting to set a selection of { indexer .sel_shape [0 ]}   " 
@@ -3342,7 +3342,7 @@ def get_block_selection(
33423342        out : NDBuffer  |  None  =  None ,
33433343        fields : Fields  |  None  =  None ,
33443344        prototype : BufferPrototype  |  None  =  None ,
3345-     ) ->  NDArrayLike :
3345+     ) ->  NDArrayOrScalarLike :
33463346        """Retrieve a selection of individual items, by providing the indices 
33473347        (coordinates) for each selected item. 
33483348
@@ -3360,7 +3360,7 @@ def get_block_selection(
33603360
33613361        Returns 
33623362        ------- 
3363-         NDArrayLike  
3363+         NDArrayOrScalarLike  
33643364            An array-like containing the data for the requested block selection. 
33653365
33663366        Examples 
0 commit comments