mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
Avoid deprecated use of floats with ngettext
tests/test_cgi.py::TestWsgi::test_application
linkcheck/strformat.py:190: DeprecationWarning: Plural value must be an integer, got float
time_str.append(_n(single, plural, unit) % unit)
This commit is contained in:
parent
f390b7da33
commit
33b21e4bcd
1 changed files with 2 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ Various string utility functions. Note that these functions are not
|
|||
necessarily optimised for large strings, so use with care.
|
||||
"""
|
||||
|
||||
import math
|
||||
import re
|
||||
import textwrap
|
||||
import os
|
||||
|
|
@ -187,7 +188,7 @@ def strduration_long(duration, do_translate=True):
|
|||
else:
|
||||
duration, unit = divmod(duration, divisor)
|
||||
if unit:
|
||||
time_str.append(_n(single, plural, unit) % unit)
|
||||
time_str.append(_n(single, plural, math.ceil(unit)) % unit)
|
||||
time_str.reverse()
|
||||
if len(time_str) > 2:
|
||||
time_str.pop()
|
||||
|
|
|
|||
Loading…
Reference in a new issue