"examples/vscode:/vscode.git/clone" did not exist on "3a2a5031e97031061674b22f91a2a328eda73718"
Commit 306fad2c authored by Jun Kim's avatar Jun Kim Committed by GitHub
Browse files

im2txt: make python3 compatible adding lt and eq

__cmp__ is deprecated on python3, so it fails to compare class Caption on python3
parent bfa1bb1b
...@@ -54,6 +54,16 @@ class Caption(object): ...@@ -54,6 +54,16 @@ class Caption(object):
return -1 return -1
else: else:
return 1 return 1
# for version 3 compatibility (__cmp__ is deprecated)
def __lt__(self, other):
assert isinstance(other, Caption)
return self.score < other.score
# also for version 3 compatibility
def __eq__(self, other):
assert isinstance(other, Caption)
return self.score == other.score
class TopN(object): class TopN(object):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment