diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-01-16 10:32:48 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-01-16 10:32:48 +0100 |
commit | b1d0512f0e20b709858151818ddc508fd00dfe4a (patch) | |
tree | 92b8d774376184c0d6f1e91484a63c85be563153 /alot/helper.py | |
parent | f0b24807e42ad95395a3885775cb1ee3322571a6 (diff) |
helper: move humanize_size to the only place where it is used
Diffstat (limited to 'alot/helper.py')
-rw-r--r-- | alot/helper.py | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/alot/helper.py b/alot/helper.py index b7c4f5a1..5800841d 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -406,26 +406,6 @@ def shell_quote(text): return "'%s'" % text.replace("'", """'"'"'""") -def humanize_size(size): - """Create a nice human readable representation of the given number - (understood as bytes) using the "KiB" and "MiB" suffixes to indicate - kibibytes and mebibytes. A kibibyte is defined as 1024 bytes (as opposed to - a kilobyte which is 1000 bytes) and a mibibyte is 1024**2 bytes (as opposed - to a megabyte which is 1000**2 bytes). - - :param size: the number to convert - :type size: int - :returns: the human readable representation of size - :rtype: str - """ - for factor, format_string in ((1, '%i'), - (1024, '%iKiB'), - (1024 * 1024, '%.1fMiB')): - if size / factor < 1024: - return format_string % (size / factor) - return format_string % (size / factor) - - def parse_mailcap_nametemplate(tmplate='%s'): """this returns a prefix and suffix to be used in the tempfile module for a given mailcap nametemplate string""" |