1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 22:51:39 +00:00

Removed code duplication among editions in sorting algorithms.

This commit is contained in:
Virgil Dupras
2012-03-16 14:57:21 -04:00
parent 80ff5f64f7
commit 771f22f208
4 changed files with 25 additions and 61 deletions

View File

@@ -8,7 +8,7 @@
from hscommon.util import format_size
from core.app import (DupeGuru as DupeGuruBase, format_timestamp, format_perc,
format_words, format_dupe_count, cmp_value)
format_words, format_dupe_count)
from core import prioritize
from . import __appname__
from .result_table import ResultTable
@@ -42,24 +42,6 @@ class DupeGuru(DupeGuruBase):
'dupe_count': format_dupe_count(dupe_count),
}
def _get_dupe_sort_key(self, dupe, get_group, key, delta):
if key == 'percentage':
m = get_group().get_match_of(dupe)
return m.percentage
if key == 'dupe_count':
return 0
r = cmp_value(dupe, key)
if delta and (key in self.result_table.DELTA_COLUMNS):
r -= cmp_value(get_group().ref, key)
return r
def _get_group_sort_key(self, group, key):
if key == 'percentage':
return group.percentage
if key == 'dupe_count':
return len(group)
return cmp_value(group.ref, key)
def _prioritization_categories(self):
return prioritize.all_categories()