@@ -19,6 +19,7 @@ class SimpleChunkedArray(np.ndarray):
1919 A custom array-like structure that exposes chunks as a simple tuple
2020 instead of a tuple of tuples.
2121 """
22+
2223 def __new__ (cls , input_array , chunks = None ):
2324 obj = np .asarray (input_array ).view (cls )
2425 obj ._chunks = chunks
@@ -56,9 +57,7 @@ def normalize_chunks(
5657 return tuple ((chunk ,) for chunk in chunks )
5758 return chunks or ()
5859
59- def from_array (
60- self , data , chunks : _Chunks , ** kwargs
61- ) -> SimpleChunkedArray :
60+ def from_array (self , data , chunks : _Chunks , ** kwargs ) -> SimpleChunkedArray :
6261 arr = np .asarray (data )
6362 return SimpleChunkedArray (arr , chunks = chunks )
6463
@@ -77,24 +76,28 @@ def store(
7776 if isinstance (sources , list ):
7877 for source , target in zip (sources , targets ):
7978 arr = np .asarray (source )
80- if hasattr (target , '__setitem__' ):
81- regions = kwargs .get ('regions' , [None ] * len (sources ))
82- region = regions [sources .index (source )] if sources .index (source ) < len (regions ) else None
79+ if hasattr (target , "__setitem__" ):
80+ regions = kwargs .get ("regions" , [None ] * len (sources ))
81+ region = (
82+ regions [sources .index (source )]
83+ if sources .index (source ) < len (regions )
84+ else None
85+ )
8386 if region :
8487 target [region ] = arr
8588 else :
8689 target [...] = arr
8790 else :
8891 arr = np .asarray (sources )
89- regions = kwargs .get (' regions' , [None ])
92+ regions = kwargs .get (" regions" , [None ])
9093 region = regions [0 ] if regions else None
9194 if region :
9295 targets [region ] = arr
9396 else :
9497 targets [...] = arr
9598 return None
9699
97- def apply_gufunc (self , * args , ** kwargs ):
100+ def apply_gufunc (self , * args , ** kwargs ):
98101 raise NotImplementedError ("SimpleChunkManager does not support gufunc" )
99102
100103
0 commit comments