diff options
author | 2016-05-18 19:12:14 +0300 | |
---|---|---|
committer | 2016-05-18 19:24:00 +0300 | |
commit | 3eb2d1338ff801bf307996926394e8d043ced98e (patch) | |
tree | dc89056b341cce54387f9a416dbed0c562ba2468 /scripts/automation/trex_control_plane/stl/trex_stl_lib/utils | |
parent | 7e92d155c0d051711aeac1d092fe0a6a55b9104d (diff) |
tui fixes
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py index 72be7c29..7e0bf9e4 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_opts.py @@ -36,18 +36,11 @@ def format_num (size, suffix = "", compact = True, opts = ()): u = '' if compact: - if 0 < abs(size) < 1: - for unit in ['m','u','n','p']: - size *= 1000 - if abs(size) >= 1: - u = unit - break - else: - for unit in ['','K','M','G','T','P']: - if abs(size) < 1000.0: - u = unit - break - size /= 1000.0 + for unit in ['','K','M','G','T','P']: + if abs(size) < 1000.0: + u = unit + break + size /= 1000.0 if isinstance(size, float): txt = "%3.2f" % (size) |