Skip to content

Commit 5e2d09d

Browse files
fix: lint
1 parent 78e0906 commit 5e2d09d

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

  • test_unstructured/partition/pdf_image
  • unstructured/partition/pdf_image

test_unstructured/partition/pdf_image/test_ocr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,9 @@ def test_get_table_tokens(mock_ocr_layout):
489489
def test_get_table_tokens_prefers_extracted_regions_over_ocr(mock_ocr_layout):
490490
extracted_regions = TextRegions.from_list(
491491
[
492-
EmbeddedTextRegion.from_coords(20, 30, 40, 50, text="AUTOSAR Administration", source=None),
492+
EmbeddedTextRegion.from_coords(
493+
20, 30, 40, 50, text="AUTOSAR Administration", source=None
494+
),
493495
EmbeddedTextRegion.from_coords(45, 30, 55, 50, text="2.1.0", source=None),
494496
]
495497
)

unstructured/partition/pdf_image/ocr.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,10 @@ def _get_table_tokens_from_extracted_regions(
427427
return []
428428

429429
# Keep deterministic reading order (top-to-bottom then left-to-right).
430-
sorted_indices = sorted(valid, key=lambda item: (selected_regions.y1[item[0]], selected_regions.x1[item[0]]))
430+
sorted_indices = sorted(
431+
valid,
432+
key=lambda item: (selected_regions.y1[item[0]], selected_regions.x1[item[0]]),
433+
)
431434
table_tokens = []
432435
for span_num, (idx, text) in enumerate(sorted_indices):
433436
x1 = max(0, min(width, int(round(selected_regions.x1[idx] - left))))

0 commit comments

Comments
 (0)