@@ -540,10 +540,8 @@ class PartialReadBuffer:
540
540
def __init__ (self , store_key , chunk_store ):
541
541
self .chunk_store = chunk_store
542
542
# 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
547
545
self .fs = self .chunk_store .fs
548
546
self .store_key = store_key
549
547
self .key_path = self .map ._key_to_str (store_key )
@@ -555,8 +553,7 @@ def __init__(self, store_key, chunk_store):
555
553
self .read_blocks = set ()
556
554
557
555
def prepare_chunk (self ):
558
- if self .buff :
559
- return
556
+ assert self .buff is None
560
557
header = self .fs .read_block (self .key_path , 0 , 16 )
561
558
nbytes , self .cbytes , blocksize = cbuffer_sizes (header )
562
559
typesize , _shuffle , _memcpyd = cbuffer_metainfo (header )
@@ -582,8 +579,7 @@ def prepare_chunk(self):
582
579
self .n_per_block = blocksize / typesize
583
580
584
581
def read_part (self , start , nitems ):
585
- if not self .buff :
586
- self .prepare_chunk ()
582
+ assert self .buff is not None
587
583
if self .nblocks == 1 :
588
584
return
589
585
blocks_to_decompress = nitems / self .n_per_block
0 commit comments