def textract_block_to_block()

in src/pre_human_task_lambda.py [0:0]


def textract_block_to_block(page, tb, index, parent_index=-1):
    """Return a block object from a Textract block object."""
    textract_block_bounding_box = tb['Geometry']['BoundingBox']
    block = Block(page, tb['BlockType'], tb['Text'], index,
                  Geometry(textract_block_bounding_box['Width'], textract_block_bounding_box['Height'],
                  textract_block_bounding_box['Left'], textract_block_bounding_box['Top']))
    block.Id = tb['Id']
    block.Relationships = [] if 'Relationships' not in tb else [textract_block_to_block_relationship(tb['Relationships'])]
    block.parentBlockIndex = parent_index
    return block