� ]�gY���"�ddlmZmZmZddlmZmZmZmZm Z m Z m Z m Z m Z ddlmZmZddlmZmZddlmZddlmZmZddlmZdd lmZdd lmZdd lm Z m!Z!dd l"m#Z#dd l$m%Z%ddl&m'Z'm(Z(ddl)m*Z*m+Z+erddl,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2eGd�d����Z3eGd�d����Z4Gd�de ��Z5Gd�de��Z6e7dk�r;ddl8m-Z-ddl9m:Z:ddl;m<Z<e<d��5e6ddd �!��Z=e=�>d"d#d$d%�&��e=�>d'd(�)��e=�>d*d d+�,��e=�?d-d.d/��e=�?d0d1d2��e=�?d3d4d5d6d%�7��e=�?d8d9d:��d;e@d<d=fd>�ZAe-��Z,e:��ZBeAd?��e,�Ce=d@�A��d%e=_DeAdB��e,�Ce=��dCe=_EeAdD��e,�Ce=d@�A��d=e=_EdEe=_DdFdGge=_FeAdH��e,�Ce=d@�A��d=e=_EdEe=_DdFdGge=_Fde=_GeAdI��e,�Ce=d@�A��d=e=_EdEe=_DdFdGge=_Fd%e=_Hde=_GeAdJ��e,�Ce=d@�A��d=d=d=��d=S#1swxYwYd=Sd=S)K�)� 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��eZdZUdZdZded< dZded< dZeed< dZ eed< dZ eed< d Z d ed < d Z d ed< dZ ded< dZeeed< dZeeed< dZeeed< dZeeed< dZeed< dZeed< dZeed< ee���Zeded<d"d�Zededfd ���Zedefd!���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. 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. �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�returnc�$�t|g���S)zReturn a copy of this Column.�r>)r��selfs �Z/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/rich/table.py�copyz Column.copyus���t�B�'�'�'�'�c#�$K�|jEd{V��dS)z2Get all cells in the column, not including header.NrArBs rD�cellsz Column.cellsys(�����;���������rFc��|jduS)z!Check if this column is flexible.N)r9rBs rD�flexiblezColumn.flexible~s���z��%�%rF)r?r))!�__name__� __module__� __qualname__�__doc__r+�__annotations__r,r-rr.r/r1r3r5r6r �intr7r8r9r:�boolr;r<r�listr>r rE�propertyrrHrJ�rFrDr)r)&s����������< "�F� �!�!�!�H�!�F� �!�!�!�H� �L�)� � � �-� �L�)� � � �-��E�9����-�%�G�_�%�%�%�[�&+�H�#�+�+�+�M�!+�H��+�+�+���E�8�C�=����\�#�I�x��}�#�#�#�_�#�I�x��}�#�#�#�_��E�8�C�=����w��G�T����R��I�t����C��F�C�O�O�O��%*�U�4�%@�%@�%@�F�D�!� "�@�@�@�(�(�(�(���x� 0�1�����X���&�$�&�&�&��X�&�&�&rFr)c�>�eZdZUdZdZeeed< dZe ed<dS)�RowzInformation regarding a row.Nr/F� end_section) rKrLrMrNr/r rrOrWrQrTrFrDrVrV�s@�������&�&�!%�E�8�I� �%�%�%� ��K�����L�LrFrVc�6�eZdZUdZeed< ded< eed<dS)�_CellzA single cell in a table.r/r&� renderabler3N)rKrLrMrNrrOrrTrFrDrYrY�sB�������#�#� ����!� � � � ��!�!�!�!�"�"rFrYc7���eZdZUdZeeed<eeed<ddddej ddddddddddd dd d dddd d dd �de ee fde 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*�Zeddddd+�de ee fdedededed)df d,���Zed)efd-���Zejded)dfd.���Zed)efd/���Zed)efd0���Zd1d2d3ed)efd4�Zd1d2d5d6d)efd7�Zed)eeeeeffd8���Z e jded)dfd9���Z d\ddddd;d<d=dddddd>� d?d@dAd@d e ed(e ed!e ede edBd&dCdDdEdFde ede edGe edHe edIed)dfdJ�Z!dddK�dLe d@de edMed)dfdN�Z"d]dO�Z# d^dQ�Z$d1d2d5d6d)eefdR�Z%edSeedTeedGed)eefdU���Z&d1d2dVedWed)ee'fdX�Z(dVed)efdY�Z)d1d2d5d6dWed)efdZ�Z*d1d2d5d6dSeed)dPfd[�Z+dS)_�Tablea A 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�captionr6r7r�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_justifyr;�headersrarbr6r7rrcrdrerfrgrhrirjrkrlr/rmr-r.rnrorprqr$rrr;r?c��g|_g|_||_||_||_||_||_||_tj |��|_ | |_ | |_ | |_ | |_| |_||_||_||_||_|pd|_|pd|_||_||_||_||_||_||_t9|pg��|_|jj}|D]R}t?|t@��r|�!|����.tE|j��|_#||���SdS)Nr*)r+)$r]r^rarbr6r7rrcr�unpack�_paddingrf�_expandrhrirjrkrlrer/r-r.rnrorprqrrr;rRrm�append� isinstance�str� add_column�lenr<)rCrarbr6r7rrcrdrerfrgrhrirjrkrlr/rmr-r.rnrorprqrrr;rs� append_columnr+s rD�__init__zTable.__init__�s\��:&(�� �!�� ��� ��� ��� �"������ �� ���w�/�/�� � �� ��� �&���&���"���$����� � 0����� �(�.�B���(�.�B���(���&���*���.;���0?���"���/3�J�4D�"�/E�/E���� �+� �� &� &�F��&�#�&�&� &����v��.�.�.�.� #�D�L� 1� 1�� �� �f�%�%�%�%�  &� &rF)rdrerfrgc � �||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)rrdrerhrirjrfrgrT)�clsrdrerfrgrss rD�gridz Table.grid�s8��*�s� ���-������  �  �  � rFc�"�|jp|jduS)z-Setting a non-None self.width implies expand.N)rwr6rBs rDrgz Table.expands���|�5�t�z��5�5rFc��||_dS)z Set expand.N)rw)rCrgs rDrgz Table.expand#s���� � � rFc�r�d}|jr |jr|dz }|jr|t|j��dz z }|S)z'Get extra width to add to cell content.r�r)rrjr|r])rCr6s rD� _extra_widthzTable._extra_width(sM���� �8� ��� � �Q�J�E� �8� +� �S���&�&��*� *�E�� rFc�*�t|j��S)zGet the current number of rows.)r|r^rBs rD� row_countzTable.row_count2s���4�9�~�~�rF�consoler"�indexc��tj��}|jr8||�|j|t |j��z��z }|j|j}|�||�|��z }|S)zGet the current row style.)r�nullrm� get_styler|r^r/)rCr�r�r/� row_styles rD� get_row_stylezTable.get_row_style7sx��� � � �� �?� V� �W�&�&�t��u�s�4�?�?S�?S�7S�'T�U�U� U�E��I�e�$�*� � � � �W�&�&�y�1�1� 1�E�� rF�optionsr#c ������ ��j� |j�|j� � dkrtdd��S|j}t |����� |z ������� |j���� �fd�|jD��}t d�|D����|z}|j�t d�|D����|zn|j}t||��}|� |j ��}|S)Nrc�P��g|]"}�������|����#SrT)� update_width)�.0�column�_measure_columnr�r8r�s ����rD� <listcomp>z*Table.__rich_measure__.<locals>.<listcomp>RsE��� � � �� �O�G�W�%9�%9�)�%D�%D�f� M� M� � � rFc3�$K�|] }|jV�� dS�N)�minimum�r�� measurements rD� <genexpr>z)Table.__rich_measure__.<locals>.<genexpr>W�%����D�D� � �#�D�D�D�D�D�DrFc3�$K�|] }|jV�� dSr���maximumr�s rDr�z)Table.__rich_measure__.<locals>.<genexpr>Zr�rF) r8r6rr��sum�_calculate_column_widthsr�r�r]�clampr7) rCr�r�� extra_width� measurements� minimum_width� maximum_widthr�r�r8s `` @@rD�__rich_measure__zTable.__rich_measure__AsG�������%� � �:� !�� �I� �q�=�=��q�!�$�$� $��'� �� � )� )���-�-�i�+�.E�F�F� � � � � � �.�� � � � � � � ��,� � � � � �D�D�|�D�D�D� D� D�{� R� � � �"� �D�D�|�D�D�D� D� D�{� R� R��� � "�-��?�?� �!�'�'���7�7� ��rFc��|jS)zGet cell padding.)rvrBs rDrdz Table.paddingbs ���}�rFc�8�tj|��|_|S)zSet cell padding.)rrurv)rCrds rDrdz Table.paddinggs�� ��w�/�/�� �� rFr*r0r2r4) r-r;r.r/r1r3r5r6r7r8r9r:r+r&r,r1r3rr5r%r8r9r:c ��tt|j��|||pd|�|n|j|pd|pd||| | | | | |���}|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-r;r.r/r1r3r5r6r7r8r9r:)r)r|r]r;rx)rCr+r,r-r;r.r/r1r3r5r6r7r8r9r:r�s rDr{zTable.add_columnms���N��t�|�$�$���%�+��#,�#8�i�i�d�n�%�+���+�2��������� � � ��" � ���F�#�#�#�#�#rF�r/rW� renderablesrWc���dtddddfd�}t|��}|j}t|��t|��kr'g|�dgt|��t|��z z�}t |��D]�\}}|t|��krTt||j���} |jD]} || td�����|j�| ��n||} |� || d����t|��r || |����tj d t|��j �d ����|j�t||� ����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�rZr&r?Nc�:�|j�|��dSr�)r>rx)r�rZs rD�add_cellzTable.add_row.<locals>.add_cell�s�� �M� � �� ,� ,� ,� ,� ,rF)r<r;r*zunable to render z1; a string or other renderable object is requiredr�)r)rRr]r|� enumerater;r^r rxrr�NotRenderableError�typerKrV) rCr/rWr�r��cell_renderablesr]r�rZr��_s rD�add_rowz Table.add_row�s���$ -�V� -�1A� -�d� -� -� -� -�>B�+�=N�=N���,�� �� � �3�w�<�<� /� /� �!� ���3�w�<�<�#�.>�*?�*?�?�@� � �"+�+;�!<�!<� � � �E�:���G� � �$�$��u���G�G�G����/�/�A��H�V�T�"�X�X�.�.�.�.�� �#�#�F�+�+�+�+� �����!�����$�$�$�$��z�*�*� �����,�,�,�,��/�t��Z�(8�(8�(A�t�t�t���� � ����5�k�B�B�B�C�C�C�C�CrFc�<�|jrd|jd_dSdS)z2Add a new section (draw a line after current row).T�����N)r^rWrBs rD� add_sectionzTable.add_section�s,�� �9� -�(,�D�I�b�M� %� %� %� -� -rFr'c #���K�|jstd��V�dS|j}|j�|j}|j}|��|�||z ����}t|��|z}|�||j d���� ddtdtdddd f��fd � }|j r6||j tj|jd ��|j� ��Ed{V��|���|��Ed{V��|jr8||jtj|jd ��|j� ��Ed{V��dSdS)N� )r6r;�heightr`�textr/r1r$r?r'c���t|t��r��||d���n|}��|��|������S)NF)r/r;�r1)r�)ryrz� render_str�render�update)r�r/r1� render_textr��render_optionss ��rD�render_annotationz1Table.__rich_console__.<locals>.render_annotation�sl��� �d�C�(�(���"�"�4�u��"�F�F�F�� � �>�>��^�%:�%:�7�%:�%K�%K�"��� rFz table.title)r/r1z table.caption)r`)r]rr8r6r�r�r�r�r�r;r!rrar� pick_firstrorq�_renderrbrprr) rCr�r�r8r��widths� table_widthr�r�s ` @rD�__rich_console__zTable.__rich_console__�s��������|� ��$�-�-� � � � �F��%� � �:� !�� �I��'� ��.�.� �W�)�)�)�k�*A�B�B� � ���&�k�k�K�/� � �������(� � �� JR� � �� �#,� �7F� � � � � � � � � � �:� �(�(�� ��&�t�'7��G�G��*���� � � � � � � � �<�<����@�@�@�@�@�@�@�@�@� �<� �(�(�� ��&�t�'9�?�K�K��,���� � � � � � � � � � � rFc�������j}�j}���fd�|D��}d�|D��}�j��j}�jr�d�|D��}t |��r�d�t ||��D��} �fd�|D��} |t| ��z } t| || ��} t| ��} t|��D]'\}}|j r| |t| ��z||<�(t|��}||kr��� |d�|D��|��}t|��}||kr7||z }t|dgt|��z||��}t|��}���fd�t ||��D��}d �|D��}||kr�js�j�\|�j|z krN�j�|nt#�j|z |��}t||z |��}d �t ||��D��}|S) zNCalculate the widths of each column, including padding, not including borders.c�>��g|]}����|����SrT)r�)r�r�r�r�rCs ���rDr�z2Table._calculate_column_widths.<locals>.<listcomp>s8��� � � �?E�D� � ��'�6� :� :� � � rFc� �g|] }|jpd�� S�rr��r��_ranges rDr�z2Table._calculate_column_widths.<locals>.<listcomp>s��A�A�A�&�&�.�%�A�A�A�ArFc�.�g|]}|j� |jpd��S�r)rJr9)r��cols rDr�z2Table._calculate_column_widths.<locals>.<listcomp>s%��H�H�H��3�<�H�c�i�n�1�H�H�HrFc�4�g|]\}}|jrdn|j��Sr�)rJr�)r�r�r�s rDr�z2Table._calculate_column_widths.<locals>.<listcomp>s9�� � � �&��� ��<�A�A�f�n� � � rFc�R��g|]#}|j� |jpd�|j��z��$Sr�)rJr6r<)r�r��get_padding_widths �rDr�z2Table._calculate_column_widths.<locals>.<listcomp>sK��� � � ���� ��\�&�Q�*;�*;�F�M�*J�*J�J� � � rFc�0�g|]}|jduo|j ��Sr�)r6r:)r�r�s rDr�z2Table._calculate_column_widths.<locals>.<listcomp>.s)��U�U�U�6�&�,�$�&�=�v�~�+=�U�U�UrFrc�j��g|]/\}}�����|��|����0SrT)r�r�)r�r6r�r�r�rCs ���rDr�z2Table._calculate_column_widths.<locals>.<listcomp>8sM������!�E�6��$�$�W�g�.B�.B�5�.I�.I�6�R�R���rFc� �g|] }|jpd�� Sr�r�r�s rDr�z2Table._calculate_column_widths.<locals>.<listcomp><s��E�E�E�f�f�n�)��E�E�ErFNc��g|] \}}||z�� SrTrT)r��_width�pads rDr�z2Table._calculate_column_widths.<locals>.<listcomp>Gs ��N�N�N�{�v�s�f�s�l�N�N�NrF)r8r]�_get_padding_widthr�rg�any�zipr�r�iterr�rJ�next�_collapse_widthsrr|r7�min)rCr�r�r8r]� width_rangesr�r��ratios� fixed_widths� flex_minimum�flexible_width� flex_widths�iter_flex_widthsr�r�r�� excess_width� _max_width� pad_widthsr�s``` @rDr�zTable._calculate_column_widths s��������%� ��,�� � � � � � �IP� � � � �B�A�L�A�A�A�� �3���'� � �;� U�H�H��H�H�H�F��6�{�{� U� � �*-�l�G�*D�*D� � � � � � � � �")� � � � � "+�S��->�->�!>��.�~�v�|�T�T� �#'� �#4�#4� �%.�w�%7�%7�U�U�M�E�6���U�(4�U�(;�d�CS�>T�>T�(T��u� ���&�k�k� � �� "� "��*�*��U�U�W�U�U�U����F� �f�+�+�K��Y�&�&�*�Y�6� �%�l�Q�C�#�f�+�+�4E�v�v�V�V��!�&�k�k� �������%(���%9�%9����L�F�E� �E�E�E�F� �)� #� #�� � #� �N� &�;�$�.�;�:V�+W�+W��>�)�� ����+�5�y�A�A� � *�*�{�*B�F�K�K�J�N�N�c�&�*�6M�6M�N�N�N�F�� rFr��wrapablec�� �t|��}||z }t|��r�|r�|dkr�td�t||��D����� t� fd�t||��D����}� |z }� fd�t||��D��}t|��r|snOt ||��gt |��z} t ||| |��}t|��}||z }|r|dk��|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. rc3�$K�|] \}}|�|V�� dSr�rT)r�r6� allow_wraps rDr�z)Table._collapse_widths.<locals>.<genexpr>]s?����!�!�/�e�Z�J�!��!�!�!�!�!�!rFc3�6�K�|]\}}|r|�kr|ndV��dS)rNrT�r�r6r�� max_columns �rDr�z)Table._collapse_widths.<locals>.<genexpr>`sN�����(�(�)��z�(�F�E�Z�,?�,?�E�E�Q�(�(�(�(�(�(rFc�.��g|]\}}|�kr|rdnd��S)rrrTr�s �rDr�z*Table._collapse_widths.<locals>.<listcomp>es@������)��z�!�J�.�.�:�.�Q�Q�A���rF)r�r��maxr�r�r|r) r�r�r�r8� total_widthr��second_max_column�column_differencer�� max_reducer�s @rDr�zTable._collapse_widthsKsm����&�k�k� �"�Y�.� � �x�=�=� 7�� 7�,��"2�"2� �!�!�36�v�x�3H�3H�!�!�!��� �%(�(�(�(�(�-0���-B�-B�(�(�(�%�%�!�%/�1B�$B�!�����-0���-B�-B������6�{�{��*;���!�,�0A�B�B�C�c�&�k�k�Q� �%�l�F�J��O�O��!�&�k�k� �*�Y�6� �'� 7�,��"2�"2�(� rF� column_indexr�c #�������K�|j�|j�|j�t���}|dk�|t |j��dz k�i�dt dt dtttttff������fd� }g}|j }|j }|j r5||j pd��||j ��z} || |j f��||jpd��} |jD]} || | f���|jr5||jpd��||j��z} || |jf��|r_t&} t)|��D]F\}}\}}t+|| ||||����t-|dd ��p|j��V��Gd S|D].\}}t+||t-|dd ��p|j��V��/d S) z3Get all the cells with padding and optional header.rr� first_row�last_rowr?c������||f��}|r|S� \}}}}� r*� std||z ��}|std||z ��}� s� rd}� rd}|rd}|rd}||||f}|�||f<|S)Nr)�getr�)r�r��cachedr2�right�bottomr0rv�_padding_cachere� first_column� last_columnrfrds ������rD� get_paddingz%Table._get_cells.<locals>.get_padding�s����#�'�'��H�(=�>�>�F�� �� �'.� $�C����� 2�#�0��q�$��,�/�/�D��2� ��C�&�L�1�1�F�� ����D����E����C����F��U�F�D�1�H�4<�N�I�x�0� 1��OrFr*r3N)rerfrdr�r|r]rQr rPrxr�rhr-r+r/rHrir.r,rrrY�getattrr3)rCr�r�r�� any_paddingr� raw_cells�_appendr�r-� cell_style�cellr.�_Padding�first�lastr/rZrrerrrfrds @@@@@@rD� _get_cellszTable._get_cellsrs�����������  �0���=���,���'�l�l� �#�q�(� �"�c�$�,�&7�&7�!�&;�;� �MO�� �4� �4� �E�#�s�C�QT�BT�<U� � � � � � � � � � � �2?A� ��"���%� � � � 3�$�9�T�%6�%<�"�=�=� � ��#�A�A��L� �G�\�6�=�1� 2� 2� 2��Y�v�|�1�r�2�2� ��L� (� (�D� �G�Z��&� '� '� '� '� � � 3�$�9�T�%6�%<�"�=�=� � ��#�A�A��L� �G�\�6�=�1� 2� 2� 2� � ��H�4C�I�4N�4N� � �0��t�0�e�Z����H�Z���U�D�)A�)A�B�B��J� �D�9�9�L�V�_������� � �&/� � �!��z�����J� �D�9�9�L�V�_������� � rFc�d�|j\}}}}|jr|dkrtd||z ��}||zS)zGet extra width from padding.r)rdrer�)rCr�r�� pad_right�pad_lefts rDr�zTable._get_padding_width�sG��$(�L�!��9�a�� � � 8��a����q�(�Y�"6�7�7���)�#�#rFc��|j}|dkrtdd��S|�|j��}|j�3t|j|z|j|z���|��Sg}g}|j}|j} tj} |�||j|��D]-} | ||| j ��\} } || ��| | ���.t|rt|��nd|rt|��n|���|��}|� |j �dn |j |z|j�dn |j|z��}|S)z0Get the minimum and maximum width of the column.rrN) r8rr�r<r6� with_maximumrxrrrZr�r�r7)rCr�r�r�r8� padding_width� min_widths� max_widths� append_min� append_max�get_render_widthr�_min�_maxr�s rDr�zTable._measure_column�s����%� � �q�=�=��q�!�$�$� $��/�/�� �>�>� � �<� #��� �}�,�f�l�]�.J����l�9�%�%� &�!#� � "� ��&� ��&� �&�?���O�O�G�V�]�F�C�C� � �D�)�)�'�7�D�O�L�L�J�D�$� �J�t� � � � �J�t� � � � �!�)� 0�C� �O�O�O�q�)� 8�C� �O�O�O�y� � � �,�y� !� !� �"�'�'��$�,�D�D�&�2B�]�2R��$�,�D�D�&�2B�]�2R� � � ��rFc #�� ���%�&�'�(�)�*�+�,K����jpd��}|���jpd��z}��fd�t�j��D��}t t |���}�jr4�j�|t�j �j �����nd}|r�j s|� ��n|}tj��} �j} �j } �j} �j} �j}�j}t�%|r��%|j|���%|j|���%|j|��f�%|j|���%|j|���%|j|��f�%|j|���%|j|���%|j|��fg}| r%�%|�|��|��V�| V�ng}�j}�j�(tt=|����D�]9\}\}}}|o| �)|o| �'�)s�'s�j|| z nd}d�*g}�)s�'rtAj!���,n�(|�| r|dz n|�����,t ||| ��D]�\}}}|�"||j#|j$|j%d|j&���}��'|j(|�(|j���,z���}tS�*tU|�����*|�+|����tSd�|D�����+dtXtXtd d d tZd t@d tXtXtf �%�'�)�+fd� �&�%�&�(�*�,fd�t |||| ��D��|dd�<|r�|r*| r(�%|�.|d| ���|��V�| V�||rdn|rdnd\}}}|j/�0��r|n�%|j/�,j1|jz��} te�*��D];}!| r|V�tg|��D]\}"}#|#|!Ed{V��|"s| V��| r|V�| V��<n)te�*��D]}!|D]}#|#|!Ed{V���| V��|r,|r*| r(�%|�.|d| ���|��V�| V�|o|j4}$|rv|s|s|$rp|sn| r|tU|��dz ksV| r�)sR|r(�%|�.|d| ���|z|��V�n$�%|�.|d| ���|��V�| V���;|r)| r)�%|�5|��|��V�| V�dSdSdS)Nr*c3�L�K�|]\}}���||��V��dSr�)r)r�r�r�r�rCs ��rDr�z Table._render.<locals>.<genexpr>�sK����� � �$� �f� �O�O�G�\�6� :� :� � � � � � rF)�safer)r6r1r:r5r�r;�r/c3�4K�|]}t|��V��dSr�)r|)r�rs rDr�z Table._render.<locals>.<genexpr>Es(����9�9�4�S��Y�Y�9�9�9�9�9�9rFrr3rr6r/r?c����rd}n�rd}|dkr��||�|��S|dkr��||�|��S��||�|��S)Nrr2�middle)� align_top� align_middle� align_bottom)rr3r6r/�_Segment� footer_row� header_row� row_heights ����rD� align_cellz!Table._render.<locals>.align_cellGs���� �%�'�H�H��%�$�H��u�$�$�#�-�-�d�E�:�u�M�M�M���)�)�#�0�0��u�j�%�P�P�P��,�,�T�5�*�e�L�L�LrFc ���g|]@\}}}}���||j|�|j��� z��|�����ASrT)� set_shaper3r/) r�r6�_cellrr�r*r.r�� max_heightr�s �����rDr�z!Table._render.<locals>.<listcomp>Xsy��� � � �/�E�5�$���"�"��J�����!� �%�+�.�.��:� �� �� � � � � rF�foot)�edgerr��head�mid�row)6r�r/rnr�r]rRr�r� substituterrcrh�get_plain_headed_boxr�linerirjrkrl� head_left� head_right� head_vertical�mid_left� mid_right� mid_vertical� foot_left� foot_right� foot_vertical�get_topr�rr^rr�r�r1r:r5r;� render_linesrZr�r|rxr rP�get_rowr��strip�background_style�rangerrW� get_bottom)-rCr�r�r�� table_stylern� _column_cells� row_cells�_box�new_liner]rhrirjrkrl� box_segmentsr�r�rr�row_cellr7rHr6rr�r��linesr0r�_divider�divider�line_no� last_cell� rendered_cellrWr*r.r+r�r,r2r-r�s-`` @@@@@@@@rDr�z Table._render�s����������������'�'�� �(8�b�9�9� �"�W�%6�%6�t�7H�7N�B�%O�%O�O� � � � � � �(1�$�,�(?�(?� � � � �.2�#�}�2E�-F�-F� � �x� �D�H� � ��i�� �w�7G�H�H� � � � �� �/3�U�4�;K�U�t�(�(�*�*�*�QU���<�>�>���,���&� ��&� ��N� ��_� ��,���� � ��H�T�^�\�:�:��H�T�_�l�;�;��H�T�/��>�>�� �H�T�]�L�9�9��H�T�^�\�:�:��H�T�.� �=�=�� �H�T�^�\�:�:��H�T�_�l�;�;��H�T�/��>�>���L�"� ��h�t�|�|�F�3�3�\�B�B�B�B�B�������L��*� ��%� �.7�� �8R�8R�.S�.S�v #�v #� *�E�*�E�4���.�;�J��-�+�J�#��+5��� �%�+�-�.�.�� � �J�/1�E�� �Z� �!�J�L�L� � �%�I�!�M�'� �+N�5�1�9�9��O�O��� �(+�6�8�W�'E�'E� $� $�#��t�V�!(����"�N�"�N�#�_��$�.� "0�"�"�� �,�,��O�"�#�)�D�J�/�/�)�;�-���� !��S��Z�Z�8�8� �� � �U�#�#�#�#��9�9�5�9�9�9�9�9�J� M��4��=�)� M�/� M�� M��  M� �d�7�m�$�  M� M� M� M� M� M� M� M� M�" � � � � � � � �36�f�h��w�2W�2W� � � �E�!�!�!�H�� #��#�K�#�"�(�� � �V�V�)� �D�D�l������#�N�N�N�(4�%�5W�Q�Q�4�FV�a�a�UV�(X�%��e�X�  �}�*�*�,�,��H�H�!�� � �y�'A�H�N�'R���� %�Z�0�0� #� #�G� �#�"� � � �4=�e�4D�4D�*�*�0� �=�#0��#9�9�9�9�9�9�9�9�(�*�")�M�M�M�� �$�#� � � �"�N�N�N�N� #� %�Z�0�0�#�#�G�).�:�:� �#0��#9�9�9�9�9�9�9�9�9�"�N�N�N�N�� �� �+� ��h��L�L���i�L�@�@�,�����������1�#�/�K�� #�� #�w� #�+� #��#�(�#�-2�c�)�n�n�q�6H�-H�-H�(�.I�-7�.I���&�h� �L�L���Y�L�G�G�'�Q�(������� '�h� �L�L���Y�L�G�G�������#�N�N�N�� � �I� ��(�4�?�?�6�2�2�L�A�A� A� A� A��N�N�N�N�N� � � � rF)r*r*)r?N)r�r"r�r#r?r'),rKrLrMrNr r)rOrVr� HEAVY_HEADrrzr r!rP�BoxrQrrrr~� classmethodr�rSrg�setterr�r�r�rr�r rdr{r�r�r�r�r�rYrr�r�r�rTrFrDr\r\�s����������>�&�\���� �s�)�O�O�O� %)�&*�#�#'�!$��#'�%+�!&��� �!�� ��!�48�,:�,:�,0�+/�-1�)1�+3��7>&�>&�>&���� �$�>&���!�>&��(�#� >&� ��}� >&� �C�=� >&��c�g� �>&��4�.�>&�#�>&��>&��>&��>&��>&��>&��>&� �!>&�"�#>&�$�%>&�&�X�i�0�1�'>&�(�y�)�)>&�*�y�)�+>&�,�y�)�->&�.�i�(�/>&�0 � �*�1>&�2'�3>&�4)�5>&�6�7>&�8 �9>&�>&�>&�>&�@�&'�!%���  � � ���� �$� �#� ��  � �  � �  � � � � ��[� �@�6��6�6�6��X�6� �]��T��d�����]����c�����X����3�����X���Y��s��y������ ��+;�� �����B���s�C��c�1�2�����X�� �^��0��W�����^��$&�#%�8$� -1�$(�,0�%)�#)�*/�%/�#�#'�#'�#��!8$�8$�8$� �8$�!�8$� �y�)� 8$� �D�>� 8$��y�)�8$�� �"�8$�!�8$�(�8$�#�8$���}�8$��C�=�8$��C�=�8$���}�8$� �!8$�" �#8$�8$�8$�8$�z&*�!� -D�-D�-D��/�0�-D�� �"�-D�� -D� � -D�-D�-D�-D�^-�-�-�-� -� �-�+;�-� �-�-�-�-�^>� �>�+;�>� �c��>�>�>�>�@�$��#�Y�$�*.�t�*�$�AD�$� �c��$�$�$��[�$�LG� �G�03�G�=C�G� �%��G�G�G�G�R$�s�$�s�$�$�$�$�&��&�"�&�� &� � &�&�&�&�Ps� �s�+;�s�EI�#�Y�s� �s�s�s�s�s�srFr\�__main__)r")�ReprHighlighter)�timerz Table renderzStar Wars MovieszRich example tabler)rarbrr�Released� bright_cyan�cyanT)r-r/r:�Title�magentar#z Box Office�green)r1r/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?Nc��t���t�t|����t���dSr�)r��print�ruler;)r�s rDr+r+�s8�� �M�M�O�O�O� �L�L��4��� )� )� )� �M�M�O�O�O�O�OrFz Example Tabler`r�z expand=True�2zwidth=50F�dimr_zrow_styles=['dim', 'none']z%leading=1, row_styles=['dim', 'none']z+show_lines=True, row_styles=['dim', 'none'])I� dataclassesrrr�typingrrrr r r r r rr*rr�_looprr�_pickr�_ratiorr�alignr�jupyterr�measurerrdrr�protocolr�segmentrr/rrr�r r!r�r"r#r$r%r&r'r)rVrYr\rK� rich.console�rich.highlighterr]�_timerr^�tabler{r�rzr+r;rfrgr6rmrlrkrTrFrD�<module>rxs"��1�1�1�1�1�1�1�1�1�1� � � � � � � � � � � � � � � � � � � � � � ���������-�-�-�-�-�-�-�-�������2�2�2�2�2�2�2�2�&�&�&�&�&�&�!�!�!�!�!�!� � � � � � �/�/�/�/�/�/�/�/�#�#�#�#�#�#�������#�#�#�#�#�#�#�#� � � � � � � � ������������������� �Z&�Z&�Z&�Z&�Z&�Z&�Z&� ��Z&�z �M�M�M�M�M�M�M� ��M�#�#�#�#�#�J�#�#�#�D �D �D �D �D �L�D �D �D �N �z���$�$�$�$�$�$�0�0�0�0�0�0������� ��~� � �G/�G/���$�(�#� � � �� ��� �]�&�$� � � � � ���� ��2�2�2� ����w�g��F�F�F� � � � � .� � � � � � � �n�&?��P�P�P� � � � � /� ��� � � � � � � � � *� � � � �  �� �� � � � � �'�)�)��#�O�%�%� �������� � �e�X� �.�.�.��� ���}����� � �e������ ���z����� � �e�X� �.�.�.��� ��� �!�6�?�����+�,�,�,�� � �e�X� �.�.�.��� ��� �!�6�?����� ���6�7�7�7�� � �e�X� �.�.�.��� ��� �!�6�?�������� ���<�=�=�=�� � �e�X� �.�.�.�OG/�G/�G/�G/�G/�G/�G/�G/�G/�G/�G/�G/����G/�G/�G/�G/�G/�G/� �s�1HL�L� L
Memory