Skip to content

Commit d7fc5a0

Browse files
committed
formatting
1 parent ae8f1a1 commit d7fc5a0

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

test_unstructured/partition/pdf_image/test_merge_elements.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
from PIL import Image
2-
2+
from unstructured_inference.constants import IsExtracted
3+
from unstructured_inference.inference.elements import Rectangle
34
from unstructured_inference.inference.layout import DocumentLayout, PageLayout
45
from unstructured_inference.inference.layoutelement import LayoutElement, LayoutElements
5-
from unstructured_inference.inference.elements import Rectangle
6-
from unstructured.partition.pdf_image.pdfminer_processing import merge_inferred_with_extracted_layout
7-
from unstructured_inference.constants import IsExtracted
6+
7+
from unstructured.partition.pdf_image.pdfminer_processing import (
8+
merge_inferred_with_extracted_layout,
9+
)
10+
811

912
def test_text_source_preserved_during_merge():
1013
"""Test that text_source property is preserved when elements are merged."""

test_unstructured/partition/pdf_image/test_pdfminer_processing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import pytest
55
from pdfminer.layout import LAParams
66
from PIL import Image
7-
from unstructured_inference.constants import Source as InferenceSource, IsExtracted
7+
from unstructured_inference.constants import IsExtracted
8+
from unstructured_inference.constants import Source as InferenceSource
89
from unstructured_inference.inference.elements import (
910
EmbeddedTextRegion,
1011
Rectangle,

unstructured/partition/pdf_image/pdfminer_processing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ def _merge_extracted_into_inferred_when_almost_the_same(
128128
extracted_to_remove = extracted_layout.slice(extracted_almost_the_same_as_inferred)
129129
# copy here in case we change the extracted layout later
130130
inferred_layout.texts[inferred_indices_to_update] = extracted_to_remove.texts.copy()
131-
inferred_layout.is_extracted_array[inferred_indices_to_update] = extracted_to_remove.is_extracted_array.copy()
131+
inferred_layout.is_extracted_array[inferred_indices_to_update] = (
132+
extracted_to_remove.is_extracted_array.copy()
133+
)
132134
# use coords that can bound BOTH the inferred and extracted region as final bounding box coords
133135
inferred_layout.element_coords[inferred_indices_to_update] = _minimum_containing_coords(
134136
inferred_layout.slice(inferred_indices_to_update),

0 commit comments

Comments
 (0)