def block_view(block, header_transform): """View a block with modified output headers Use this function to adjust the output headers of a ring on-the-fly, effectively producing a new 'view' of the block. Args: block (Block): Input block. header_transform (function): A function f(hdr) -> new_hdr. Returns: A new block that acts as the old block but modifies its sequence headers on-the-fly. """ new_block = copy(block) new_block.orings = [ring_view(oring, header_transform) for oring in new_block.orings] return new_block
def block_view(block, header_transform): new_block = copy(block) new_block.orings = [ ring_view(oring, header_transform) for oring in new_block.orings ] return new_block