def write(self, bl, **kargs):
if Block in self.writeable_objects:
if isinstance(bl, collections.Sequence):
assert hasattr(self, 'write_all_blocks'), \
'%s does not offer to store a sequence of blocks' % \
self.__class__.__name__
self.write_all_blocks(bl, **kargs)
else:
self.write_block(bl, **kargs)
elif Segment in self.writeable_objects:
assert len(bl.segments) == 1, \
'%s is based on segment so if you try to write a block it ' + \
'must contain only one Segment' % self.__class__.__name__
self.write_segment(bl.segments[0], **kargs)
else:
raise NotImplementedError
######## All individual read methods #######################
评论列表
文章目录