mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-22 23:24:44 +00:00
Replace deprecated locale.format()
locale.format_string() was introduced in Python 2.5.
This commit is contained in:
parent
5d26d2d93e
commit
ce1dd55d7a
1 changed files with 7 additions and 7 deletions
|
|
@ -190,18 +190,18 @@ def strsize (b, grouping=True):
|
|||
if b < 0:
|
||||
raise ValueError("Invalid negative byte number")
|
||||
if b < 1024:
|
||||
return u"%sB" % locale.format("%d", b, grouping)
|
||||
return u"%sB" % locale.format_string("%d", b, grouping)
|
||||
if b < 1024 * 10:
|
||||
return u"%sKB" % locale.format("%d", (b // 1024), grouping)
|
||||
return u"%sKB" % locale.format_string("%d", (b // 1024), grouping)
|
||||
if b < 1024 * 1024:
|
||||
return u"%sKB" % locale.format("%.2f", (float(b) / 1024), grouping)
|
||||
return u"%sKB" % locale.format_string("%.2f", (float(b) / 1024), grouping)
|
||||
if b < 1024 * 1024 * 10:
|
||||
return u"%sMB" % locale.format("%.2f", (float(b) / (1024*1024)), grouping)
|
||||
return u"%sMB" % locale.format_string("%.2f", (float(b) / (1024*1024)), grouping)
|
||||
if b < 1024 * 1024 * 1024:
|
||||
return u"%sMB" % locale.format("%.1f", (float(b) / (1024*1024)), grouping)
|
||||
return u"%sMB" % locale.format_string("%.1f", (float(b) / (1024*1024)), grouping)
|
||||
if b < 1024 * 1024 * 1024 * 10:
|
||||
return u"%sGB" % locale.format("%.2f", (float(b) / (1024*1024*1024)), grouping)
|
||||
return u"%sGB" % locale.format("%.1f", (float(b) / (1024*1024*1024)), grouping)
|
||||
return u"%sGB" % locale.format_string("%.2f", (float(b) / (1024*1024*1024)), grouping)
|
||||
return u"%sGB" % locale.format_string("%.1f", (float(b) / (1024*1024*1024)), grouping)
|
||||
|
||||
|
||||
def strtime (t, func=time.localtime):
|
||||
|
|
|
|||
Loading…
Reference in a new issue