some format fixes

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3043 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2006-02-02 22:59:42 +00:00
parent fac0b0f793
commit 902949f27e

View file

@ -154,13 +154,13 @@ def indent (text, indent_string=" "):
def get_line_number (s, index):
"""
Return the line number of s[index]. Lines are assumed to be separated
by the ASCII character '\\n'.
r"""
Return the line number of s[index] or zero on errors.
Lines are assumed to be separated by the ASCII character '\n'.
"""
i = 0
if index < 0:
index = 0
return 0
line = 1
while i < index:
if s[i] == '\n':
@ -207,7 +207,7 @@ def strsize (b):
if b < 1024:
return u"%.2f MB" % b
b /= 1024.0
return u"%.2f GB"
return u"%.2f GB" % b
def strtime (t):
@ -223,13 +223,13 @@ def strduration (duration):
Return translated and formatted time duration.
"""
name = _("seconds")
if duration > 60:
duration = duration / 60
if duration >= 60:
duration /= 60
name = _("minutes")
if duration > 60:
duration = duration / 60
if duration >= 60:
duration /= 60
name = _("hours")
return u" %.3f %s" % (duration, name)
return u"%.3f %s" % (duration, name)
def strtimezone ():