
     hq                     "   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    r;d dl8m-Z- d dl9m:Z: 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.d/           e=?                    d0d1d2           e=?                    d3d4d5d6d%7           e=?                    d8d9d:           d;e@d<d=fd>ZA e-            Z, e:            ZB eAd?           e,C                    e=d@A           d%e=_D         eAdB           e,C                    e=           dCe=_E         eAdD           e,C                    e=d@A           d=e=_E        dEe=_D        dFdGge=_F         eAdH           e,C                    e=d@A           d=e=_E        dEe=_D        dFdGge=_F        de=_G         eAdI           e,C                    e=d@A           d=e=_E        dEe=_D        dFdGge=_F        d%e=_H        d e=_G         eAdJ           e,C                    e=d@A           d=d=d=           d=S # 1 swxY w Y   d=S d=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                      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<   	 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 (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 )zReturn a copy of this Column.r>   )r   selfs    U/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/pip/_vendor/rich/table.pycopyzColumn.copyu   s    tB''''    c              #   $   K   | j         E d{V  dS )z2Get all cells in the column, not including header.NrA   rB   s    rD   cellszColumn.cellsy   s(       ;rF   c                     | j         duS )z!Check if this column is flexible.N)r9   rB   s    rD   flexiblezColumn.flexible~   s     z%%rF   )r?   r)   )!__name__
__module____qualname____doc__r+   __annotations__r,   r-   r   r.   r/   r1   r3   r5   r6   r   intr7   r8   r9   r:   boolr;   r<   r   listr>   r	   rE   propertyr   rH   rJ    rF   rD   r)   r)   &   s         <  "F!!!H!F!!!H L)   - L)   -E9-%G_%%%[&+H#+++M!+H+++E8C=\#Ix}###_#Ix}###_E8C=wGTRItCFCOOO%*U4%@%@%@FD!"@@@( ( ( ( x 01    X &$ & & & X& & &rF   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)
rK   rL   rM   rN   r/   r   r   rO   rW   rQ   rT   rF   rD   rV   rV      s@         &&!%E8I%%% KLLrF   rV   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)rK   rL   rM   rN   r   rO   r   rT   rF   rD   rY   rY      sB         ##!    !!!!""rF   rY   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?d@dAd@d ee         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 (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)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_justifyr;   headersra   rb   r6   r7   r   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   r/   rm   r-   r.   rn   ro   rp   rq   r$   rr   r;   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^   ra   rb   r6   r7   r   rc   r   unpack_paddingrf   _expandrh   ri   rj   rk   rl   re   r/   r-   r.   rn   ro   rp   rq   rr   r;   rR   rm   append
isinstancestr
add_columnlenr<   )rC   ra   rb   r6   r7   r   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   r/   rm   r-   r.   rn   ro   rp   rq   rr   r;   rs   append_columnr+   s                                rD   __init__zTable.__init__   s\   : &(!	

" w// &&"$ 0
(.B(.B(&*.;0?"/3J4D"/E/E+ 	& 	&F&#&& &v.... #DL 1 1f%%%%	& 	&rF   )rd   re   rf   rg   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   rd   re   rh   ri   rj   rf   rg   rT   )clsrd   re   rf   rg   rs   s         rD   gridz
Table.grid   s8    * s-

 

 

 
	
rF   c                 "    | j         p| j        duS )z-Setting a non-None self.width implies expand.N)rw   r6   rB   s    rD   rg   zTable.expand  s     |5tz55rF   c                     || _         dS )zSet expand.N)rw   )rC   rg   s     rD   rg   zTable.expand#  s     rF   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   rj   r|   r]   )rC   r6   s     rD   _extra_widthzTable._extra_width(  sM     8 	 	QJE8 	+S&&**ErF   c                 *    t          | j                  S )zGet the current number of rows.)r|   r^   rB   s    rD   	row_countzTable.row_count2  s     49~~rF   consoler"   indexc                    t          j                    }| j        r8||                    | j        |t	          | j                  z                     z  }| j        |         j        }|||                    |          z  }|S )zGet the current row style.)r   nullrm   	get_styler|   r^   r/   )rC   r   r   r/   	row_styles        rD   get_row_stylezTable.get_row_style7  sx    
? 	VW&&tus4??S?S7S'TUUUEIe$*	 W&&y111ErF   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 rT   )update_width).0column_measure_columnr   r8   r   s     rD   
<listcomp>z*Table.__rich_measure__.<locals>.<listcomp>R  sE     
 
 
 OGW%9%9)%D%DfMM
 
 
rF   c              3   $   K   | ]}|j         V  d S N)minimumr   measurements     rD   	<genexpr>z)Table.__rich_measure__.<locals>.<genexpr>W  %      DD#DDDDDDrF   c              3   $   K   | ]}|j         V  d S r   maximumr   s     rD   r   z)Table.__rich_measure__.<locals>.<genexpr>Z  r   rF   )r8   r6   r   r   sum_calculate_column_widthsr   r   r]   clampr7   )
rC   r   r   extra_widthmeasurementsminimum_widthmaximum_widthr   r   r8   s
    ``     @@rD   __rich_measure__zTable.__rich_measure__A  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rF   c                     | j         S )zGet cell padding.)rv   rB   s    rD   rd   zTable.paddingb  s     }rF   c                 8    t          j        |          | _        | S )zSet cell padding.)r   ru   rv   )rC   rd   s     rD   rd   zTable.paddingg  s      w//rF   r*   r0   r2   r4   )r-   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||n| j        |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.
            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/   r1   r3   r5   r6   r7   r8   r9   r:   )r)   r|   r]   r;   rx   )rC   r+   r,   r-   r;   r.   r/   r1   r3   r5   r6   r7   r8   r9   r:   r   s                   rD   r{   zTable.add_columnm  s    N t|$$%+#,#8iidn%++2
 
 
" 	F#####rF   r/   rW   renderablesrW   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    rTt          || j                  }	| 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   rZ   r&   r?   Nc                 :    | j                             |           d S r   )r>   rx   )r   rZ   s     rD   add_cellzTable.add_row.<locals>.add_cell  s    M  ,,,,,rF   )r<   r;   r*   zunable to render z1; a string or other renderable object is requiredr   )r)   rR   r]   r|   	enumerater;   r^   r    rx   r   r   NotRenderableErrortyperK   rV   )rC   r/   rW   r   r   cell_renderablesr]   r   rZ   r   _s              rD   add_rowzTable.add_row  s   $	-V 	-1A 	-d 	- 	- 	- 	- >B+=N=N,  3w<<// ! 3w<<#.>*?*??@  "++;!<!< 	 	E:G$$uGGG / /AHVT"XX....##F++++ !$$$$z** ,,,,/tZ(8(8(Attt   		5kBBBCCCCCrF   c                 <    | j         rd| j         d         _        dS dS )z2Add a new section (draw a line after current row).TN)r^   rW   rB   s    rD   add_sectionzTable.add_section  s,     9 	-(,DIbM%%%	- 	-rF   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   r;   heightr`   textr/   r1   r$   r?   r'   c                     t          | t                    r                    | |d          n| }                    |                    |                    S )NF)r/   r;   r1   )r   )ry   rz   
render_strrenderupdate)r   r/   r1   render_textr   render_optionss       rD   render_annotationz1Table.__rich_console__.<locals>.render_annotation  sl    
 dC((""4u"FFF 
 >>^%:%:7%:%K%K "   rF   ztable.title)r/   r1   ztable.caption)r`   )r]   r   r8   r6   r   r   r   r   r   r;   r!   r   ra   r   
pick_firstro   rq   _renderrb   rp   rr   )	rC   r   r   r8   r   widthstable_widthr   r   s	    `      @rD   __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,           	 	rF   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 rT   )r   )r   r   r   r   rC   s     rD   r   z2Table._calculate_column_widths.<locals>.<listcomp>  s8     
 
 
?ED  '6::
 
 
rF   c                      g | ]}|j         pd S r   r   r   _ranges     rD   r   z2Table._calculate_column_widths.<locals>.<listcomp>  s    AAA&&.%AAAArF   c                 .    g | ]}|j         	|j        pd S r   )rJ   r9   )r   cols     rD   r   z2Table._calculate_column_widths.<locals>.<listcomp>  s%    HHH3<Hcin1HHHrF   c                 4    g | ]\  }}|j         rd n|j        S r   )rJ   r   )r   r   r   s      rD   r   z2Table._calculate_column_widths.<locals>.<listcomp>  s9          &  <AAfn     rF   c                 R    g | ]#}|j         	|j        pd  |j                  z   $S r   )rJ   r6   r<   )r   r   get_padding_widths     rD   r   z2Table._calculate_column_widths.<locals>.<listcomp>  sK           \&Q*;*;FM*J*JJ     rF   c                 0    g | ]}|j         d u o|j         S r   )r6   r:   )r   r   s     rD   r   z2Table._calculate_column_widths.<locals>.<listcomp>.  s)    UUU6&,$&=v~+=UUUrF   r   c                 j    g | ]/\  }}                                         |          |          0S rT   )r   r   )r   r6   r   r   r   rC   s      rD   r   z2Table._calculate_column_widths.<locals>.<listcomp>8  sM       !E6 $$Wg.B.B5.I.I6RR  rF   c                      g | ]}|j         pd S r   r   r   s     rD   r   z2Table._calculate_column_widths.<locals>.<listcomp><  s    EEEffn)EEErF   Nc                     g | ]
\  }}||z   S rT   rT   )r   _widthpads      rD   r   z2Table._calculate_column_widths.<locals>.<listcomp>G  s     NNN{vsfslNNNrF   )r8   r]   _get_padding_widthr   rg   anyzipr   r   iterr   rJ   next_collapse_widthsr   r|   r7   min)rC   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   ```                 @rD   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rF   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   rT   )r   r6   
allow_wraps      rD   r   z)Table._collapse_widths.<locals>.<genexpr>]  s?       ! !/eZJ!! ! ! ! ! !rF   c              3   6   K   | ]\  }}|r|k    r|nd V  dS )r   NrT   r   r6   r   
max_columns      rD   r   z)Table._collapse_widths.<locals>.<genexpr>`  sN       ( ()z (FEZ,?,?EEQ( ( ( ( ( (rF   c                 .    g | ]\  }}|k    r|rd ndS )r   r   rT   r   s      rD   r   z*Table._collapse_widths.<locals>.<listcomp>e  s@       )z !J..:.QQA  rF   )r   r   maxr   r   r|   r   )r   r   r   r8   total_widthr   second_max_columncolumn_differencer   
max_reducer   s             @rD   r   zTable._collapse_widthsK  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( rF   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_cachere   first_columnlast_columnrf   rd   s           rD   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OrF   r*   r3   N)re   rf   rd   r   r|   r]   rQ   r   rP   rx   r   rh   r-   r+   r/   rH   ri   r.   r,   r   r   rY   getattrr3   )rC   r   r   r   any_paddingr  	raw_cells_appendr   r-   
cell_stylecellr.   _Paddingfirstlastr/   rZ   r  re   r  r  rf   rd   s                     @@@@@@rD   
_get_cellszTable._get_cellsr  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_      rF   c                 d    | j         \  }}}}| j        r|dk    rt          d||z
            }||z   S )zGet extra width from padding.r   )rd   re   r   )rC   r   r   	pad_rightpad_lefts        rD   r   zTable._get_padding_width  sG    $(L!9a  	8aq(Y"677)##rF   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  rZ   r   r   r7   )rC   r   r   r   r8   padding_width
min_widths
max_widths
append_min
append_maxget_render_widthr  _min_maxr   s                  rD   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
 
 rF   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 ]9\  }\  }}}|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(        | (|j                  ,z             }tS          *tU          |                    *|+                    |           tS          d |D                       +dtX          tX          t                            d	d
dtZ          dt@          dtX          tX          t                            f
%')+fd&%&(*,fdt          ||||
          D             |d d <   |r|r*|r( %|.                    |d|          |          V  |	V  ||rdn|rdnd         \  }}}|j/        0                                r|n %|j/        ,j1        |j        z             } te          *          D ];}!|r|V  tg          |          D ]\  }"}#|#|!         E d {V  |"s| V  |r|V  |	V  <n)te          *          D ]}!|D ]}#|#|!         E d {V  |	V  |r,|r*|r( %|.                    |d|          |          V  |	V  |o|j4        }$|rv|s|s|$rp|sn|r|tU          |          dz
  k    sV|r)sR|r( %|.                    |d|          |z  |          V  n$ %|.                    |d|          |          V  |	V  ;|r)|r) %|5                    |          |          V  |	V  d S d S d S )Nr*   c              3   L   K   | ]\  }}                     ||          V  d S r   )r  )r   r   r   r   rC   s      rD   r   z Table._render.<locals>.<genexpr>  sK       
 
$f OOG\6::
 
 
 
 
 
rF   )safer   )r6   r1   r:   r5   r   r;   r/   c              3   4   K   | ]}t          |          V  d S r   )r|   )r   r  s     rD   r   z Table._render.<locals>.<genexpr>E  s(      994SYY999999rF   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       rD   
align_cellz!Table._render.<locals>.align_cellG  s      %'HH %$Hu$$#--dE:uMMM))#00uj%PPP,,T5*eLLLrF   c                     g | ]@\  }}}}                      ||j        | |j                  	z             |          AS rT   )	set_shaper3   r/   )
r   r6   _cellr  r   r*  r.  r   
max_heightr   s
        rD   r   z!Table._render.<locals>.<listcomp>X  sy        /E5$ ""J!	%+..:	  	 	  rF   foot)edger   r   headmidrow)6r   r/   rn   r   r]   rR   r   r   
substituter   rc   rh   get_plain_headed_boxr   lineri   rj   rk   rl   	head_left
head_righthead_verticalmid_left	mid_rightmid_vertical	foot_left
foot_rightfoot_verticalget_topr   r   r^   r   r   r   r1   r:   r5   r;   render_linesrZ   r   r|   rx   r	   rP   get_rowr   stripbackground_styleranger   rW   
get_bottom)-rC   r   r   r   table_stylern   _column_cells	row_cells_boxnew_liner]   rh   ri   rj   rk   rl   box_segmentsr   r   r  r  row_cellr7  rH   r6   r  r   r   linesr0   r  _dividerdividerline_no	last_cellrendered_cellrW   r*  r.  r+  r   r,  r2  r-  r   s-   ``                                   @@@@@@@@rD   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]L99HT^\::HT.== HT^\::HT_l;;HT/>>L"  ht||F33\BBBBBL*%	.7	8R8R.S.S v	# v	#*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	 	 	 	rF   )r*   r*   )r?   N)r   r"   r   r#   r?   r'   ),rK   rL   rM   rN   r	   r)   rO   rV   r   
HEAVY_HEADr   rz   r   r!   rP   BoxrQ   r   r   r   r~   classmethodr   rS   rg   setterr   r   r   r   r   r   rd   r{   r   r   r   r   r   rY   r  r   r   r   rT   rF   rD   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    ^ $&#%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$ $ $ [$LG G03G=CG	%G G G GR$s $s $ $ $ $&& "& 	&
 
& & & &Ps s+;sEI#Ys	s s s s s srF   r\   __main__)r"   )ReprHighlighter)timerzTable renderzStar Wars MovieszRich example tabler  )ra   rb   rr   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ruler;   )r   s    rD   r+   r+     s8    MMOOOLL4)))MMOOOOOrF   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'])Idataclassesr   r   r   typingr   r   r   r	   r
   r   r   r   r   r*   r   r   _loopr   r   _pickr   _ratior   r   alignr   jupyterr   measurer   rd   r   r   protocolr   segmentr   r/   r   r   r   r    r!   r   r"   r#   r$   r%   r&   r'   r)   rV   rY   r\   rK   pip._vendor.rich.consolepip._vendor.rich.highlighterr]  _timerr^  tabler{   r   rz   r+   r;   rf  rg   r6   rm   rl   rk   rT   rF   rD   <module>rx     s"   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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   1HLL	L