
    жvg                      .   d dl mZmZmZ d dlmZmZmZmZm	Z	m
Z
mZmZmZ ddlmZmZ ddlmZmZ ddlmZ ddlmZmZ ddlmZ dd	lmZ dd
lmZ ddlm Z m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z'm(Z( ddl)m*Z*m+Z+ erddl,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2 e G d d                      Z3e G d d                      Z4 G d de	          Z5 G d de          Z6e7dk    rAd dl8m-Z- d dl9m:Z: d dl;m6Z6 ddl<m=Z=  e=d          5   e6dd d!"          Z>e>?                    d#d$d%d&'           e>?                    d(d)*           e>?                    d+d!d,-           e>@                    d.d/d0           e>@                    d1d2d3           e>@                    d4d5d6d7d&8           e>@                    d9d:d;           d<eAd=d>fd?ZB e-            Z, e:            ZC eBd@           e,D                    e>dAB           d&e>_E         eBdC           e,D                    e>           dDe>_F         eBdE           e,D                    e>dAB           d>e>_F        dFe>_E        dGdHge>_G         eBdI           e,D                    e>dAB           d>e>_F        dFe>_E        dGdHge>_G        de>_H         eBdJ           e,D                    e>dAB           d>e>_F        dFe>_E        dGdHge>_G        d&e>_I        d e>_H         eBdK           e,D                    e>dAB           d>d>d>           d>S # 1 swxY w Y   d>S d>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                      e Zd ZU dZdZded<   	 dZded<   	 dZeed<   	 dZ	eed<   	 dZ
eed<   	 d	Zd
ed<   	 dZded<   	 dZded<   	 dZee         ed<   	 dZee         ed<   	 dZee         ed<   	 dZee         ed<   	 dZeed<   	 dZeed<   	  ee          Zed         ed<   d!dZeded         fd            Zedefd             ZdS )"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returnc                 $    t          | g           S )zReturn a copy of this Column.r=   )r   selfs    S/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/pip/_vendor/rich/table.pycopyzColumn.copyr   s    tB''''    c              #   $   K   | j         E d{V  dS )z2Get all cells in the column, not including header.Nr@   rA   s    rC   cellszColumn.cellsv   s(       ;rE   c                     | j         duS )z!Check if this column is flexible.N)r9   rA   s    rC   flexiblezColumn.flexible{   s     z%%rE   )r>   r)   ) __name__
__module____qualname____doc__r+   __annotations__r,   r-   r   r.   r/   r1   r3   r5   r6   r   intr7   r8   r9   r:   boolr;   r   listr=   r	   rD   propertyr   rG   rI    rE   rC   r)   r)   &   s         <  "F!!!H!F!!!H L)   - L)   -E9-%G_%%%[&+H#+++M!+H+++E8C=\#Ix}###_#Ix}###_E8C=wGTRFCOOO%*U4%@%@%@FD!"@@@( ( ( ( x 01    X &$ & & & X& & &rE   r)   c                   >    e Zd ZU dZdZee         ed<   	 dZe	ed<   dS )RowzInformation regarding a row.Nr/   Fend_section)
rJ   rK   rL   rM   r/   r   r   rN   rV   rP   rS   rE   rC   rU   rU      s@         &&!%E8I%%% KLLrE   rU   c                   6    e Zd ZU dZeed<   	 ded<   	 eed<   dS )_CellzA single cell in a table.r/   r&   
renderabler3   N)rJ   rK   rL   rM   r   rN   r   rS   rE   rC   rX   rX      sB         ##!    !!!!""rE   rX   c            7          e Zd ZU dZee         ed<   ee         ed<   ddddej	        ddddddddddd	dd
ddddddddde
eef         dee         dee         dee         dee         deej                 dee         dededededededededededeee                  d ee         d!ee         d"ee         d#ee         d$ee         d%d&d'd&d(ed)df6d*Zeddddd+de
eef         dedededed)d fd,            Zed)efd-            Zej        ded)dfd.            Zed)efd/            Zed)efd0            Zd1d2d3ed)efd4Zd1d2d5d6d)efd7Zed)eeeeef         fd8            Z e j        ded)d fd9            Z 	 	 d\dddd;d<d=dddddd>d?d@dAd@d ee         d!ee         dee         dBd&dCdDdEdFdee         dee         dGee         dHee         dIed)dfdJZ!dddKdLed@         dee         dMed)dfdNZ"d]dOZ#	 	 	 	 	 	 d^dQZ$d1d2d5d6d)ee         fdRZ%edSee         dTee         dGed)ee         fdU            Z&d1d2dVedWed)ee'         fdXZ(dVed)efdYZ)d1d2d5d6dWed)efdZZ*d1d2d5d6dSee         d)dPfd[Z+dS )_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 (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)r   r   FTr   noneztable.headerztable.footercenter)titlecaptionr6   r7   r   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	highlightheadersr`   ra   r6   r7   r   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   r/   rl   r-   r.   rm   rn   ro   rp   r$   rq   rr   r>   c                   g | _         g | _        || _        || _        || _        || _        || _        || _        t          j	        |          | _
        |	| _        |
| _        || _        || _        || _        || _        || _        || _        || _        |pd| _        |pd| _        || _        || _        || _        || _        || _        || _        t9          |pg           | _        | j         j        }|D ]R}t?          |t@                    r| !                    |           .tE          | j                   |_#         ||           Sd S )Nr*   )r+   )$r\   r]   r`   ra   r6   r7   r   rb   r   unpack_paddingre   _expandrg   rh   ri   rj   rk   rd   r/   r-   r.   rm   rn   ro   rp   rq   rr   rQ   rl   append
isinstancestr
add_columnlenr;   )rB   r`   ra   r6   r7   r   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   r/   rl   r-   r.   rm   rn   ro   rp   rq   rr   rs   append_columnr+   s                                rC   __init__zTable.__init__   s\   : &(!	

" w// &&"$ 0
(.B(.B(&*.;0?"/3J4D"/E/E+ 	& 	&F&#&& &v.... #DL 1 1f%%%%	& 	&rE   )rc   rd   re   rf   c                      | |d||ddd||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)r   rc   rd   rg   rh   ri   re   rf   rS   )clsrc   rd   re   rf   rs   s         rC   gridz
Table.grid   s8    * s-

 

 

 
	
rE   c                 "    | j         p| j        duS )z-Setting a non-None self.width implies expand.N)rw   r6   rA   s    rC   rf   zTable.expand  s     |5tz55rE   c                     || _         dS )zSet expand.N)rw   )rB   rf   s     rC   rf   zTable.expand   s     rE   c                 r    d}| j         r| j        r|dz  }| j         r|t          | j                  dz
  z  }|S )z'Get extra width to add to cell content.r      r   )r   ri   r|   r\   )rB   r6   s     rC   _extra_widthzTable._extra_width%  sM     8 	 	QJE8 	+S&&**ErE   c                 *    t          | j                  S )zGet the current number of rows.)r|   r]   rA   s    rC   	row_countzTable.row_count/  s     49~~rE   consoler"   indexc                    t          j                    }| j        r8||                    | j        |t	          | j                  z                     z  }| j        |         j        }|||                    |          z  }|S )zGet the current row style.)r   nullrl   	get_styler|   r]   r/   )rB   r   r   r/   	row_styles        rC   get_row_stylezTable.get_row_style4  sx    
? 	VW&&tus4??S?S7S'TUUUEIe$*	 W&&y111ErE   optionsr#   c           	        	 j         	| j        | j        		dk     rt          dd          S | j        }t	          |                                         	|z
                                	| j        	fd| j        D             }t	          d |D                       |z   }| j        t	          d |D                       |z   n| j        }t          ||          }|	                    | j
                  }|S )Nr   c                 P    g | ]"}                                |          #S rS   )update_width).0column_measure_columnr   r8   r   s     rC   
<listcomp>z*Table.__rich_measure__.<locals>.<listcomp>O  sE     
 
 
 OGW%9%9)%D%DfMM
 
 
rE   c              3   $   K   | ]}|j         V  d S N)minimumr   measurements     rC   	<genexpr>z)Table.__rich_measure__.<locals>.<genexpr>T  %      DD#DDDDDDrE   c              3   $   K   | ]}|j         V  d S r   maximumr   s     rC   r   z)Table.__rich_measure__.<locals>.<genexpr>W  r   rE   )r8   r6   r   r   sum_calculate_column_widthsr   r   r\   clampr7   )
rB   r   r   extra_widthmeasurementsminimum_widthmaximum_widthr   r   r8   s
    ``     @@rC   __rich_measure__zTable.__rich_measure__>  sG    %	:!
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rE   c                     | j         S )zGet cell padding.)rv   rA   s    rC   rc   zTable.padding_  s     }rE   c                 8    t          j        |          | _        | S )zSet cell padding.)r   ru   rv   )rB   rc   s     rC   rc   zTable.paddingd  s      w//rE   r*   r0   r2   r4   )r-   r.   r/   r1   r3   r5   r6   r7   r8   r9   r:   r+   r&   r,   r1   r3   r   r5   r%   r8   r9   r:   c                    t          t          | j                  |||pd|pd|pd||||	|
|||          }| j                            |           dS )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*   )r;   r+   r,   r-   r.   r/   r1   r3   r5   r6   r7   r8   r9   r:   N)r)   r|   r\   rx   )rB   r+   r,   r-   r.   r/   r1   r3   r5   r6   r7   r8   r9   r:   r   s                  rC   r{   zTable.add_columnj  sy    J t|$$%+%++2
 
 
  	F#####rE   r/   rV   renderablesrV   c                   dt           ddddfd}t          |          }| j        }t          |          t          |          k     r'g |dgt          |          t          |          z
  z  }t	          |          D ]\  }}|t          |          k    rNt          |          }	| j        D ]}
 ||	t          d                     | j                            |	           n||         }	| ||	d           }t          |          r ||	|           t          j
        d	t          |          j         d
          | j                            t          ||                     dS )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   rY   r&   r>   Nc                 :    | j                             |           d S r   )r=   rx   )r   rY   s     rC   add_cellzTable.add_row.<locals>.add_cell  s    M  ,,,,,rE   )r;   r*   zunable to render z1; a string or other renderable object is requiredr   )r)   rQ   r\   r|   	enumerater]   r    rx   r   r   NotRenderableErrortyperJ   rU   )rB   r/   rV   r   r   cell_renderablesr\   r   rY   r   _s              rC   add_rowzTable.add_row  s   $	-V 	-1A 	-d 	- 	- 	- 	- >B+=N=N,  3w<<// ! 3w<<#.>*?*??@  "++;!<!< 	 	E:G$$u--- / /AHVT"XX....##F++++ !$$$$z** ,,,,/tZ(8(8(Attt   		5kBBBCCCCCrE   c                 <    | j         rd| j         d         _        dS dS )z2Add a new section (draw a line after current row).TN)r]   rV   rA   s    rC   add_sectionzTable.add_section  s,     9 	-(,DIbM%%%	- 	-rE   r'   c           	   #     K   | j         st          d          V  d S |j        }| j        | j        }| j        }|                     |                    ||z
                      }t          |          |z   }|                    || j	        d           	 ddt          dt          dddd	ffd
}| j        r6 || j        t          j        | j        d          | j                  E d {V  |                     |          E d {V  | j        r8 || j        t          j        | j        d          | j                  E d {V  d S d S )N
)r6   rr   heightr_   textr/   r1   r$   r>   r'   c                     t          | t                    r                    | |d          n| }                    |                    |                    S )NF)r/   rr   r1   )r   )ry   rz   
render_strrenderupdate)r   r/   r1   render_textr   render_optionss       rC   render_annotationz1Table.__rich_console__.<locals>.render_annotation  sl    
 dC((""4u"FFF 
 >>^%:%:7%:%K%K "   rE   ztable.title)r/   r1   ztable.caption)r_   )r\   r   r8   r6   r   r   r   r   r   rr   r!   r   r`   r   
pick_firstrn   rp   _renderra   ro   rq   )	rB   r   r   r8   r   widthstable_widthr   r   s	    `      @rC   __rich_console__zTable.__rich_console__  s      | 	$--F%	:!
I'..W)))k*ABB
 
 &kkK/  ( 
 

 JR
	 
	
	#,
	7F
	
	 
	 
	 
	 
	 
	 
	 : 	((
&t'7GG*         
 <<@@@@@@@@@< 	((&t'9?KK,           	 	rE   c                     j         } j        } fd|D             }d |D             } j         j        } j        rd |D             }t          |          rd t          ||          D             }	fd|D             }
|t          |	          z
  }t          |||
          }t          |          }t          |          D ]'\  }}|j        r|	|         t          |          z   ||<   (t          |          }||k    r                     |d |D             |          }t          |          }||k    r7||z
  }t          |dgt          |          z  ||          }t          |          } fdt          ||          D             }d	 |D             }||k     r j        s j        \| j        |z
  k     rN j        |nt#           j        |z
  |          }t          ||z
  |          }d t          ||          D             }|S )zNCalculate the widths of each column, including padding, not including borders.c                 >    g | ]}                     |          S rS   )r   )r   r   r   r   rB   s     rC   r   z2Table._calculate_column_widths.<locals>.<listcomp>  s8     
 
 
?ED  '6::
 
 
rE   c                      g | ]}|j         pd S r   r   r   _ranges     rC   r   z2Table._calculate_column_widths.<locals>.<listcomp>  s    AAA&&.%AAAArE   c                 .    g | ]}|j         	|j        pd S r   )rI   r9   )r   cols     rC   r   z2Table._calculate_column_widths.<locals>.<listcomp>  s%    HHH3<Hcin1HHHrE   c                 4    g | ]\  }}|j         rd n|j        S r   )rI   r   )r   r   r   s      rC   r   z2Table._calculate_column_widths.<locals>.<listcomp>  s9          &  <AAfn     rE   c                 R    g | ]#}|j         	|j        pd  |j                  z   $S r   )rI   r6   r;   )r   r   get_padding_widths     rC   r   z2Table._calculate_column_widths.<locals>.<listcomp>  sK           \&Q*;*;FM*J*JJ     rE   c                 0    g | ]}|j         d u o|j         S r   )r6   r:   )r   r   s     rC   r   z2Table._calculate_column_widths.<locals>.<listcomp>(  s)    UUU6&,$&=v~+=UUUrE   r   c                 j    g | ]/\  }}                                         |          |          0S rS   )r   r   )r   r6   r   r   r   rB   s      rC   r   z2Table._calculate_column_widths.<locals>.<listcomp>2  sM       !E6 $$Wg.B.B5.I.I6RR  rE   c                      g | ]}|j         pd S r   r   r   s     rC   r   z2Table._calculate_column_widths.<locals>.<listcomp>6  s    EEEffn)EEErE   Nc                     g | ]
\  }}||z   S rS   rS   )r   _widthpads      rC   r   z2Table._calculate_column_widths.<locals>.<listcomp>A  s     NNN{vsfslNNNrE   )r8   r\   _get_padding_widthr   rf   anyzipr   r   iterr   rI   next_collapse_widthsr   r|   r7   min)rB   r   r   r8   r\   width_rangesr   r   ratiosfixed_widthsflex_minimumflexible_widthflex_widthsiter_flex_widthsr   r   r   excess_width
_max_width
pad_widthsr   s   ```                 @rC   r   zTable._calculate_column_widths  s    %	,
 
 
 
 
 
IP
 
 
 BALAAA 3'; 	UHHHHHF6{{ U   *-lG*D*D            ")     
 "+S->->!>.~v|TT#'#4#4 %.w%7%7 U UME6 U(4U(;dCS>T>T(Tu&kk""**UUWUUU F
 f++KY&&*Y6%lQC#f++4EvvVV!&kk     %(%9%9  L FEEEEF)###N&;$.;:V+W+W >) 	+5yAA 
 **{*BFKKJNNc&*6M6MNNNFrE   r   wrapablec                   
 t          |          }||z
  }t          |          r|r|dk    rt          d t          ||          D                       
t          
fdt          ||          D                       }
|z
  }
fdt          ||          D             }t          |          r|snOt	          ||          gt          |          z  }	t          |||	|          }t          |          }||z
  }|r|dk    |S )aM  Reduce 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.
        r   c              3   $   K   | ]\  }}||V  d S r   rS   )r   r6   
allow_wraps      rC   r   z)Table._collapse_widths.<locals>.<genexpr>W  s?       ! !/eZJ!! ! ! ! ! !rE   c              3   6   K   | ]\  }}|r|k    r|nd V  dS )r   NrS   r   r6   r   
max_columns      rC   r   z)Table._collapse_widths.<locals>.<genexpr>Z  sN       ( ()z (FEZ,?,?EEQ( ( ( ( ( (rE   c                 .    g | ]\  }}|k    r|rd ndS )r   r   rS   r   s      rC   r   z*Table._collapse_widths.<locals>.<listcomp>_  s@       )z !J..:.QQA  rE   )r   r   maxr   r   r|   r   )r   r   r   r8   total_widthr   second_max_columncolumn_differencer   
max_reducer   s             @rC   r   zTable._collapse_widthsE  sm    &kk"Y.x== 	7 7,"2"2  ! !36vx3H3H! ! !  
 %( ( ( ( (-0-B-B( ( ( % %! %/1B$B!   -0-B-B   6{{ *; !,0ABBCc&kkQ
%lFJOO!&kk*Y6'  7,"2"2( rE   column_indexr   c              #     K   | j         | j        | j        t                    }|dk    |t	          | j                  dz
  k    i dt          dt          dt          t          t          t          t          f         ffd}g }|j	        }|j
        }| j        r5 || j        pd           ||j                  z   }	 ||	|j        f            ||j        pd          }
|j        D ]} ||
|f           | j        r5 || j        pd           ||j                  z   } |||j        f           |r_t&          }t)          |          D ]F\  }}\  }}t+          | || |||                    t-          |dd	          p|j                  V  Gd	S |D ].\  }}t+          ||t-          |dd	          p|j                  V  /d	S )
z3Get all the cells with padding and optional header.r   r   	first_rowlast_rowr>   c                                          | |f          }|r|S \  }}}}	r*
st          d||z
            }|st          d||z
            }s
rd}rd}| rd}|rd}||||f}|| |f<   |S )Nr   )getr   )r   r   cachedr2   rightbottomr0   rv   _padding_cacherd   first_columnlast_columnre   rc   s           rC   get_paddingz%Table._get_cells.<locals>.get_padding{  s    #''H(=>>F '.$C 2# 0q$,//D 2 C&L11F  D E C FUFD1H4<NIx01OrE   r*   r3   N)rd   re   rc   r   r|   r\   rP   r   rO   rx   r   rg   r-   r+   r/   rG   rh   r.   r,   r   r   rX   getattrr3   )rB   r   r   r   any_paddingr  	raw_cells_appendr   r-   
cell_stylecellr.   _Paddingfirstlastr/   rY   r  rd   r  r  re   rc   s                     @@@@@@rC   
_get_cellszTable._get_cellsl  s     
  0=,'ll#q("c$,&7&7!&;;MO	4 	4 	E#sCQTBT<U 	 	 	 	 	 	 	 	 	 	 	2 ?A	"%	 	3$9T%6%<"==		#A A L G\6=1222Yv|1r22
L 	( 	(DGZ&'''' 	3$9T%6%<"==		#A A L G\6=1222 	H4CI4N4N  0t0eZHZUD)A)ABBJ
D99LV_       &/  !zJ
D99LV_      rE   c                 d    | j         \  }}}}| j        r|dk    rt          d||z
            }||z   S )zGet extra width from padding.r   )rc   rd   r   )rB   r   r   	pad_rightpad_lefts        rC   r   zTable._get_padding_width  sG    $(L!9a  	8aq(Y"677)##rE   c                    |j         }|dk     rt          dd          S |                     |j                  }|j        3t          |j        |z   |j        |z                                 |          S g }g }|j        }|j        }	t          j        }
|                     ||j        |          D ]-} |
|||j	                  \  }} ||            |	|           .t          |rt          |          nd|rt          |          n|                              |          }|                    |j        dn	|j        |z   |j         dn	|j         |z             }|S )z0Get the minimum and maximum width of the column.r   r   N)r8   r   r   r;   r6   with_maximumrx   r  r  rY   r   r   r7   )rB   r   r   r   r8   padding_width
min_widths
max_widths
append_min
append_maxget_render_widthr  _min_maxr   s                  rC   r   zTable._measure_column  s    %	q==q!$$$//>><#},fl].J l9%%& !#
 "
&
&
&?OOGV]FCC 	 	D))'7DOLLJD$JtJt!)0C
OOOq)8C
OOOy
 
 ,y
!
! 	 "''$,DD&2B]2R$,DD&2B]2R
 
 rE   c              #   
   %&'()*+,K                         j        pd          }|                      j        pd          z   } fdt           j                  D             }t          t          |           } j        r4 j                            |t           j
        j
                            nd }|r j        s|                                n|}t          j                    }	 j        }
 j        } j        } j        } j        } j        }t          %|r %|j        |           %|j        |           %|j        |          f %|j        |           %|j        |           %|j        |          f %|j        |           %|j        |           %|j        |          fg}|r% %|                    |          |          V  |	V  ng } j        }j         (t          t=          |                    D ]3\  }\  }}}|o|)|o|')s's j        ||z
           nd }d*g })s'rtA          j!                    ,n ( ||r|dz
  n|                    ,t          |||
          D ]\  }}}|"                    ||j#        |j$        |j%        d           }&                    |j'        | (|j                  ,z             }tQ          *tS          |                    *|*                    |           tQ          d |D                       +dtV          tV          t                            d	d
dtX          dt@          dtV          tV          t                            f
%')+fd&%&(*,fdt          ||||
          D             |d d <   |r|r*|r( %|-                    |d|          |          V  |	V  ||rdn|rdnd         \  }}}|j.        /                                r|n %|j.        ,j0        |j        z             } tc          *          D ];}!|r|V  te          |          D ]\  }"}#|#|!         E d {V  |"s| V  |r|V  |	V  <n)tc          *          D ]}!|D ]}#|#|!         E d {V  |	V  |r,|r*|r( %|-                    |d|          |          V  |	V  |o|j3        }$|rv|s|s|$rp|sn|r|tS          |          dz
  k    sV|r)sR|r( %|-                    |d|          |z  |          V  n$ %|-                    |d|          |          V  |	V  5|r)|r) %|4                    |          |          V  |	V  d S d S d S )Nr*   c              3   L   K   | ]\  }}                     ||          V  d S r   )r  )r   r   r   r   rB   s      rC   r   z Table._render.<locals>.<genexpr>  sK       
 
$f OOG\6::
 
 
 
 
 
rE   )safer   )r6   r1   r:   r5   r   r/   c              3   4   K   | ]}t          |          V  d S r   )r|   )r   r  s     rC   r   z Table._render.<locals>.<genexpr>>  s(      994SYY999999rE   r  r3   r   r6   r/   r>   c                     rd}nrd}|dk    r                     | ||          S |dk    r                    | ||          S                     | ||          S )Nr  r2   middle)	align_topalign_middlealign_bottom)r  r3   r6   r/   _Segment
footer_row
header_row
row_heights       rC   
align_cellz!Table._render.<locals>.align_cell@  s      %'HH %$Hu$$#--dE:uMMM))#00uj%PPP,,T5*eLLLrE   c                     g | ]@\  }}}}                      ||j        | |j                  	z             |          AS rS   )	set_shaper3   r/   )
r   r6   _cellr  r   r*  r.  r   
max_heightr   s
        rC   r   z!Table._render.<locals>.<listcomp>Q  sy        /E5$ ""J!	%+..:	  	 	  rE   foot)edger   r   headmidrow)5r   r/   rm   r   r\   rQ   r   r   
substituter   rb   rg   get_plain_headed_boxr   linerh   ri   rj   rk   	head_left
head_righthead_vertical	foot_left
foot_rightfoot_verticalmid_left	mid_rightmid_verticalget_topr   r   r]   r   r   r   r1   r:   r5   render_linesrY   r   r|   rx   r	   rO   get_rowr   stripbackground_styleranger   rV   
get_bottom)-rB   r   r   r   table_stylerm   _column_cells	row_cells_boxnew_liner\   rg   rh   ri   rj   rk   box_segmentsr   r   r  r  row_cellr7  rG   r6   r  r   r   linesr0   r  _dividerdividerline_no	last_cellrendered_cellrV   r*  r.  r+  r   r,  r2  r-  r   s-   ``                                   @@@@@@@@rC   r   zTable._render  s      ''
(8b99"W%6%6t7H7NB%O%OO
 
 
 
 
(1$,(?(?
 
 
 .2#}2E-F-F	
 xDHiw7GHH       	 /3U4;KUt((***QU<>>,&&N	_
, 	 HT^\::HT_l;;HT/>> HT^\::HT_l;;HT/>> HT]L99HT^\::HT.==L"  ht||F33\BBBBBL*%	.7	8R8R.S.S u	# u	#*E*E4.;J-+J #+5	%+-.. 
 J/1E Z !JLL		%I!M'+N5199OO 	 (+68W'E'E $ $#tV!("N"N#_ "0 " "  ,,O"#)DJ//); -  
 !SZZ88
U####99599999JM4=)M/M M 	M
 d7m$M M M M M M M M M"        36fhw2W2W  E!!!H  # #K #"(VV)DDl     #NNN(4%5WQQ4FVaaUV(X%eX
  }**,,HH! y'AHN'R    %Z00 	# 	#G  #"


4=e4D4D * *0	=#0#99999999( *")MMM  $#"NNNN	#  %Z00 # #G). : :#0#999999999"NNNN  + hLLiL@@,     1#/K # #w #+ ##(#-2c)nnq6H-H-H( .I-7 .I  &h LLYLGG'Q(     
 'h LLYLGG     #NNN 	I 	(4??622LAAAAANNNNN	 	 	 	rE   )r*   r*   )r>   N)r   r"   r   r#   r>   r'   ),rJ   rK   rL   rM   r	   r)   rN   rU   r   
HEAVY_HEADr   rz   r   r!   rO   BoxrP   r   r   r   r~   classmethodr   rR   rf   setterr   r   r   r   r   r   rc   r{   r   r   r   r   r   rX   r  r   r   r   rS   rE   rC   r[   r[      s         > &\
s)OOO
 %)&*##'!$#'%+!& ! !48,:,:,0+/-1)1+37>& >& >&$>& !>& (#	>&
 }>& C=>& cg>& 4.>& #>& >& >& >& >& >& >&  !>&" #>&$ %>&& Xi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 sCc12    X ^0 W    ^ $&#%5$
 -1,0%)#)*/%/##'#'#5$ 5$ 5$ 5$ !5$
 y)5$ y)5$ 	"5$ !5$ (5$ #5$ }5$ C=5$ C=5$ }5$ 5$  
!5$ 5$ 5$ 5$t &*!	-D -D -D/0-D 	"-D 	-D
 
-D -D -D -D^- - - -- -+;-	- - - -^> >+;>	c> > > >@ $#Y$*.t*$AD$	c$ $ $ [$LG G03G=CG	%G G G GR$s $s $ $ $ $&& "& 	&
 
& & & &Pr r+;rEI#Yr	r r r r r rrE   r[   __main__)r"   )ReprHighlighter)r[   )timerzTable renderzStar Wars MovieszRich example tabler  )r`   ra   rq   Releasedbright_cyancyanT)r-   r/   r:   Titlemagentar#  z
Box Officegreen)r1   r/   zDec 20, 2019z Star Wars: The Rise of Skywalkerz$952,110,690zMay 25, 2018zSolo: A Star Wars Storyz$393,151,347zDec 15, 2017z!Star Wars Ep. V111: The Last Jediz$1,332,539,889zon blackr   zDec 16, 2016zRogue One: A Star Wars Storyz$1,332,439,889r   r>   Nc                     t                                            t                               t          |                      t                                            d S r   )r   printrulerr   )r   s    rC   r+   r+     s8    MMOOOLL4)))MMOOOOOrE   zExample Tabler_   r   zexpand=True2   zwidth=50Fdimr^   zrow_styles=['dim', 'none']z%leading=1, row_styles=['dim', 'none']z+show_lines=True, row_styles=['dim', 'none'])Jdataclassesr   r   r   typingr   r   r   r	   r
   r   r   r   r   r*   r   r   _loopr   r   _pickr   _ratior   r   alignr   jupyterr   measurer   rc   r   r   protocolr   segmentr   r/   r   r   r   r    r!   r   r"   r#   r$   r%   r&   r'   r)   rU   rX   r[   rJ   pip._vendor.rich.consolepip._vendor.rich.highlighterr]  pip._vendor.rich.table_timerr^  tabler{   r   rz   r+   rr   rf  rf   r6   rl   rk   rj   rS   rE   rC   <module>ry     s4   1 1 1 1 1 1 1 1 1 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
         - - - - - - - -       2 2 2 2 2 2 2 2 & & & & & & ! ! ! ! ! !             / / / / / / / / # # # # # #       # # # # # # # #                                 W& W& W& W& W& W& W& W&t M M M M M M M M# # # # #J # # #@ @ @ @ @L @ @ @F z000000<<<<<<555555	~		 G/ G/$(#
 
 
 	]&$ 	 	
 	
 	
 		222wgFFF.	
 	
 	

 	n&?PPP/ 	 	
 	
 	
 	*	
 	
 	
	 	 	 	 	 	
 '))#O%%	eX...}ezeX...!6?+,,,eX...!6?6777eX...!6?<===eX...OG/ G/ G/ G/ G/ G/ G/ G/ G/ G/ G/ G/ G/ G/ G/ G/ G/ G/ s   7HLLL