From: Brian Warner Date: Sun, 22 Oct 2006 03:39:12 +0000 (-0700) Subject: emit tables up to 1TiB X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~553 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/file/URI:LIT:krugkidfnzsc4/about.html?a=commitdiff_plain;h=60e583ed0af4fdac09d86bc231279e407ce91ef1;p=tahoe-lafs%2Ftahoe-lafs.git emit tables up to 1TiB --- diff --git a/sizes.py b/sizes.py index cf19b076..39d83928 100644 --- a/sizes.py +++ b/sizes.py @@ -33,6 +33,7 @@ KiB=1024 MiB=1024*KiB GiB=1024*MiB TiB=1024*GiB +PiB=1024*TiB class Sizes: def __init__(self, mode, file_size, arity=2): @@ -138,14 +139,16 @@ def fmt(num, trim=False): s = "%.2fM" % (num / MiB) elif num < TiB: s = "%.2fG" % (num / GiB) + elif num < PiB: + s = "%.2fT" % (num / TiB) else: s = "big" if trim: - s = re.sub(r'(\.0+)([kMG#])', + s = re.sub(r'(\.0+)([kMGT#])', lambda m: m.group(2), s) else: - s = re.sub(r'(\.0+)([kMG#])', + s = re.sub(r'(\.0+)([kMGT#])', lambda m: (" "*len(m.group(1))+m.group(2)), s) if s.endswith("#"): @@ -163,7 +166,7 @@ def text(): print "Size blocksize overhead overhead k d alacrity" print " (bytes) (%)" print "------- ------- -------- -------- ---- -- --------" - sizes = [2 ** i for i in range(7, 32)] + sizes = [2 ** i for i in range(7, 41)] for file_size in sizes: s = Sizes(mode, file_size, arity) out = ""