jorisschellekens / borb

borb is a library for reading, creating and manipulating PDF files in python.
https://borbpdf.com/
Other
3.4k stars 147 forks source link

Mistake use of sorted() #113

Closed zhu1205 closed 2 years ago

zhu1205 commented 2 years ago

Describe the bug Mistake use of sorted() function

To Reproduce please look at the source file borb.toolkit.text.simple_text_extraction.py and go to line no 77 sorted(tris, key=cmp_to_key(LeftToRightComparator.cmp)) this will not make change to tris, sorted() is not list.sort(), it will return an sorted object but not change the object directly.

Expected behaviour tris.sort(key=cmp_to_key(LeftToRightComparator.cmp))

if not want to change tris itself, tris = sorted(tris, key=cmp_to_key(LeftToRightComparator.cmp))

Desktop (please complete the following information):

jorisschellekens commented 2 years ago

Thank you for bringing this to my attention.

This bug is now fixed. My apologies for the delay, I was dealing with a circular import issue which took up a lot of my time.

You may expect the fix for this issue in the upcoming release v.2.0.28

Kind regards, Joris Schellekens