HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/rich/__pycache__/table.cpython-310.pyc
o

;ja��@s,ddlmZmZmZddlmZmZmZmZm	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+er�ddl,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2eGdd�d��Z3eGdd�d��Z4Gdd�de	�Z5Gdd�de�Z6e7dk�r�ddl8m-Z-ddl9m:Z:ddl;m<Z<e<d���e6ddd d!�Z=e=j>d"d#d$d%d&�e=j>d'd(d)�e=j>d*d d+d,�e=�?d-d.d/�e=�?d0d1d2�e=j?d3d4d5d6d%d7�e=�?d8d9d:�d;e@d<d=fd>d?�ZAe-�Z,e:�ZBeAd@�e,jCe=dAdB�d%e=_DeAdC�e,�Ce=�dDe=_EeAdE�e,jCe=dAdB�d=e=_EdFe=_DdGdHge=_FeAdI�e,jCe=dAdB�d=e=_EdFe=_DdGdHge=_Fde=_GeAdJ�e,jCe=dAdB�d=e=_EdFe=_DdGdHge=_Fd%e=_Hde=_GeAdK�e,jCe=dAdB�Wd=�d=S1�s�wYd=Sd=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@s<eZdZUdZdZded<	dZded<	dZeed<	dZ	eed<	dZ
eed<	d	Zd
ed<	dZd
ed<	dZ
ded<	dZeeed<	dZeeed<	dZeeed<	dZeeed<	dZeed<	dZeed<	dZeed<	eed�Zeded<d%dd �Zededfd!d"��Zedefd#d$��Z dS)&�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.
        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 (int, 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_wrap�	highlightr�_index)�default_factory�_cells�returncCst|gd�S)zReturn a copy of this Column.�r<)r��self�rA�>/opt/saltstack/salt/lib/python3.10/site-packages/rich/table.py�copytszColumn.copyccs�|jEdHdS)z2Get all cells in the column, not including header.Nr>r?rArArB�cellsxs�zColumn.cellscCs
|jduS)z!Check if this column is flexible.N)r7r?rArArB�flexible}�
zColumn.flexible)r=r')!�__name__�
__module__�__qualname__�__doc__r)�__annotations__r*r+rr,r-r/r1r3r4r
�intr5r6r7r8�boolr9r:r�listr<rrC�propertyrrDrErArArArBr'&sL

r'c@s0eZdZUdZdZeeed<	dZe	ed<dS)�RowzInformation regarding a row.Nr-F�end_section)
rGrHrIrJr-r
rrKrQrMrArArArBrP�s
rPc@s.eZdZUdZeed<	ded<	eed<dS)�_CellzA single cell in a table.r-r%�
renderabler1N)rGrHrIrJrrKrrArArArBrR�s
rRc7@s~eZdZUdZeeed<eeed<ddddej	ddddddddddd	dd
dddddddd
�de
eefdee
dee
deedeedeejdeedededededededededededeeed eed!eed"eed#eed$eed%d&d'd&d(ed)df6d*d+�Zeddddd,�de
eefdedededed)dfd-d.��Zed)efd/d0��Zejded)dfd1d0��Zed)efd2d3��Zed)efd4d5��Zd6d7d8ed)efd9d:�Zd6d7d;d<d)efd=d>�Zed)eeeeeffd?d@��Z e jded)dfdAd@��Z 	B	BdndddddCdDdEddddddF�dGdHdIdHd eed(eed!eedeedJd&dKdLdMdNdeedeedOeedPeedQed)dfdRdS�Z!dddT�dUedHdeedVed)dfdWdX�Z"dodYdZ�Z#	6	7	;	<	)	[dpd\d]�Z$d6d7d;d<d)eefd^d_�Z%ed`eedaeedOed)eefdbdc��Z&d6d7ddedeed)ee'fdfdg�Z(dded)efdhdi�Z)d6d7d;d<deed)efdjdk�Z*d6d7d;d<d`eed)d[fdldm�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 (int, 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_justifyr9�headersrYrZr4r5rr[r\r]r^r_r`rarbrcrdr-rer+r,rfrgrhrir#rjr9r=cGs�g|_g|_||_||_||_||_||_||_t�	|�|_
|	|_|
|_||_
||_|
|_||_||_||_||_|p<d|_|pAd|_||_||_||_||_||_||_t|pYg�|_|jj}|D]}t|t �rp|j!|d�qbt"|j�|_#||�qbdS)Nr()r))$rUrVrYrZr4r5rr[r�unpack�_paddingr^�_expandr`rarbrcrdr]r-r+r,rfrgrhrirjr9rNre�append�
isinstance�str�
add_column�lenr:)r@rYrZr4r5rr[r\r]r^r_r`rarbrcrdr-rer+r,rfrgrhrirjr9rkZ
append_columnr)rArArB�__init__�sD



�zTable.__init__)r\r]r^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)rr\r]r`rarbr^r_rA)�clsr\r]r^r_rkrArArB�grid�s�z
Table.gridcCs|jp|jduS)z-Setting a non-None self.width implies expand.N)rnr4r?rArArBr_szTable.expandcCs
||_dS)zSet expand.N)rn)r@r_rArArBr_"rFcCs4d}|jr|jr|d7}|jr|t|j�d7}|S)z'Get extra width to add to cell content.r�r)rrbrsrU)r@r4rArArB�_extra_width'szTable._extra_widthcCs
t|j�S)zGet the current number of rows.)rsrVr?rArArB�	row_count1rFzTable.row_count�consoler!�indexcCsRt��}|jr||�|j|t|j��7}|j|j}|dur'||�|�7}|S)zGet the current row style.N)r�nullre�	get_stylersrVr-)r@rzr{r-�	row_stylerArArB�
get_row_style6szTable.get_row_style�optionsr"cs��j�|jdur|j��dkrtdd�S|j}t|�����|����|j�����fdd�|jD�}tdd�|D��|}|jdurOtdd�|D��|n|j}t||�}|�	|j
�}|S)Nrcsg|]}������|��qSrA)�update_width��.0�column��_measure_columnrzr6r�rArB�
<listcomp>Qs��z*Table.__rich_measure__.<locals>.<listcomp>cs��|]}|jVqdS�N)Zminimum�r��measurementrArArB�	<genexpr>V��z)Table.__rich_measure__.<locals>.<genexpr>csr�r���maximumr�rArArBr�Yr�)r6r4rrx�sum�_calculate_column_widthsr�r�rU�clampr5)r@rzr��extra_widthZmeasurementsZ
minimum_widthZ
maximum_widthr�rAr�rB�__rich_measure__@s0

����
��
zTable.__rich_measure__cCs|jS)zGet cell padding.)rmr?rArArBr\asz
Table.paddingcCst�|�|_|S)zSet cell padding.)rrlrm)r@r\rArArBr\fsr(r.r0r2)r+r9r,r-r/r1r3r4r5r6r7r8r)r%r*r/r1rr3r$r6r7r8cCsVtt|j�|||p
d|dur|n|j|pd|pd|||	|
|||
|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.
            highlight (bool, optional): Whether to highlight the text. The default of None uses the value of the table (self) object.
            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(N)r:r)r*r+r9r,r-r/r1r3r4r5r6r7r8)r'rsrUr9ro)r@r)r*r+r9r,r-r/r1r3r4r5r6r7r8r�rArArBrrls$'�zTable.add_column�r-rQ�renderablesrQcGsdtddddfdd�}t|�}|j}t|�t|�kr)g|�dgt|�t|��}t|�D]H\}}|t|�krRt||jd�}	|jD]	}
||	td	��qA|j�|	�n||}	|dur`||	d	�q-t	|�rj||	|�q-t
�d
t|�j
�d���|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�rSr%r=NcSs|j�|�dSr�)r<ro)r�rSrArArB�add_cell�szTable.add_row.<locals>.add_cell)r:r9r(zunable to render z1; a string or other renderable object is requiredr�)r'rNrUrs�	enumerater9rVrrorrZNotRenderableError�typerGrP)r@r-rQr�r�Zcell_renderablesrUr{rSr��_rArArB�add_row�s0��
�z
Table.add_rowcCs|jrd|jd_dSdS)z2Add a new section (draw a line after current row).T���N)rVrQr?rArArB�add_section�s�zTable.add_sectionr&c	#s��|jstd�VdS|j}|jdur|j}|j}|��|�||��}t|�|}|j||j	dd��	ddt
dtdddd	f��fd
d�
}|jrY||jt
�|jd�|jd
�EdH|���|�EdH|jry||jt
�|jd�|jd
�EdHdSdS)N�
)r4r9�heightrX�textr-r/r#r=r&cs4t|t�r
�j||dd�n|}�j|�j|d�d�S)NF)r-r9�r/)r�)rprqZ
render_strZrender�update)r�r-r/Zrender_text�rz�render_optionsrArB�render_annotation�s���z1Table.__rich_console__.<locals>.render_annotationztable.title)r-r/z
table.caption)rX)rUrr6r4rxr�r�r�r�r9r rrYrZ
pick_firstrgri�_renderrZrhrj)r@rzr�r6r��widths�table_widthr�rAr�rB�__rich_console__�sN�

����������zTable.__rich_console__cs��j}�j}���fdd�|D�}dd�|D�}�j��j}�jredd�|D�}t|�redd�t||�D�}	�fdd�|D�}
|t|	�}t|||
�}t	|�}
t
|�D]\}}|jrd|	|t|
�||<qSt|�}||kr���
|dd�|D�|�}t|�}||kr�||}t|dgt|�||�}t|�}���fd	d�t||�D�}d
d�|D�}||kr��js��jdur�|�j|kr݈jdur�|nt�j||�}t|||�}dd�t||�D�}|S)
zNCalculate the widths of each column, including padding, not including borders.csg|]	}����|��qSrA)r�r��rzr�r@rArBr�s�z2Table._calculate_column_widths.<locals>.<listcomp>cS�g|]}|jpd�qS�rr��r��_rangerArArBr��cSsg|]
}|jr|jpd�qS�r)rEr7)r��colrArArBr�scSs g|]\}}|jrdn|j�qSr�)rEr�)r�r�r�rArArBr�s��cs&g|]}|jr|jpd�|j��qSr�)rEr4r:r�)�get_padding_widthrArBr�s��cSsg|]}|jduo|j�qSr�)r4r8r�rArArBr�/srcs$g|]\}}�����|�|��qSrA)r�r�)r�r4r�r�rArBr�9���cSr�r�r�r�rArArBr�=r�NcSsg|]\}}||�qSrArA)r��_width�padrArArBr�Hs)r6rU�_get_padding_widthrxr_�any�zipr�r�iterr�rE�next�_collapse_widthsrrsr5�min)r@rzr�r6rUZwidth_rangesr�r��ratiosZfixed_widthsZflex_minimumZflexible_widthZflex_widthsZiter_flex_widthsr{r�r��excess_widthZ
_max_widthZ
pad_widthsrA)rzr�r�r@rBr�sb��
����
��zTable._calculate_column_widthsr��wrapablec
s�t|�}||}t|�rd|rd|dkrdtdd�t||�D���t�fdd�t||�D��}�|}�fdd�t||�D�}t|�rB|sE	|St||�gt|�}	t|||	|�}t|�}||}|rd|dks|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|VqdSr�rA�r�r4Z
allow_wraprArArBr�^s��
�z)Table._collapse_widths.<locals>.<genexpr>c3s(�|]\}}|r|�kr|ndVqdS)rNrAr��Z
max_columnrArBr�as
��
�cs$g|]\}}|�kr|rdnd�qS)rrrAr�r�rArBr�fr�z*Table._collapse_widths.<locals>.<listcomp>)r�r��maxr�r�rsr)
rur�r�r6Ztotal_widthr�Zsecond_max_columnZcolumn_differencer�Z
max_reducerAr�rBr�Ls.��
���zTable._collapse_widths�column_indexr�c
#sr�|j�|j�|j�t��}|dk�|t|j�dk�i�dtdtdtttttff������fdd�}g}|j	}|j
}|jrS||jpEd�||j�}	||	|j
f�||jpXd�}
|jD]}||
|f�q]|jr|||jpnd�||j�}|||jf�|r�t}
t|�D]\}}\}}t||
||||��t|d	d
�p�|j�Vq�d
S|D]\}}t||t|d	d
�p�|j�Vq�d
S)z3Get all the cells with padding and optional header.rr�	first_row�last_rowr=cs���||f�}|r|S�\}}}}�r%�std||�}|s%td||�}�s7�r+d}�r/d}|r3d}|r7d}||||f}|�||f<|S)Nr)�getr�)r�r��cachedr0�right�bottomr.rm�Z_padding_cacher]Zfirst_columnZlast_columnr^r\rArB�get_padding�s*z%Table._get_cells.<locals>.get_paddingr(r1N)r]r^r\r�rsrUrMrrLror}r`r+r)r-rDrar,r*rrrR�getattrr1)r@rzr�r�Zany_paddingr�Z	raw_cells�_appendr}r+Z
cell_style�cellr,Z_Padding�first�lastr-rSrAr�rB�
_get_cellsssR�0�
�����zTable._get_cellscCsT|j\}}}}|jrd}t||�}|js&|dkrd}|t|j�dkr&d}||S)zGet extra width from padding.rr)r\r]�absr^rsrU)r@r�r�Z	pad_rightZpad_leftrArArBr��szTable._get_padding_widthcCs|j}|dkrtdd�S|�|j�}|jdur%t|j||j|��|�Sg}g}|j}|j}	tj}
|�||j|�D]}|
|||j	�\}}
||�|	|
�q:t|rUt
|�nd|r\t
|�n|��|�}|�|jdurkdn|j||jduryd�}|S|j|�}|S)z0Get the minimum and maximum width of the column.rrN)
r6rr�r:r4Zwith_maximumror�r�rSr�r�r5)r@rzr�r�r6Z
padding_widthZ
min_widthsZ
max_widthsZ
append_minZ
append_maxZget_render_widthr�Z_minZ_maxr�rArArBr��sB

��
�����zTable._measure_columnc%
#s�����	jpd�}|���	jpd�}��	fdd�t�	j�D�}tt|��}�	jr6�	jj|t	�	j
�j
�d�nd}|rA�	jsA|��n|}t
��}	�	j}
�	j}�	j}�	j}
�	j}�	j}t
�|r��|j|��|j|��|j|�f�|j|��|j|��|j|�f�|j|��|j|��|j|�fg}|
r��|�|�|�V|	Vng}�	j}�j�tt|��D�]�\}\}}}|o�|�|o�|��sLjsLj	j||nd}d�g}�sшr�t �!��n
�|�|r�|dn|���t|||
�D].\}}}|j"||j#|j$|j%d|j&d�}�j'|j(|�|j��d�}t)�t*|���|�+|�q�t)dd�|D���d	t,t,t
d
ddt-d
t dt,t,t
f
����fdd�������fdd�t||||
�D�|dd�<|�r�|�rk|�rk�|j.|d|
d�|�V|	V||�rqdn|�rvdnd\}}}|j/�0��r�|n	�|j/�j1|j�} t2��D])}!|
�r�|Vt3|�D]\}"}#|#|!EdH|"�s�| V�q�|
�r�|V|	V�q�nt2��D]}!|D]
}#|#|!EdH�q�|	V�q�|�r�|�r�|�r�|j.|d|
d�|�V|	V|�o�|j4}$|�r5|�s�|�s�|$�r5|�s5|�r|t*|�dk�s5|�r��s5|�r&�|j.|d|
d�||�Vn�|j.|d|
d�|�V|	Vq�|�rJ|
�rL�|�5|�|�V|	VdSdSdS)Nr(c3s"�|]\}}���||�VqdSr�)r�)r�r�r�)rzr@rArBr��s
��
�z Table._render.<locals>.<genexpr>)�safer)r4r/r8r3r�r9�r-css�|]}t|�VqdSr�)rs)r�r�rArArBr�Ns�r�r1rr4r-r=csR�rd}n�r	d}|dkr��||�|�S|dkr!��||�|�S��||�|�S)Nr�r0Zmiddle)Z	align_topZalign_middleZalign_bottom)r�r1r4r-)�_Segment�
footer_row�
header_row�
row_heightrArB�
align_cellPsz!Table._render.<locals>.align_cellc
s8g|]\}}}}���||j|�|j���|���qSrA)Z	set_shaper1r-)r�r4Z_cellr�r�)r�r�r}�
max_heightr~rArBr�as
����z!Table._render.<locals>.<listcomp>Zfoot)Zedgerrw�headZmid�row)6r}r-rfr�rUrNr�r�
substituterr[r`Zget_plain_headed_boxr�linerarbrcrdZ	head_leftZ
head_rightZ
head_verticalZmid_leftZ	mid_rightZmid_verticalZ	foot_leftZ
foot_rightZ
foot_verticalZget_toprrrVrr|r�r/r8r3r9Zrender_linesrSr�rsrorrLZget_rowr��stripZbackground_style�rangerrQZ
get_bottom)%r@rzr�r�Ztable_stylerfZ
_column_cellsZ	row_cellsZ_boxZnew_linerUr`rarbrcrdZbox_segmentsrr{r�r�Zrow_cellr�rDr4r�r�r��linesr.r�Z_dividerZdividerZline_noZ	last_cellZ
rendered_cellrQrA)
r�r�rzr�r}r�r�r�r~r@rBr��s*�����


�


�


������
���
����
���"����
�
��������
�z
Table._render)r(r()r=N)rzr!r�r"r=r&),rGrHrIrJrr'rKrPrZ
HEAVY_HEADr
rqr
r rLZBoxrMrrrrt�classmethodrvrOr_�setterrxryrrr�rr\rrr�r�r�r�r�rRr�r�r�r�rArArArBrT�s�
�
�������	�
���
������
���������
�@�
������ 	
��
�!��������	�
���
����
�=����
�
/��
�0��
�A����&���
�I���
�'����rT�__main__)r!)�ReprHighlighter)�timerzTable renderzStar Wars MovieszRich example tabler�)rYrZrjZReleasedZbright_cyanZcyanT)r+r-r8ZTitleZmagentar�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 blackr�zDec 16, 2016zRogue One: A Star Wars Storyz$1,332,439,889r�r=NcCs"t��t�t|��t��dSr�)rz�printZruler9)r�rArArBr)�sr)z
Example TablerXr�zexpand=True�2zwidth=50FZdimrWzrow_styles=['dim', 'none']z%leading=1, row_styles=['dim', 'none']z+show_lines=True, row_styles=['dim', 'none'])IZdataclassesrrr�typingrrrrr	r
rrr
r(rrZ_looprrZ_pickrZ_ratiorrZalignrZjupyterrZmeasurerr\rr�protocolrZsegmentrr-rrr�rr rzr!r"r#r$r%r&r'rPrRrTrGZrich.consoleZrich.highlighterr�Z_timerr��tablerrr�rqr)r9r�r_r4rerdrcrArArArB�<module>s�, 
\


�����



$��