@@ -85,7 +85,10 @@ def create_store(self) -> BaseStore:
85
85
def create_chunk_store (self ) -> Optional [BaseStore ]:
86
86
return None
87
87
88
- def create_storage_transformers (self , shape ) -> Tuple [Any , ...]:
88
+ def create_storage_transformers (self , shape : Union [int , Tuple [int , ...]]) -> Tuple [Any , ...]:
89
+ return ()
90
+
91
+ def create_filters (self , dtype : Optional [str ]) -> Tuple [Any , ...]:
89
92
return ()
90
93
91
94
def create_array (self , shape : Union [int , Tuple [int , ...]], ** kwargs ):
@@ -94,9 +97,10 @@ def create_array(self, shape: Union[int, Tuple[int, ...]], **kwargs):
94
97
# keyword arguments for array initialization
95
98
init_array_kwargs = {
96
99
"path" : kwargs .pop ("path" , self .path ),
97
- "compressor" : self .compressor ,
100
+ "compressor" : kwargs . pop ( "compressor" , self .compressor ) ,
98
101
"chunk_store" : chunk_store ,
99
102
"storage_transformers" : self .create_storage_transformers (shape ),
103
+ "filters" : kwargs .pop ("filters" , self .create_filters (kwargs .get ("dtype" , None )))
100
104
}
101
105
102
106
# keyword arguments for array instantiation
@@ -109,6 +113,7 @@ def create_array(self, shape: Union[int, Tuple[int, ...]], **kwargs):
109
113
"partial_decompress" : kwargs .pop ("partial_decompress" , self .partial_decompress ),
110
114
"write_empty_chunks" : kwargs .pop ("write_empty_chunks" , self .write_empty_chunks ),
111
115
}
116
+
112
117
init_array (store , shape , ** {** init_array_kwargs , ** kwargs })
113
118
114
119
return Array (store , ** access_array_kwargs )
@@ -2164,33 +2169,11 @@ class TestArrayWithFilters(TestArray):
2164
2169
2165
2170
compressor = Zlib (1 )
2166
2171
2167
- def create_array (self , shape : Union [int , Tuple [int , ...]], ** kwargs ):
2168
-
2169
- store = self .create_store ()
2170
- chunk_store = self .create_chunk_store ()
2171
- dtype = kwargs .get ("dtype" , None )
2172
- filters = [
2172
+ def create_filters (self , dtype : Optional [str ]) -> Tuple [Any , ...]:
2173
+ return (
2173
2174
Delta (dtype = dtype ),
2174
2175
FixedScaleOffset (dtype = dtype , scale = 1 , offset = 0 ),
2175
- ]
2176
- init_array_kwargs = {
2177
- "path" : kwargs .pop ("path" , self .path ),
2178
- "compressor" : self .compressor ,
2179
- "chunk_store" : chunk_store ,
2180
- "filters" : filters ,
2181
- }
2182
-
2183
- access_array_kwargs = {
2184
- "path" : init_array_kwargs ["path" ],
2185
- "read_only" : kwargs .pop ("read_only" , self .read_only ),
2186
- "chunk_store" : chunk_store ,
2187
- "cache_metadata" : kwargs .pop ("cache_metadata" , self .cache_metadata ),
2188
- "cache_attrs" : kwargs .pop ("cache_attrs" , self .cache_attrs ),
2189
- "write_empty_chunks" : kwargs .pop ("write_empty_chunks" , self .write_empty_chunks ),
2190
- }
2191
- init_array (store , shape , ** {** init_array_kwargs , ** kwargs })
2192
-
2193
- return Array (store , ** access_array_kwargs )
2176
+ )
2194
2177
2195
2178
def expected (self ):
2196
2179
return [
0 commit comments