@@ -540,10 +540,8 @@ class PartialReadBuffer:
540540 def __init__ (self , store_key , chunk_store ):
541541 self .chunk_store = chunk_store
542542 # is it fsstore or an actual fsspec map object
543- if getattr (self .chunk_store , "map" , None ):
544- self .map = self .chunk_store .map
545- else :
546- self .map = self .chunk_store
543+ assert hasattr (self , chunk_store , "map" )
544+ self .map = self .chunk_store .map
547545 self .fs = self .chunk_store .fs
548546 self .store_key = store_key
549547 self .key_path = self .map ._key_to_str (store_key )
@@ -555,8 +553,7 @@ def __init__(self, store_key, chunk_store):
555553 self .read_blocks = set ()
556554
557555 def prepare_chunk (self ):
558- if self .buff :
559- return
556+ assert self .buff is None
560557 header = self .fs .read_block (self .key_path , 0 , 16 )
561558 nbytes , self .cbytes , blocksize = cbuffer_sizes (header )
562559 typesize , _shuffle , _memcpyd = cbuffer_metainfo (header )
@@ -582,8 +579,7 @@ def prepare_chunk(self):
582579 self .n_per_block = blocksize / typesize
583580
584581 def read_part (self , start , nitems ):
585- if not self .buff :
586- self .prepare_chunk ()
582+ assert self .buff is not None
587583 if self .nblocks == 1 :
588584 return
589585 blocks_to_decompress = nitems / self .n_per_block
0 commit comments