Ë
ÿ<¬5RúW›ã óB — d Z ddlmZ ddddœZ d d
d„Zy)z$Bits and bytes related humanization.é )Úannotations)z kBz MBz GBz TBz PBz EBz ZBz YB)z KiBz MiBz GiBz TiBz PiBz EiBz ZiBz YiBÚKMGTPEZY)ÚdecimalÚbinaryÚgnuc ó, — |r
t d }n|r
t d }n t d }|s|rdnd}t | « }t |« }|dk( r|sd|z S ||k r|sd|z S ||k r|rd |z S t |« D ] \ }} ||d
z z }
||
k sŒ n |||z
z z z }|S )aP Format a number of bytes like a human readable filesize (e.g. 10 kB).
By default, decimal suffixes (kB, MB) are used.
Non-GNU modes are compatible with jinja2's `filesizeformat` filter.
Examples:
```pycon
>>> naturalsize(3000000)
'3.0 MB'
>>> naturalsize(300, False, True)
'300B'
>>> naturalsize(3000, False, True)
'2.9K'
>>> naturalsize(3000, False, True, "%.3f")
'2.930K'
>>> naturalsize(3000, True)
'2.9 KiB'
>>> naturalsize(10**28)
'10000.0 YB'
>>> naturalsize(-4096, True)
'-4.0 KiB'
```
Args:
value (int, float, str): Integer to convert.
binary (bool): If `True`, uses binary suffixes (KiB, MiB) with base
210 instead of 103.
gnu (bool): If `True`, the binary argument is ignored and GNU-style
(`ls -sh` style) prefixes are used (K, M) with the 2**10 definition.
format (str): Custom formatter.
Returns:
str: Human readable representation of a filesize.
r r r i iè é z%d Bytez%d Bytesz%dBé )ÚsuffixesÚfloatÚabsÚ enumerate)Úvaluer r ÚformatÚsuffixÚbaseÚbytes_Ú abs_bytesÚiÚsÚunitÚrets ú6/usr/lib/python3.12/site-packages/humanize/filesize.pyÚnaturalsizer
sÌ € ñT ܘ%‘‰Ù ܘ(Ñ#‰ä˜)Ñ$ˆá™6‰4¨€DÜ
�5‹\€FÜ�F“€Ià�A‚~™cؘ6Ñ!Ð!à�4ҡؘFÑ"Ð"à�4Ò™CØ�v‰~Ðä˜&Ö!‰ˆˆ1ؘ˜A™‰ˆà�tÓÙð "ð ˜ ™¨Ñ-Ñ.°Ñ2€CØ€Jó N)FFz%.1f)
r zfloat | strr Úboolr r r ÚstrÚreturnr )Ú__doc__Ú
__future__r r r © r r Úr" sd ðñ +Ý "ð HØNØñ€ð ØØð EØðEàðEð
ðEð
ð Eð
ôEr