Skip to content

Commit 0e4da68

Browse files
committed
Fix sort_page_element. ensures that sorting is stable and not random.
1 parent c6b8ed4 commit 0e4da68

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
### Features
66

77
### Fixes
8+
- The sort_page_element() use the element id to sort the elements.
9+
Two executions of the same code, on the same file, produce different results. The order of the elements is random.
10+
This makes it impossible to write stable unit tests, for example, or to obtain reproducible results.
811

912
## 0.17.5
1013

unstructured/partition/utils/sorting.py

-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ def _coords_ok(strict_points: bool):
179179
key=lambda el: (
180180
el.metadata.coordinates.points[0][1] if el.metadata.coordinates else float("inf"),
181181
el.metadata.coordinates.points[0][0] if el.metadata.coordinates else float("inf"),
182-
el.id,
183182
),
184183
)
185184
else:

0 commit comments

Comments
 (0)