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
......@@ -55,6 +55,16 @@ class Caption(object):
else:
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):
"""Maintains the top n elements of an incrementally provided set."""
......
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