
    Ī5h	                    B    d Z ddlmZ ddddZ	 	 	 d		 	 	 	 	 	 	 	 	 d
dZy)z$Bits and bytes related humanization.    )annotations)
z kBz MBz GBz TBz PBz EBz ZBz YBz RBz QB)
z KiBz MiBz GiBz TiBz PiBz EiBz ZiBz YiBz RiBz QiB
KMGTPEZYRQ)decimalbinarygnuc                v   |r
t         d   }n|r
t         d   }n	t         d   }|s|rdnd}t        | t              rt        |       }n| }t	        |      }|dk(  r|st        |       dS ||k  r|rt        |       dS t        |       d	S t        |d
      D ]  \  }}	||z  }
||
k  s n |||
z  z  z  	z   }|S )a  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)
        '10.0 RB'
        >>> naturalsize(10**34 * 3)
        '30000.0 QB'
        >>> 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
            2<sup>10</sup> instead of 10<sup>3</sup>.
        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 ByteBz Bytes   )suffixes
isinstancestrfloatabsint	enumerate)valuer   r   formatsuffixbasebytes_	abs_bytesisunitrets               W/var/www/html/Kila-kolis-project/venv/lib/python3.12/site-packages/humanize/filesize.pynaturalsizer   "   s    X %	(#)$64D%uFIA~cf+e$$4$'#f+a CF}F-CC&!$1Qwt %
 $/014CJ    N)FFz%.1f)
r   zfloat | strr   boolr   r    r   r   returnr   )__doc__
__future__r   r   r    r   r   <module>r%      se    * " 3> 	GGG 
G 	G
 	Gr   