Show More
@@ -1167,10 +1167,7 b' def ellipsis(text, maxlength=400):' | |||
|
1167 | 1167 | except (UnicodeDecodeError, UnicodeEncodeError): |
|
1168 | 1168 | return _ellipsis(text, maxlength)[0] |
|
1169 | 1169 | |
|
1170 | def bytecount(nbytes): | |
|
1171 | '''return byte count formatted as readable string, with units''' | |
|
1172 | ||
|
1173 | units = ( | |
|
1170 | _byteunits = ( | |
|
1174 | 1171 |
|
|
1175 | 1172 |
|
|
1176 | 1173 |
|
@@ -1183,7 +1180,10 b' def bytecount(nbytes):' | |||
|
1183 | 1180 |
|
|
1184 | 1181 |
|
|
1185 | 1182 | |
|
1186 | for multiplier, divisor, format in units: | |
|
1183 | def bytecount(nbytes): | |
|
1184 | '''return byte count formatted as readable string, with units''' | |
|
1185 | ||
|
1186 | for multiplier, divisor, format in _byteunits: | |
|
1187 | 1187 | if nbytes >= divisor * multiplier: |
|
1188 | 1188 | return format % (nbytes / float(divisor)) |
|
1189 | 1189 | return units[-1][2] % nbytes |
General Comments 0
You need to be logged in to leave comments.
Login now