HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/pip/_vendor/rich/__pycache__/table.cpython-37.pyc
B

L��g��	@sddlmZmZmZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
ddlmZmZddlmZmZddlmZddlmZmZddlmZdd	lmZdd
lmZddlm Z m!Z!ddl"m#Z#dd
l$m%Z%ddl&m'Z'm(Z(ddl)m*Z*m+Z+e�rddl,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2eGdd�d��Z3eGdd�d��Z4Gdd�de	�Z5Gdd�de�Z6e7dk�rddl8m-Z-ddl9m:Z:ddl;m6Z6ddl<m=Z=e=d���~e6dd d!d"�Z>e>j?d#d$d%d&d'�e>j?d(d)d*�e>j?d+d!d,d-�e>�@d.d/d0�e>�@d1d2d3�e>j@d4d5d6d7d&d8�e>�@d9d:d;�eAd<d=�d>d?�ZBe-�Z,e:�ZCeBd@�e,jDe>dAdB�d&e>_EeBdC�e,�De>�dDe>_FeBdE�e,jDe>dAdB�d<e>_FdFe>_EdGdHge>_GeBdI�e,jDe>dAdB�d<e>_FdFe>_EdGdHge>_Gde>_HeBdJ�e,jDe>dAdB�d<e>_FdFe>_EdGdHge>_Gd&e>_Ide>_HeBdK�e,jDe>dAdB�Wd<QRXd<S)L�)�	dataclass�field�replace)	�
TYPE_CHECKING�Dict�Iterable�List�
NamedTuple�Optional�Sequence�Tuple�Union�)�box�errors)�loop_first_last�	loop_last)�	pick_bool)�ratio_distribute�ratio_reduce)�VerticalAlignMethod)�JupyterMixin)�Measurement)�Padding�PaddingDimensions)�
is_renderable)�Segment)�Style�	StyleType)�Text�TextType)�Console�ConsoleOptions�
JustifyMethod�OverflowMethod�RenderableType�RenderResultc@seZdZUdZdZded<dZded<dZeed<dZ	eed<dZ
eed<d	Zd
ed<dZd
ed<dZ
ded<dZeeed<dZeeed<dZeeed<dZeeed<dZeed<dZeed<eed�Zeded<dd�dd�Zeedd�d d!��Zeed�d"d#��ZdS)$�Columna�
Defines a column within a ~Table.

    Args:
        title (Union[str, Text], optional): The title of the table rendered at the top. Defaults to None.
        caption (Union[str, Text], optional): The table caption rendered below. Defaults to None.
        width (int, optional): The width in characters of the table, or ``None`` to automatically fit. Defaults to None.
        min_width (Optional[int], optional): The minimum width of the table, or ``None`` for no minimum. Defaults to None.
        box (box.Box, optional): One of the constants in box.py used to draw the edges (see :ref:`appendix_box`), or ``None`` for no box lines. Defaults to box.HEAVY_HEAD.
        safe_box (Optional[bool], optional): Disable box characters that don't display on windows legacy terminal with *raster* fonts. Defaults to True.
        padding (PaddingDimensions, optional): Padding for cells (top, right, bottom, left). Defaults to (0, 1).
        collapse_padding (bool, optional): Enable collapsing of padding around cells. Defaults to False.
        pad_edge (bool, optional): Enable padding of edge cells. Defaults to True.
        expand (bool, optional): Expand the table to fit the available space if ``True``, otherwise the table width will be auto-calculated. Defaults to False.
        show_header (bool, optional): Show a header row. Defaults to True.
        show_footer (bool, optional): Show a footer row. Defaults to False.
        show_edge (bool, optional): Draw a box around the outside of the table. Defaults to True.
        show_lines (bool, optional): Draw lines between every row. Defaults to False.
        leading (bool, optional): Number of blank lines between rows (precludes ``show_lines``). Defaults to 0.
        style (Union[str, Style], optional): Default style for the table. Defaults to "none".
        row_styles (List[Union, str], optional): Optional list of row styles, if more than one style is given then the styles will alternate. Defaults to None.
        header_style (Union[str, Style], optional): Style of the header. Defaults to "table.header".
        footer_style (Union[str, Style], optional): Style of the footer. Defaults to "table.footer".
        border_style (Union[str, Style], optional): Style of the border. Defaults to None.
        title_style (Union[str, Style], optional): Style of the title. Defaults to None.
        caption_style (Union[str, Style], optional): Style of the caption. Defaults to None.
        title_justify (str, optional): Justify method for title. Defaults to "center".
        caption_justify (str, optional): Justify method for caption. Defaults to "center".
        highlight (bool, optional): Highlight cell contents (if str). Defaults to False.
    �r%�header�footer�header_style�footer_style�style�leftr#�justify�topr�vertical�ellipsisr$�overflowN�width�	min_width�	max_width�ratioF�no_wrapr�_index)�default_factory�_cells)�returncCst|gd�S)zReturn a copy of this Column.)r;)r)�self�r>�:/tmp/pip-unpacked-wheel-hv55ucu3/pip/_vendor/rich/table.py�copyrszColumn.copyccs|jEdHdS)z2Get all cells in the column, not including header.N)r;)r=r>r>r?�cellsvszColumn.cellscCs
|jdk	S)z!Check if this column is flexible.N)r7)r=r>r>r?�flexible{szColumn.flexible) �__name__�
__module__�__qualname__�__doc__r)�__annotations__r*r+rr,r-r/r1r3r4r
�intr5r6r7r8�boolr9r�listr;rr@�propertyrrArBr>r>r>r?r'&s*
r'c@s.eZdZUdZdZeeed<dZe	ed<dS)�RowzInformation regarding a row.Nr-F�end_section)
rCrDrErFr-r
rrGrMrIr>r>r>r?rL�s
rLc@s*eZdZUdZeed<ded<eed<dS)�_CellzA single cell in a table.r-r%�
renderabler1N)rCrDrErFrrGrr>r>r>r?rN�s

rNc@s�eZdZUdZeeed<eeed<ddddej	ddddddddddd	dd
dddddddd
�e
eefee
ee
eeeeeejeeeeeeeeeeeeeeeeeeeeeeeeeddedd�dd�Zeddddd�e
eefeeeedd�dd��Zeed�dd��Zejedd�dd��Zeed�dd��Zeed�dd��Zdeed �d!d"�Zdd#ed$�d%d&�Zeeeeeefd�d'd(��Z e jedd)�d*d(��Z dPdddd,d-d.dddddd/�d0d0eeeeeedd1d2eeeeeeeeedd3�d4d5�Z!ddd6�ed0eeedd7�d8d9�Z"dd�d:d;�Z#dd#d<d$�d=d>�Z$dd#eed$�d?d@�Z%eeeeeeeedA�dBdC��Z&deeee'dD�dEdF�Z(eedG�dHdI�Z)dd#eedJ�dKdL�Z*dd#eed<dM�dNdO�Z+dS)Q�TableaA console renderable to draw a table.

    Args:
        *headers (Union[Column, str]): Column headers, either as a string, or :class:`~rich.table.Column` instance.
        title (Union[str, Text], optional): The title of the table rendered at the top. Defaults to None.
        caption (Union[str, Text], optional): The table caption rendered below. Defaults to None.
        width (int, optional): The width in characters of the table, or ``None`` to automatically fit. Defaults to None.
        min_width (Optional[int], optional): The minimum width of the table, or ``None`` for no minimum. Defaults to None.
        box (box.Box, optional): One of the constants in box.py used to draw the edges (see :ref:`appendix_box`), or ``None`` for no box lines. Defaults to box.HEAVY_HEAD.
        safe_box (Optional[bool], optional): Disable box characters that don't display on windows legacy terminal with *raster* fonts. Defaults to True.
        padding (PaddingDimensions, optional): Padding for cells (top, right, bottom, left). Defaults to (0, 1).
        collapse_padding (bool, optional): Enable collapsing of padding around cells. Defaults to False.
        pad_edge (bool, optional): Enable padding of edge cells. Defaults to True.
        expand (bool, optional): Expand the table to fit the available space if ``True``, otherwise the table width will be auto-calculated. Defaults to False.
        show_header (bool, optional): Show a header row. Defaults to True.
        show_footer (bool, optional): Show a footer row. Defaults to False.
        show_edge (bool, optional): Draw a box around the outside of the table. Defaults to True.
        show_lines (bool, optional): Draw lines between every row. Defaults to False.
        leading (bool, optional): Number of blank lines between rows (precludes ``show_lines``). Defaults to 0.
        style (Union[str, Style], optional): Default style for the table. Defaults to "none".
        row_styles (List[Union, str], optional): Optional list of row styles, if more than one style is given then the styles will alternate. Defaults to None.
        header_style (Union[str, Style], optional): Style of the header. Defaults to "table.header".
        footer_style (Union[str, Style], optional): Style of the footer. Defaults to "table.footer".
        border_style (Union[str, Style], optional): Style of the border. Defaults to None.
        title_style (Union[str, Style], optional): Style of the title. Defaults to None.
        caption_style (Union[str, Style], optional): Style of the caption. Defaults to None.
        title_justify (str, optional): Justify method for title. Defaults to "center".
        caption_justify (str, optional): Justify method for caption. Defaults to "center".
        highlight (bool, optional): Highlight cell contents (if str). Defaults to False.
    �columns�rowsN)rrFTr�noneztable.headerztable.footer�center)�title�captionr4r5r�safe_box�padding�collapse_padding�pad_edge�expand�show_header�show_footer�	show_edge�
show_lines�leadingr-�
row_stylesr+r,�border_style�title_style�
caption_style�
title_justify�caption_justify�	highlightr#)�headersrUrVr4r5rrWrXrYrZr[r\r]r^r_r`r-rar+r,rbrcrdrerfrgr<cGs�g|_g|_||_||_||_||_||_||_t�	|�|_
|	|_|
|_||_
||_|
|_||_||_||_||_|pxd|_|p�d|_||_||_||_||_||_||_t|p�g�|_|jj}x8|D]0}t|t �r�|j!|d�q�t"|j�|_#||�q�WdS)Nr()r))$rQrRrUrVr4r5rrWr�unpack�_paddingrZ�_expandr\r]r^r_r`rYr-r+r,rbrcrdrerfrgrJra�append�
isinstance�str�
add_column�lenr9)r=rUrVr4r5rrWrXrYrZr[r\r]r^r_r`r-rar+r,rbrcrdrerfrgrhZ
append_columnr)r>r>r?�__init__�sB



zTable.__init__)rXrYrZr[)rhrXrYrZr[r<cGs||d||ddd||d��S)a�Get a table with no lines, headers, or footer.

        Args:
            *headers (Union[Column, str]): Column headers, either as a string, or :class:`~rich.table.Column` instance.
            padding (PaddingDimensions, optional): Get padding around cells. Defaults to 0.
            collapse_padding (bool, optional): Enable collapsing of padding around cells. Defaults to True.
            pad_edge (bool, optional): Enable padding around edges of table. Defaults to False.
            expand (bool, optional): Expand the table to fit the available space if ``True``, otherwise the table width will be auto-calculated. Defaults to False.

        Returns:
            Table: A table instance.
        NF)rrXrYr\r]r^rZr[r>)�clsrXrYrZr[rhr>r>r?�grid�sz
Table.grid)r<cCs|jp|jdk	S)z-Setting a non-None self.width implies expand.N)rkr4)r=r>r>r?r[szTable.expand)r[r<cCs
||_dS)zSet expand.N)rk)r=r[r>r>r?r[!scCs4d}|jr|jr|d7}|jr0|t|j�d7}|S)z'Get extra width to add to cell content.r�r)rr^rprQ)r=r4r>r>r?�_extra_width&szTable._extra_widthcCs
t|j�S)zGet the current number of rows.)rprR)r=r>r>r?�	row_count0szTable.row_countr!)�console�indexr<cCsRt��}|jr,||�|j|t|j��7}|j|j}|dk	rN||�|�7}|S)zGet the current row style.N)r�nullra�	get_stylerprRr-)r=rwrxr-�	row_styler>r>r?�
get_row_style5szTable.get_row_styler")rw�optionsr<cs��j�|jdk	r|j��dkr(tdd�S|j}t|�����|����|j�����fdd�|jD�}tdd�|D��|}|jdkr�tdd�|D��|n|j}t||�}|�	|j
�}|S)Nrcsg|]}������|��qSr>)�update_width)�.0�column)�_measure_columnrwr6r}r>r?�
<listcomp>Qsz*Table.__rich_measure__.<locals>.<listcomp>css|]}|jVqdS)N)Zminimum)r�measurementr>r>r?�	<genexpr>Usz)Table.__rich_measure__.<locals>.<genexpr>css|]}|jVqdS)N)�maximum)rr�r>r>r?r�Xs)r6r4rru�sum�_calculate_column_widthsr~r�rQ�clampr5)r=rwr}�extra_widthZmeasurementsZ
minimum_widthZ
maximum_widthr�r>)r�rwr6r}r?�__rich_measure__?s$


 
zTable.__rich_measure__cCs|jS)zGet cell padding.)rj)r=r>r>r?rX`sz
Table.padding)rXr<cCst�|�|_|S)zSet cell padding.)rrirj)r=rXr>r>r?rXesr(r.r0r2)r+r,r-r/r1r3r4r5r6r7r8r%rr$)r)r*r+r,r-r/r1r3r4r5r6r7r8r<cCsFtt|j�|||pd|pd|p d||||	|
|||
d�}|j�|�dS)a�Add a column to the table.

        Args:
            header (RenderableType, optional): Text or renderable for the header.
                Defaults to "".
            footer (RenderableType, optional): Text or renderable for the footer.
                Defaults to "".
            header_style (Union[str, Style], optional): Style for the header, or None for default. Defaults to None.
            footer_style (Union[str, Style], optional): Style for the footer, or None for default. Defaults to None.
            style (Union[str, Style], optional): Style for the column cells, or None for default. Defaults to None.
            justify (JustifyMethod, optional): Alignment for cells. Defaults to "left".
            vertical (VerticalAlignMethod, optional): Vertical alignment, one of "top", "middle", or "bottom". Defaults to "top".
            overflow (OverflowMethod): Overflow method: "crop", "fold", "ellipsis". Defaults to "ellipsis".
            width (int, optional): Desired width of column in characters, or None to fit to contents. Defaults to None.
            min_width (Optional[int], optional): Minimum width of column, or ``None`` for no minimum. Defaults to None.
            max_width (Optional[int], optional): Maximum width of column, or ``None`` for no maximum. Defaults to None.
            ratio (int, optional): Flexible ratio for the column (requires ``Table.expand`` or ``Table.width``). Defaults to None.
            no_wrap (bool, optional): Set to ``True`` to disable wrapping of this column.
        r()r9r)r*r+r,r-r/r1r3r4r5r6r7r8N)r'rprQrl)r=r)r*r+r,r-r/r1r3r4r5r6r7r8r�r>r>r?roks %zTable.add_column)r-rM)�renderablesr-rMr<cGstddd�dd�}t|�}|j}t|�t|�krJ|dgt|�t|��}x�t|�D]�\}}|t|�kr�t|d�}	x|jD]}
||	td��qzW|j�|	�n||}	|dkr�||	d�qTt|�r�||	|�qTt	�
dt|�j�d	���qTW|j�t
||d
��dS)a�Add a row of renderables.

        Args:
            *renderables (None or renderable): Each cell in a row must be a renderable object (including str),
                or ``None`` for a blank cell.
            style (StyleType, optional): An optional style to apply to the entire row. Defaults to None.
            end_section (bool, optional): End a section and draw a line. Defaults to False.

        Raises:
            errors.NotRenderableError: If you add something that can't be rendered.
        r%N)r�rOr<cSs|j�|�dS)N)r;rl)r�rOr>r>r?�add_cell�szTable.add_row.<locals>.add_cell)r9r(zunable to render z1; a string or other renderable object is required)r-rM)r'rJrQrp�	enumeraterRrrlrrZNotRenderableError�typerCrL)r=r-rMr�r�Zcell_renderablesrQrxrOr��_r>r>r?�add_row�s(
z
Table.add_rowcCs|jrd|jd_dS)z2Add a new section (draw a line after current row).T���N)rRrM)r=r>r>r?�add_section�szTable.add_sectionr&c#s�|jstd�VdS|j}|jdk	r*|j}|j}|��|�||��}t|�|}|j||j	dd��dt
tddd���fdd�
}|jr�||jt
�|jd	�|jd
�EdH|���|�EdH|jr�||jt
�|jd�|jd
�EdHdS)
N�
)r4rg�heightrTr#r&)�textr-r/r<cs4t|t�r�j||dd�n|}�j|�j|d�d�S)NF)r-rg)r/)r})rmrnZ
render_str�render�update)r�r-r/Zrender_text)rw�render_optionsr>r?�render_annotation�sz1Table.__rich_console__.<locals>.render_annotationztable.title)r-r/z
table.caption)rT)rQrr6r4rur�r~r�r�rgr rrUrZ
pick_firstrcre�_renderrVrdrf)r=rwr}r6r��widths�table_widthr�r>)rwr�r?�__rich_console__�s2


zTable.__rich_console__cs��j}�j}���fdd�|D�}dd�|D�}�j��j}�jr�dd�|D�}t|�r�dd�t||�D�}	�fdd�|D�}
|t|	�}t|||
�}t	|�}
x.t
|�D]"\}}|jr�|	|t|
�||<q�Wt|�}||k�r\��
|dd�|D�|�}t|�}||k�r2||}t|dgt|�||�}t|�}���fd	d�t||�D�}d
d�|D�}||k�rn�j�s��jdk	�r�|�j|k�r̈jdk�r�|nt�j||�}t|||�}dd�t||�D�}|S)
zNCalculate the widths of each column, including padding, not including borders.csg|]}����|��qSr>)r�)rr�)rwr}r=r>r?r�sz2Table._calculate_column_widths.<locals>.<listcomp>cSsg|]}|jpd�qS)r)r�)r�_ranger>r>r?r�scSsg|]}|jr|jpd�qS)r)rBr7)r�colr>r>r?r�scSs g|]\}}|jrdn|j�qS)r)rBr�)rr�r�r>r>r?r�scs&g|]}|jr|jpd�|j��qS)r)rBr4r9)rr�)�get_padding_widthr>r?r�scSsg|]}|jdko|j�qS)N)r4r8)rr�r>r>r?r�*srcs$g|]\}}�����|�|��qSr>)r�r~)rr4r�)rwr}r=r>r?r�5scSsg|]}|jpd�qS)r)r�)rr�r>r>r?r�8sNcSsg|]\}}||�qSr>r>)r�_width�padr>r>r?r�Cs)r6rQ�_get_padding_widthrur[�any�zipr�r�iterr�rB�next�_collapse_widthsrrpr5�min)r=rwr}r6rQZwidth_rangesr�r��ratiosZfixed_widthsZflex_minimumZflexible_widthZflex_widthsZiter_flex_widthsrxr�r��excess_widthZ
_max_widthZ
pad_widthsr>)rwr�r}r=r?r�sP


zTable._calculate_column_widths)r��wrapabler6r<c
s�t|�}||}t|�r�x�|r�|dkr�tdd�t||�D���t�fdd�t||�D��}�|}�fdd�t||�D�}t|�r�|s�Pt||�gt|�}	t|||	|�}t|�}||}qW|S)aMReduce widths so that the total is under max_width.

        Args:
            widths (List[int]): List of widths.
            wrapable (List[bool]): List of booleans that indicate if a column may shrink.
            max_width (int): Maximum width to reduce to.

        Returns:
            List[int]: A new list of widths.
        rcss|]\}}|r|VqdS)Nr>)rr4�
allow_wrapr>r>r?r�Zsz)Table._collapse_widths.<locals>.<genexpr>c3s&|]\}}|r|�kr|ndVqdS)rNr>)rr4r�)�
max_columnr>r?r�]scs$g|]\}}|�kr|rdnd�qS)rrr>)rr4r�)r�r>r?r�bsz*Table._collapse_widths.<locals>.<listcomp>)r�r��maxr�r�rpr)
rrr�r�r6Ztotal_widthr�Zsecond_max_columnZcolumn_differencer�Z
max_reducer>)r�r?r�Gs&

zTable._collapse_widths)rw�column_indexr�r<c#s�|j�|j�|j�t��}|dk�|t|j�dk�i�tttttttfd�������fdd�}g}|j	}|j
}|jr�||jp�d�||j�}	||	|j
f�||jp�d�}
x|jD]}||
|f�q�W|jr�||jp�d�||j�}|||jf�|�rJt}
xzt|�D]:\}}\}}t||
||||��t|dd��p<|j�V�q
Wn2x0|D](\}}t||t|dd��pp|j�V�qPWdS)	z3Get all the cells with padding and optional header.rr)�	first_row�last_rowr<cs���||f�}|r|S�\}}}}�rJ�s8td||�}|sJtd||�}�sn�rVd}�r^d}|rfd}|rnd}||||f}|�||f<|S)Nr)�getr�)r�r��cachedr0�right�bottomr.rj)�_padding_cacherY�first_column�last_columnrZrXr>r?�get_padding}s*z%Table._get_cells.<locals>.get_paddingr(r1N)rYrZrXr�rprQrIrrHrlrzr\r+r)r-rAr]r,r*rrrN�getattrr1)r=rwr�r�Zany_paddingr�Z	raw_cells�_appendrzr+Z
cell_style�cellr,Z_Padding�first�lastr-rOr>)r�rYr�r�rZrXr?�
_get_cellsnsD,

 zTable._get_cells)r�r<cCs2|j\}}}}|jr*|dkr*td||�}||S)zGet extra width from padding.r)rXrYr�)r=r�r�Z	pad_rightZpad_leftr>r>r?r��s
zTable._get_padding_width)rwr}r�r<cCs|j}|dkrtdd�S|�|j�}|jdk	rJt|j||j|��|�Sg}g}|j}|j}	tj}
x:|�||j|�D]&}|
|||j	�\}}
||�|	|
�qvWt|r�t
|�nd|r�t
|�n|��|�}|�|jdkr�dn|j||jdkr�dn|j|�}|S)z0Get the minimum and maximum width of the column.rrN)
r6rr�r9r4Zwith_maximumrlr�r�rOr�r�r5)r=rwr}r�r6Z
padding_widthZ
min_widthsZ
max_widthsZ
append_minZ
append_maxZget_render_widthr�Z_minZ_maxr�r>r>r?r��s2

zTable._measure_column)rwr}r�r<c%	#s����	jpd�}|���	jpd�}��	fdd�t�	j�D�}tt|��}�	jrj�	jj|t	�	j
�j
�d�nd}|r��	js�|��n|}t
��}	�	j}
�	j}�	j}�	j}
�	j}�	j}t
�|�r>�|j|��|j|��|j|�f�|j|��|j|��|j|�f�|j|��|j|��|j|�fg}|
�rB�|�|�|�V|	Vng}�	j}�j��x<tt|��D�]*\}\}}}|�ov|�|�o�|���s���s��	j||nd}d�g}��s���r�t �!��n�|�|�r�|dn|���xjt|||
�D]Z\}}}|j"||j#|j$|j%dd�}�j&|j'|�|j��d�}t(�t)|���|�*|��q�Wt(dd�|D���t+t+t
d	t,t t+t+t
d
�����fdd�������fd
d�t||||
�D�|dd�<|�r�|�r�|�r�|j-|d|
d�|�V|	V||�r�dn|�r�dnd\}}}|j.�/��r|n�|j.�j0|j�} x�t1��D]V}!|
�rD|Vx0t2|�D]$\}"}#|#|!EdH|"�sN| V�qNW|
�r�|V|	V�q4Wn8x6t1��D]*}!x|D]}#|#|!EdH�q�W|	V�q�W|�r�|�r�|�r��|j-|d|
d�|�V|	V|�o|j3}$|�r^|�s|�s|$�r^|�s^|�r:|t)|�dk�s^|�rF��s^|�rj�|j-|d|
d�||�Vn�|j-|d|
d�|�V|	V�q^W|�r�|
�r��|�4|�|�V|	VdS)Nr(c3s |]\}}���||�VqdS)N)r�)rr�r�)rwr=r>r?r��sz Table._render.<locals>.<genexpr>)�safer)r4r/r8r3r�)r-css|]}t|�VqdS)N)rp)rr�r>r>r?r�@sr)r�r1r4r-r<csR�r
d}n�rd}|dkr*��||�|�S|dkrB��||�|�S��||�|�S)Nr�r0Zmiddle)Z	align_topZalign_middleZalign_bottom)r�r1r4r-)�_Segment�
footer_row�
header_row�
row_heightr>r?�
align_cellBsz!Table._render.<locals>.align_cellc
s8g|]0\}}}}���||j|�|j���|���qSr>)Z	set_shaper1r-)rr4Z_cellr�r�)r�r�rz�
max_heightr{r>r?r�Ts
z!Table._render.<locals>.<listcomp>Zfoot)Zedgerrt�headZmid�row)5rzr-rbr�rQrJr�r�
substituterrWr\Zget_plain_headed_boxr�liner]r^r_r`Z	head_leftZ
head_rightZ
head_verticalZ	foot_leftZ
foot_rightZ
foot_verticalZmid_leftZ	mid_rightZmid_verticalZget_topr|rrRrryr�r/r8r3Zrender_linesrOr�rprlrrHZget_rowr��stripZbackground_style�rangerrMZ
get_bottom)%r=rwr}r�Ztable_stylerbZ
_column_cellsZ	row_cellsZ_box�new_linerQr\r]r^r_r`Zbox_segmentsr|rxr�r�Zrow_cellr�rAr4r�r�r��linesr.r�Z_divider�dividerZline_noZ	last_cellZ
rendered_cellrMr>)
r�r�rwr�rzr�r�r�r{r=r?r��s� 





 



 

"

z
Table._render)r(r(),rCrDrErFrr'rGrLrZ
HEAVY_HEADr
rnr
r rHZBoxrIrrrrq�classmethodrsrKr[�setterrurvr|rr�rrXror�r�r�r�r�rNr�r�r�r�r>r>r>r?rP�s�
x%	<**/>%G
$
rP�__main__)r!)�ReprHighlighter)rP)�timerzTable renderzStar Wars MovieszRich example tabler�)rUrVrfZReleasedZbright_cyanZcyanT)r+r-r8ZTitleZmagenta)r-z
Box OfficeZgreen)r/r-zDec 20, 2019z Star Wars: The Rise of Skywalkerz$952,110,690zMay 25, 2018zSolo: A Star Wars Storyz$393,151,347zDec 15, 2017z!Star Wars Ep. V111: The Last Jediz$1,332,539,889zon black)r-rMzDec 16, 2016zRogue One: A Star Wars Storyz$1,332,439,889N)r�r<cCs"t��t�t|��t��dS)N)rw�printZrulerg)r�r>r>r?r)�sr)z
Example TablerT)r/zexpand=True�2zwidth=50FZdimrSzrow_styles=['dim', 'none']z%leading=1, row_styles=['dim', 'none']z+show_lines=True, row_styles=['dim', 'none'])JZdataclassesrrr�typingrrrrr	r
rrr
r(rrZ_looprrZ_pickrZ_ratiorrZalignrZjupyterrZmeasurerrXrr�protocolr�segmentrr-rrr�rr rwr!r"r#r$r%r&r'rLrNrPrCZpip._vendor.rich.consoleZpip._vendor.rich.highlighterr�Zpip._vendor.rich.tableZ_timerr��tableror�rnr)rgr�r[r4rar`r_r>r>r>r?�<module>s�, 
[