1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2024-11-17 04:39:01 +00:00
dupeguru/base/core/tests/data.py
hsoft 1e18a08998 Renamed base/py to base/core
--HG--
rename : base/py/LICENSE => base/core/LICENSE
rename : base/py/__init__.py => base/core/__init__.py
rename : base/py/app.py => base/core/app.py
rename : base/py/app_cocoa.py => base/core/app_cocoa.py
rename : base/py/data.py => base/core/data.py
rename : base/py/directories.py => base/core/directories.py
rename : base/py/engine.py => base/core/engine.py
rename : base/py/export.py => base/core/export.py
rename : base/py/fs.py => base/core/fs.py
rename : base/py/ignore.py => base/core/ignore.py
rename : base/py/results.py => base/core/results.py
rename : base/py/scanner.py => base/core/scanner.py
rename : base/py/tests/__init__.py => base/core/tests/__init__.py
rename : base/py/tests/app_cocoa_test.py => base/core/tests/app_cocoa_test.py
rename : base/py/tests/app_test.py => base/core/tests/app_test.py
rename : base/py/tests/data.py => base/core/tests/data.py
rename : base/py/tests/directories_test.py => base/core/tests/directories_test.py
rename : base/py/tests/engine_test.py => base/core/tests/engine_test.py
rename : base/py/tests/ignore_test.py => base/core/tests/ignore_test.py
rename : base/py/tests/results_test.py => base/core/tests/results_test.py
rename : base/py/tests/scanner_test.py => base/core/tests/scanner_test.py
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40276
2009-12-30 10:23:59 +00:00

45 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Created By: Virgil Dupras
# Created On: 2009-10-23
# $Id$
# Copyright 2009 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "HS" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/hs_license
# data module for tests
from hsutil.str import format_size
from dupeguru.data import format_path, cmp_value
COLUMNS = [
{'attr':'name','display':'Filename'},
{'attr':'path','display':'Directory'},
{'attr':'size','display':'Size (KB)'},
{'attr':'extension','display':'Kind'},
]
METADATA_TO_READ = ['size']
def GetDisplayInfo(dupe, group, delta):
size = dupe.size
m = group.get_match_of(dupe)
if m and delta:
r = group.ref
size -= r.size
return [
dupe.name,
format_path(dupe.path),
format_size(size, 0, 1, False),
dupe.extension,
]
def GetDupeSortKey(dupe, get_group, key, delta):
r = cmp_value(getattr(dupe, COLUMNS[key]['attr']))
if delta and (key == 2):
r -= cmp_value(getattr(get_group().ref, COLUMNS[key]['attr']))
return r
def GetGroupSortKey(group, key):
return cmp_value(getattr(group.ref, COLUMNS[key]['attr']))