File: //lib/python3/dist-packages/rich/__pycache__/filesize.cpython-312.pyc
�
"T�e� �
� � d Z dgZddlmZmZmZmZ ddd�dedee d ed
ee dee defd
�Z dedee d edeeef fd�Z
ddd�ded
ee dee defd�Zy)a� Functions for reporting filesizes. Borrowed from https://github.com/PyFilesystem/pyfilesystem2
The functions declared in this module should cover the different
use cases needed to generate a string representation of a file size
using several different units. Since there are many standards regarding
file size units, three different functions have been implemented.
See Also:
* `Wikipedia: Binary prefix <https://en.wikipedia.org/wiki/Binary_prefix>`_
�decimal� )�Iterable�List�Optional�Tuple� � �� precision� separator�size�suffixes�baser r �returnc � � | dk( ry| |k rdj | � S t |d� D ] \ }}||z }| |k s� n dj || z z ||�� S )Nr z1 bytez
{:,} bytes� z{:,.{precision}f}{separator}{}r
)�format� enumerate)r
r r r r �i�suffix�units �//usr/lib/python3/dist-packages/rich/filesize.py�_to_strr s� � � �q�y��
����"�"�4�(�(��x��+� � ��6��Q�w���$�;��� ,�2�2�
���t� ���� 3� � � c �T � t |� D ] \ }}||z }| ||z k s� ||fS fS )z*Pick a suffix and base for the given size.)r )r
r r r r r s r �pick_unit_and_suffixr , sH � ��x�(� � ��6��Q�w���$��+�����<�� � ��<�r c �"