HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/rich/__pycache__/measure.cpython-311.pyc
�

�;f����ddlmZddlmZmZmZmZmZddlm	Z	ddl
mZmZer
ddl
mZmZmZGd�de��Zd	d
ddd
edddfd�ZdS)�)�
itemgetter)�
TYPE_CHECKING�Callable�
NamedTuple�Optional�Sequence�)�errors)�
is_renderable�	rich_cast)�Console�ConsoleOptions�RenderableTypec���eZdZUdZeed<	eed<	edefd���Zdd�Zdeddfd�Z	deddfd	�Z
	ddeedeeddfd
�Ze
								dd���Zd
S)�MeasurementzSStores the minimum and maximum widths (in characters) required to render an object.�minimum�maximum�returnc� �|j|jz
S)z+Get difference between maximum and minimum.)rr)�selfs �?/opt/alt/python311/lib/python3.11/site-packages/rich/measure.py�spanzMeasurement.spans���|�d�l�*�*�c
��|\}}ttd|��|��}ttd|��tdt||������S)z�Get measurement that ensures that minimum <= maximum and minimum >= 0

        Returns:
            Measurement: A normalized measurement.
        r)�min�maxr)rrrs   r�	normalizezMeasurement.normalizesQ�� �����c�!�W�o�o�w�/�/���3�q�'�?�?�C��3�w��3H�3H�,I�,I�J�J�Jr�widthc�d�|\}}tt||��t||����S)z�Get a RenderableWith where the widths are <= width.

        Args:
            width (int): Maximum desired width.

        Returns:
            Measurement: New Measurement object.
        )rr�rrrrs    r�with_maximumzMeasurement.with_maximum"s2�� �����3�w��.�.��G�U�0C�0C�D�D�Drc��|\}}td|��}tt||��t||����S)z�Get a RenderableWith where the widths are >= width.

        Args:
            width (int): Minimum desired width.

        Returns:
            Measurement: New Measurement object.
        r)rrr s    r�with_minimumzMeasurement.with_minimum.s?�� �����A�u�
�
���3�w��.�.��G�U�0C�0C�D�D�DrN�	min_width�	max_widthc�f�|}|�|�|��}|�|�|��}|S)aNClamp a measurement within the specified range.

        Args:
            min_width (int): Minimum desired width, or ``None`` for no minimum. Defaults to None.
            max_width (int): Maximum desired width, or ``None`` for no maximum. Defaults to None.

        Returns:
            Measurement: New Measurement object.
        )r#r!)rr$r%�measurements    r�clampzMeasurement.clamp;sA����� �%�2�2�9�=�=�K�� �%�2�2�9�=�=�K��r�consoler
�optionsr�
renderablerc��|j}|dkrtdd��St|t��r|�||jd���}t
|��}t|��r�t|dd��}|�`|||���	���
|��}|jdkrtdd��S|�	��Std|��Stj
d|�d����)	a�Get a measurement for a renderable.

        Args:
            console (~rich.console.Console): Console instance.
            options (~rich.console.ConsoleOptions): Console options.
            renderable (RenderableType): An object that may be rendered with Rich.

        Raises:
            errors.NotRenderableError: If the object is not renderable.

        Returns:
            Measurement: Measurement object containing range of character widths required to render the object.
        r	rF)�markup�	highlight�__rich_measure__NzUnable to get render width for zD; a str, Segment, or object with __rich_console__ method is required)r%r�
isinstance�str�
render_strr-rr�getattrrr!rr
�NotRenderableError)�clsr)r*r+�
_max_width�get_console_width�render_widths       r�getzMeasurement.getNs4��"�&�
���>�>��q�!�$�$�$��j�#�&�&�	� �+�+��7�>�U�,���J��z�*�*�
���$�$�	��
�$6��=�=�
�!�,�%�%�g�w�7�7��Y�[�[�!�\�*�-�-��
 �'�!�+�+�&�q�!�,�,�,�#�-�-�/�/�/�"�1�j�1�1�1��+�U�*�U�U�U���
r)rr)NN)r)r
r*rr+rrr)�__name__�
__module__�__qualname__�__doc__�int�__annotations__�propertyrrr!r#rr(�classmethodr9�rrrrsA�������]�]�
�L�L�L�5�
�L�L�L�5�
�+�c�+�+�+��X�+�K�K�K�K�
E�#�
E�-�
E�
E�
E�
E�E�#�E�-�E�E�E�E�KO���!�#���:B�3�-��	�����&�+��+�*:�+�HX�+�	�+�+�+��[�+�+�+rrr)r
r*r�renderablesrrc	�����|stdd��Stj����fd�|D��}tt|td�����jt|td�����j��}|S)a�Get a measurement that would fit a number of renderables.

    Args:
        console (~rich.console.Console): Console instance.
        options (~rich.console.ConsoleOptions): Console options.
        renderables (Iterable[RenderableType]): One or more renderable objects.

    Returns:
        Measurement: Measurement object containing range of character widths required to
            contain all given renderables.
    rc�*��g|]}���|����SrBrB)�.0r+r)�get_measurementr*s  ���r�
<listcomp>z'measure_renderables.<locals>.<listcomp>�s4������:D�����*�5�5���r)�keyr	)rr9rrrr)r)r*rC�measurements�measured_widthrGs``   @r�measure_renderablesrL}s������ �!��1�a� � � �!�o�O�������HS����L�!��L�j��m�m�,�,�,�4��L�j��m�m�,�,�,�4���N��rN)�operatorr�typingrrrrr�r
�protocolrrr)r
rrrrLrBrr�<module>rQs
��������J�J�J�J�J�J�J�J�J�J�J�J�J�J�������.�.�.�.�.�.�.�.��A�@�@�@�@�@�@�@�@�@�@�o�o�o�o�o�*�o�o�o�d�
��
���*�+���	�����r