Skip to content

Commit

Permalink
Make sorter functions use python3-comptible method
Browse files Browse the repository at this point in the history
  • Loading branch information
kdm9 committed Aug 7, 2016
1 parent 62e33f4 commit c272a65
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions maildir_deduplicate/deduplicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,18 +319,7 @@ def time_sort(messages, old_to_new):
ctime = os.path.getctime(mail_file)
ctimes.append((ctime, mail_file, message))

def _sort_by_ctime_new_to_old(a, b):
return cmp(b[0], a[0])

def _sort_by_ctime_old_to_new(a, b):
return cmp(a[0], b[0])

# Order from oldest to newest.
if old_to_new:
ctimes.sort(cmp=_sort_by_ctime_old_to_new)
# Order from newest to oldest.
else:
ctimes.sort(cmp=_sort_by_ctime_new_to_old)
ctimes.sort(reverse=old_to_new)

return ctimes

Expand All @@ -343,10 +332,7 @@ def size_sort(cls, messages):
size = len(''.join(body))
sizes.append((size, mail_file, message))

def _sort_by_size(a, b):
return cmp(b[0], a[0])

sizes.sort(cmp=_sort_by_size)
sizes.sort()
return sizes

@staticmethod
Expand Down

0 comments on commit c272a65

Please sign in to comment.