more lintian fixes

-mostly lines with length > 79
This commit is contained in:
Martin Konecny 2013-05-16 17:37:01 -04:00
parent d0a0487840
commit e51e046dd0
11 changed files with 162 additions and 113 deletions

View file

@ -12,16 +12,19 @@
import re
def version_cmp(version1, version2):
"""Compare version strings such as 1.1.1, and 1.1.2. Returns the same as
Python built-in cmp. That is return value is negative if x < y, zero if
x == y and strictly positive if x > y."""
def normalize(v):
return [int(x) for x in re.sub(r'(\.0+)*$','', v).split(".")]
return cmp(normalize(version1), normalize(version2))
def date_interval_to_seconds(interval):
"""
Convert timedelta object into int representing the number of seconds. If
number of seconds is less than 0, then return 0.
"""
seconds = (interval.microseconds + \
(interval.seconds + interval.days * 24 * 3600) * 10 ** 6) / float(10 ** 6)
"""Convert timedelta object into int representing the number of seconds. If
number of seconds is less than 0, then return 0."""
seconds = ((interval.microseconds +
(interval.seconds + interval.days * 24 * 3600) * 10 ** 6)
/ float(10 ** 6))
return seconds