Layout-Parser / layout-parser

A Unified Toolkit for Deep Learning Based Document Image Analysis
https://layout-parser.github.io/
Apache License 2.0
4.67k stars 449 forks source link

TypeError: 'inplace' is an invalid keyword argument for sort() #161

Open talhaanwarch opened 1 year ago

talhaanwarch commented 1 year ago

The documentation at this link is throwing an error .

TypeError: 'inplace' is an invalid keyword argument for sort()

The line which is throwing this error is

right_blocks = [b for b in text_blocks if b not in left_blocks]
right_blocks.sort(key = lambda b:b.coordinates[1], inplace=True)

Basically the sort function which take inplace parameter is layoutparser element as in case of left_block. right_block is a list and list sort dont have inplace parameter.

The right way to do is as follow

right_blocks=sorted(right_blocks,key = lambda b:b.coordinates[1])
Mukilan-Krishnakumar commented 10 months ago

Thanks a ton @talhaanwarch, I was looking around the internet for this.