%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/rich/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/rich/__pycache__/_ratio.cpython-312.pyc

�

"T�eS���ddlZddlmZddlmZddlmZmZmZm	Z	ejdk\rddlmZnddlmZGd�de�Z
d	ed
e	e
deefd�Zd	ed
eedeedeedeef
d�Z	dd	ed
eedeeedeefd�Zedk(rHddlmZeGd�d��Zededdd�eddd�eddd�g�Zeee��yy)�N)�Fraction)�ceil)�cast�List�Optional�Sequence)��)�Protocolc�B�eZdZUdZdZeeed<dZeed<dZ	eed<y)�Edgez1Any object that defines an edge (such as Layout).N�size��ratio�minimum_size)
�__name__�
__module__�__qualname__�__doc__rr�int�__annotations__rr���-/usr/lib/python3/dist-packages/rich/_ratio.pyr
r
s&��;��D�(�3�-���E�3�N��L�#�rr
�total�edges�returnc��|D�cgc]}|jxsd��}}t}d|v�rtt||��D���cgc]\}\}}|�||f��}}}}|t	d�|D��z
}|dkr1t||�D��cgc]\}}|�|j
xsdn|��c}}S||t	d�|D���}	|D]2\}}|	|jz|j
ks�#|j
||<n8|d�}
|D])\}}t|	|jz|
zd�\}}
|||<�+nd|vr��ttt|�Scc}wcc}}}wcc}}w)a�Divide total space to satisfy size, ratio, and minimum_size, constraints.

    The returned list of integers should add up to total in most cases, unless it is
    impossible to satisfy all the constraints. For instance, if there are two edges
    with a minimum size of 20 each and `total` is 30 then the returned list will be
    greater than total. In practice, this would mean that a Layout object would
    clip the rows that would overflow the screen height.

    Args:
        total (int): Total number of characters.
        edges (List[Edge]): Edges within total space.

    Returns:
        List[int]: Number of characters for each edge.
    Nc3�(K�|]
}|xsd���y�w)rNr)�.0rs  r�	<genexpr>z ratio_resolve.<locals>.<genexpr>2s����<�d��	��	�<�s�rrc3�BK�|]\}}|jxsd���y�w)rN)r)r �_�edges   rr!z ratio_resolve.<locals>.<genexpr>;s����K���D�D�J�J�O�!�O�K�s�)rr�	enumerate�zip�sumrr�divmodrrr)rrr$�sizes�	_Fraction�indexr�flexible_edges�	remaining�portion�	remainders           r�
ratio_resolver0s���".3�3�T�d�i�i��4��3�E�3��I��%�-�(1��U�E�1B�'C�
�
�#��|��d��|��D�M�
��
��C�<�e�<�<�<�	���>�#&�e�U�"3���D�$�.2�\�$�#�#�(�q�t�C��
�
��s�K�N�K�K�
��
*�
	�K�E�4�����#�t�'8�'8�8�#�0�0��e���	
	�"�!��I�-�
$���t�"(��4�:�:�)=�	�)I�1�"M���i�#��e��
$�
�E�%�-�H��S�	�5�!�!��S
4��
��s�E�E
�E�ratios�maximums�valuesc�F�t||�D��cgc]\}}|r|nd��
}}}t|�}|s|ddS|}g}|j}	t|||�D]F\}}
}|r6|dkDr1t|
t	||z|z��}|	||z
�||z}||z}�?|	|��H|Scc}}w)adDivide an integer total in to parts based on ratios.

    Args:
        total (int): The total to divide.
        ratios (List[int]): A list of integer ratios.
        maximums (List[int]): List of maximums values for each slot.
        values (List[int]): List of values

    Returns:
        List[int]: A list of integers guaranteed to sum to total.
    rN)r&r'�append�min�round)
rr1r2r3r�_max�total_ratio�total_remaining�resultr5�maximum�value�distributeds
             r�ratio_reducer?Qs���7:�&�(�6K�
L�{�u�d�t�e��"�
L�F�
L��f�+�K���a�y���O��F�
�]�]�F�!$�V�X�v�!>����w���[�1�_��g�u�U�_�-D�{�-R�'S�T�K��5�;�&�'��{�*�O��5� �K��5�M���M��Ms�B�minimumsc�b�|r"t||�D��cgc]\}}|r|nd��
}}}t|�}|dkDsJd��|}g}|j}|�dgt|�z}	n|}	t||	�D]:\}}
|dkDrt	|
t||z|z��}n|}||�||z}||z}�<|Scc}}w)a<Distribute an integer total in to parts based on ratios.

    Args:
        total (int): The total to divide.
        ratios (List[int]): A list of integer ratios.
        minimums (List[int]): List of minimum values for each slot.

    Returns:
        List[int]: A list of integers guaranteed to sum to total.
    rzSum of ratios must be > 0)r&r'r5�len�maxr)rr1r@r�_minr9r:�distributed_totalr5�	_minimums�minimumr>s            r�ratio_distributerHqs����:=�f�h�:O�P�;�5�$�4�%�Q�&�P��P��f�+�K���?�7�7�7�?��O�#%��
�
%�
%�F����C�#�f�+�%�	��	��f�i�0�'���w���?��g�t�E�O�,C�k�,Q�'R�S�K�)�K��{���u����;�&��'����'Qs�B+�__main__)�	dataclassc�>�eZdZUdZeeed<dZeed<dZeed<y)�ENrrrr)	rrrrrrrrrrrrrLrL�s#��"��h�s�m�"���s����c�rrL�nr)N)�sys�	fractionsr�mathr�typingrrrr�version_infor�typing_extensionsr
rr0r?rHr�dataclassesrJrL�resolved�printr'rrr�<module>rWs5��
���1�1����v���*��8��:"��:"�X�d�^�:"��S�	�:"�z����S�	��-1�#�Y��@D�S�	��	�#�Y��BDH�!��!��S�	�!�-5�d�3�i�-@�!�	�#�Y�!�H�z��%������
�S�1�T�1�a�=�!�D�!�Q�-��4��A��"O�P�H�	�#�h�-��r

Zerion Mini Shell 1.0