File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,35 @@ Human friendly input/output (text formatting) on the command line based on the P
91
91
92
92
.. [[[end]]]
93
93
94
+ Note on units used
95
+ ------------------
96
+
97
+ This package uses the traditional units based on powers of two. These units are
98
+ still used in Microsoft Windows' graphical user interface and in other
99
+ software.
100
+
101
+ +--------+----------------+
102
+ | Unit | Value in bytes |
103
+ +--------+----------------+
104
+ | ``KB `` | 1024 |
105
+ +--------+----------------+
106
+ | ``MB `` | 1048576 |
107
+ +--------+----------------+
108
+ | ``GB `` | 1073741824 |
109
+ +--------+----------------+
110
+ | ``TB `` | 1099511627776 |
111
+ +--------+----------------+
112
+ | etc | |
113
+ +--------+----------------+
114
+
115
+ The standard IEEE 1541, used by many hardware and software vendors today,
116
+ contradicts this definition, using power of 10 units instead for ``kB ``,
117
+ ``MB ``, ``GB `` and so on. These definitions are often referred to as SI
118
+ formatting, due to their similarity with the metric system. Thankfully, IEEE
119
+ 1541 also unambigously defines ``KiB ``, ``MiB `` (etc) to the values based on
120
+ powers of 2. This module does not yet support these units.
121
+
122
+
94
123
Contact
95
124
-------
96
125
Original file line number Diff line number Diff line change @@ -112,7 +112,8 @@ def format_size(num_bytes, keep_width=False):
112
112
``False`` if they can be stripped.
113
113
:returns: The corresponding human readable file size (a string).
114
114
115
- This function supports ranges from kilobytes to terabytes.
115
+ This function supports ranges from kilobytes to terabytes. It only supports
116
+ the definitions that are based on powers of 2.
116
117
117
118
Some examples:
118
119
@@ -143,6 +144,8 @@ def parse_size(size):
143
144
:returns: The corresponding size in bytes (an integer).
144
145
:raises: :exc:`InvalidSize` when the input can't be parsed.
145
146
147
+ This function only supports the definitions that are based on powers of 2.
148
+
146
149
Some examples:
147
150
148
151
>>> from humanfriendly import parse_size
You can’t perform that action at this time.
0 commit comments