1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2024-11-17 04:39:01 +00:00
dupeguru/base/core/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

43 lines
1.1 KiB
Python

# Created By: Virgil Dupras
# Created On: 2006/03/15
# $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
from hsutil.str import format_time, FT_DECIMAL, format_size
import time
def format_path(p):
return unicode(p[:-1])
def format_timestamp(t, delta):
if delta:
return format_time(t, FT_DECIMAL)
else:
if t > 0:
return time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(t))
else:
return '---'
def format_words(w):
def do_format(w):
if isinstance(w, list):
return '(%s)' % ', '.join(do_format(item) for item in w)
else:
return w.replace('\n', ' ')
return ', '.join(do_format(item) for item in w)
def format_perc(p):
return "%0.0f" % p
def format_dupe_count(c):
return str(c) if c else '---'
def cmp_value(value):
return value.lower() if isinstance(value, basestring) else value