Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
i = 0
while i < SEC_ARRAY_LEN:
tmp = SEC_ARRAY[i]
if diff_seconds >= tmp:
i += 1
diff_seconds /= tmp
else:
break
diff_seconds = int(diff_seconds)
i *= 2
if diff_seconds > (i == 0 and 9 or 1):
i += 1
if locale is None:
locale = DEFAULT_LOCALE
tmp = timeago_template(locale, i, ago_in)
if hasattr(tmp, '__call__'):
tmp = tmp(diff_seconds)
return '%s' in tmp and tmp % diff_seconds or tmp