
    #7h                      X   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(  rd dl8m-Z- d dl9m:Z: d dl;m6Z6 ddl<m=Z=  e=d      5   e6dd d!"      Z>e>j                  d#d$d%d&'       e>j                  d(d)*       e>j                  d+d!d,-       e>j                  d.d/d0       e>j                  d1d2d3       e>j                  d4d5d6d7d&8       e>j                  d9d:d;       d<eAd=d>fd?ZB e-       Z, e:       ZC eBd@       e,j                  e>dAB       d&e>_E         eBdC       e,j                  e>       dDe>_F         eBdE       e,j                  e>dAB       d>e>_F        dFe>_E        dGdHge>_G         eBdI       e,j                  e>dAB       d>e>_F        dFe>_E        dGdHge>_G        de>_H         eBdJ       e,j                  e>dAB       d>e>_F        dFe>_E        dGdHge>_G        d&e>_I        d e>_H         eBdK       e,j                  e>dAB       d>d>d>       y>y># 1 sw Y   y>xY w)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                   f   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y)"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    T/var/www/urcfiles/bundle/venv/lib/python3.12/site-packages/pip/_vendor/rich/table.pycopyzColumn.copyr   s    tB''    c              #   8   K   | j                   E d{    y7 w)z2Get all cells in the column, not including header.Nr@   rA   s    rC   cellszColumn.cellsv   s      ;;s   c                     | j                   duS )z!Check if this column is flexible.N)r9   rA   s    rC   flexiblezColumn.flexible{   s     zz%%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FCO%*4%@FD!"@( x 01   &$ & &rE   r)   c                   6    e Zd ZU dZdZee   ed<   	 dZe	ed<   y)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LrE   rU   c                   4    e Zd ZU dZeed<   	 ded<   	 eed<   y)_CellzA single cell in a table.r/   r&   
renderabler3   N)rJ   rK   rL   rM   r   rN   r   rS   rE   rC   rX   rX      s     #!  !!"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j2                  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 j2                  ded)d fd9       Z 	 	 d[dddd:d;d<dddddd=d>d?d@d?d ee   d!ee   dee   dAd&dBdCdDdEdee   dee   dFee   dGee   dHed)dfdIZ!dddJdKed?   dee   dLed)dfdMZ"d\dNZ#	 	 	 	 	 	 d]dPZ$d1d2d5d6d)ee   fdQZ%edRee   dSee   dFed)ee   fdT       Z&d1d2dUedVed)ee'   fdWZ(dUed)efdXZ)d1d2d5d6dVed)efdYZ*d1d2d5d6dRee   d)dOfdZZ+y)^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                  |      | _
        |	| _        |
| _        || _        || _        || _        || _        || _        || _        || _        |xs d| _        |xs d| _        || _        || _        || _        || _        || _        || _        t9        |xs g       | _        | j                   j<                  }|D ]G  }t?        |t@              r| jC                  |       &tE        | j                         |_#         ||       I y )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__   s1   : &(!	

" w/ &&"$ 0
(.B(.B(&*.;0?"/3J4D"/E++F&#&v. #DLL 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   s,    * -

 
	
rE   c                 :    | j                   xs | j                  duS )z-Setting a non-None self.width implies expand.N)rw   r6   rA   s    rC   rf   zTable.expand  s     ||5tzz55rE   c                     || _         y)zSet expand.N)rw   )rB   rf   s     rC   rf   zTable.expand   s     rE   c                     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%  sC     88QJE88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     499~rE   consoler"   indexc                    t        j                         }| j                  r7||j                  | j                  |t	        | j                        z           z  }| j
                  |   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  st    

??W&&tus4???S7S'TUUEIIe$**	 W&&y11ErE   optionsr#   c           	      6   |j                   }| j                  | j                  }|dk  rt        dd      S | j                  }t	        | j                  ||j                  ||z
                    }| j                  }| j                  D cg c]  } |||j                  |      |       }}t	        d |D              |z   }| j                  t	        d |D              |z   n| j                  }	t        ||	      }
|
j                  | j                        }
|
S c c}w )Nr   c              3   4   K   | ]  }|j                     y wN)minimum.0measurements     rC   	<genexpr>z)Table.__rich_measure__.<locals>.<genexpr>T       D|##|   c              3   4   K   | ]  }|j                     y wr   )maximumr   s     rC   r   z)Table.__rich_measure__.<locals>.<genexpr>W  r   r   )r8   r6   r   r   sum_calculate_column_widthsupdate_width_measure_columnr\   clampr7   )rB   r   r   r8   extra_widthr   columnmeasurementsminimum_widthmaximum_widthr   s              rC   __rich_measure__zTable.__rich_measure__>  s)    %%	::!

Iq=q!$$''))--i+.EF
	
 .. ,,
& GW%9%9)%DfM& 	 

 D|DD{R 	
 

" D|DD{R 	
 "-?!''7
s   	 Dc                     | j                   S )zGet cell padding.)rv   rA   s    rC   rc   zTable.padding_  s     }}rE   c                 :    t        j                  |      | _        | S )zSet cell padding.)r   ru   rv   )rB   rc   s     rC   rc   zTable.paddingd  s      w/rE   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                        |||xs d|xs d|xs d||||	|
|||      }| j                  j                  |       y)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  sd    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(  rKt        |      }	| j
                  D ]  }
 ||	t        d              | j                  j                  |	       n||   }	|
 ||	d       pt        |      r
 ||	|       t        j                  d	t        |      j                   d
       | j
                  j                  t        ||             y)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                   j                  |       y r   )r=   rx   )r   rY   s     rC   add_cellzTable.add_row.<locals>.add_cell  s    MM  ,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  sA   $	-V 	-1A 	-d 	- >B+=N,, 3w</ ! 3w<#.>*??@  "++;!<E:G$u-AVT"X. ###F+ !$z*,//'Z(8(A(A'BBst  "=  			5kBCrE   c                 F    | j                   rd| j                   d   _        yy)z2Add a new section (draw a line after current row).TN)r]   rV   rA   s    rC   add_sectionzTable.add_section  s      99(,DIIbM% rE   r'   c           	   #     K   | j                   st        d       y |j                  }| j                  | j                  }| j                  }| j                  |j                  ||z
              }t        |      |z   }|j                  || j                  d       	 ddt        dt        ddddffd	}| j                  rE || j                  t        j                  | j                  d
      | j                         E d {    | j#                  |      E d {    | j$                  rF || j$                  t        j                  | j&                  d      | j(                        E d {    y y 7 r7 Y7 
w)N
)r6   rr   heighttextr/   r1   r$   r>   r'   c                     t        | t              rj                  | |d      n| }j                  |j	                  |            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  sY    
 dC( ""4u"F 
 >>^%:%:7%:%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__  st     ||$-%%	::!

I''..W)))k*AB
 &kK/  ( 

 JR
	
	#,
	7F
	
	 ::(

&&t'7'7G**  
 <<@@@<<(&&t'9'9?K,,   
 	As7   D E=E7E=E9 AE=0E;1E=9E=;E=c           
      ,   |j                   }| j                  }|D cg c]  }| j                  |||       }}|D cg c]  }|j                  xs d }}| j                  }	| j
                  }
| j                  r|D cg c]  }|j                  s|j                  xs d! }}t        |      rt        ||      D cg c]  \  }}|j                  rdn|j                  ! }}}|D cg c]1  }|j                  r#|j                  xs d |	|j                        z   3 }}|t        |      z
  }t        |||      }t        |      }t!        |      D ]&  \  }}|j                  s||   t#        |      z   ||<   ( t        |      }||kD  r| j%                  ||D cg c]  }|j                  du xr |j&                   ! c}|      }t        |      }||kD  r+||z
  }t)        |dgt+        |      z  ||      }t        |      }t        ||      D cg c]'  \  }}| j                  ||j-                  |      |      ) }}}|D cg c]  }|j                  xs d }}||k  r| j                  s| j.                  i|| j.                  |
z
  k  rW| j.                  |nt1        | j.                  |
z
  |      }t        ||z
  |      }t        ||      D cg c]
  \  }}||z    }}}|S c c}w c c}w c c}w c c}}w c c}w c c}w c c}}w c c}w c c}}w )zNCalculate the widths of each column, including padding, not including borders.r   r   N)r8   r\   r   r   _get_padding_widthr   rf   rI   r9   anyzipr6   r;   r   r   iterr   next_collapse_widthsr:   r   r|   r   r7   min)rB   r   r   r8   r\   r   width_ranges_ranger   get_padding_widthr   colratiosfixed_widthsflex_minimumflexible_widthflex_widthsiter_flex_widthsr   r   excess_widthr6   
_max_width
pad_widths_widthpads                             rC   r   zTable._calculate_column_widths  sH    %%	,,IP
IPvD  '6: 	 
 5AAL&&..%A%LA 33'';;07H3<<ciin1nFH6{ +.lG*D *D  Afnn<*D    #* ") \\&Q*;FMM*JJ")   
 "+S->!>.~v|T#'#4 %.w%7ME6(4U(;dCS>T(Tu &8 &k"**MTUW6&,,$&=v~~+==WUF
 f+KY&*Y6%lQC#f+4EvvV!&k &)%9%9ME6 $$Wg.B.B5.I6R%9   9EEffnn))FE)#NN&;$..;:V+W >>) +5yA 
 **{*BFKJ69&*6MN6M{vsfsl6MFNq
 B I    V F Os:   K&K+?K0K0?$K5*6K;$L 
,LLLr   wrapablec                    t        |      }||z
  }t        |      r|r|dkD  rt        d t        ||      D              t        fdt        ||      D              }|z
  }t        ||      D 	cg c]  \  }}	|k(  r|	rdnd }
}}	t        |
      r|s	 |S t	        ||      gt        |      z  }t        ||
||      }t        |      }||z
  }|r|dkD  r|S c c}	}w )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   | ]  \  }}|s	|  y wr   rS   )r   r6   
allow_wraps      rC   r   z)Table._collapse_widths.<locals>.<genexpr>W  s      !3H/eZJE3Hs   
c              3   :   K   | ]  \  }}|r|k7  r|nd   yw)r   NrS   )r   r6   r   
max_columns      rC   r   z)Table._collapse_widths.<locals>.<genexpr>Z  s,      (-B)z (EZ,?EQF-Bs   r   )r   r   maxr   r   r|   r   )r   r   r   r8   total_widthr   second_max_columncolumn_differencer6   r   r   
max_reducer   s               @rC   r   zTable._collapse_widthsE  s    &k"Y.x=,"2  !36vx3H! 
 %( (-0-B( %! %/1B$B! .1-B-B)z !J.:QAE-B   6{*;  ",0ABCc&kQ
%lFJO!&k*Y6' ,"2( s   2C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                  r= || j                  xs d       ||j                        z   }	 ||	|j                  f        ||j                  xs d      }
|j                  D ]  } ||
|f        | j                   r= || j"                  xs d       ||j"                        z   } |||j$                  f       |rTt&        }t)        |      D ]?  \  }}\  }}t+        | || |||            t-        |dd	      xs |j.                         A y	|D ]-  \  }}t+        ||t-        |dd	      xs |j.                         / y	w)
z3Get all the cells with padding and optional header.r   r   	first_rowlast_rowr>   c                     j                  | |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#q$,/D C&L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0==,,'l#q("c$,,&7!&;;MO	4 	4 	E#sCQTBT<U 	 	2 ?A	""%%	$T%6%6%<"=	##A L \6==12v||1r2
LLDZ&' !$T%6%6%<"=	##A L \6==12H4CI4N0t0eZZUD)ABJ
D9LV__  5O &/!zJ
D9LV__  &/s   G,G4c                 n    | j                   \  }}}}| j                  r|dkD  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  sA    $(LL!9a  aq(Y"67)##rE   c                    |j                   }|dk  rt        dd      S | j                  |j                        }|j                  5t        |j                  |z   |j                  |z         j                  |      S g }g }|j                  }|j                  }	t        j                  }
| j                  ||j                  |      D ])  } |
|||j                        \  }} ||        |	|       + t        |rt        |      nd|rt        |      n|      j                  |      }|j                  |j                  dn|j                  |z   |j                   d      }|S |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  sp    %%	q=q!$$//><<#},fll].Jl9%& !#
 "
&&
&&
&??OOGV]]FCD)'7DOOLJD$tt D
 ")C
Oq)C
Oy
 ,y
! 	 "''$$,D&2B2B]2R$$,D
  392B2B]2R
 rE   c              #   z   *+,-K   j                   j                  xs d      }|j                   j                  xs d      z   } fdt         j                        D        }t        t        |       } j                  r; j                  j                  |t         j                  j                              nd }|r j                  s|j                         n|}t        j                         }	 j                  }
 j                  } j                  } j                   } j"                  } j$                  }t        *|r *|j&                  |       *|j(                  |       *|j*                  |      f *|j,                  |       *|j.                  |       *|j0                  |      f *|j2                  |       *|j4                  |       *|j6                  |      fg}|r! *|j9                  |      |       |	 ng } j:                  }j                   }t        t=        |            D ]H  \  }\  }}}|xr |,|xr |+,s+s j>                  ||z
     nd }d}g },s+rtA        jB                         }n | ||r|dz
  n|            }t        |||
      D ]  \  }}}|jE                  ||jF                  |jH                  |jJ                  d       }jM                  |jN                  | ||j                        |z         }tQ        |tS        |            }|jU                  |        tQ        d |D              -dtV        tV        t              d	d
dtX        dt@        dtV        tV        t              f
*+,-fd} t        ||||
      D !cg c]@  \  }}!}}*j[                   | ||!j\                  | ||!j                        |z         ||      B c}}}!}|d d  |r|r#|r! *|j_                  |d|      |       |	 ||rdn|rdnd   \  }"}#}$|$j`                  jc                         r|$n) *|$j`                  |jd                  |$j                  z         }%tg        |      D ]9  }&|r|" ti        |      D ]  \  }'}(|(|&   E d {    |'r|%  |r|# |	 ; n(tg        |      D ]  }&|D ]  }(|(|&   E d {     |	  |r%|r#|r! *|j_                  |d|      |       |	 |xr |jj                  })|s|s|s|)s|r|r|tS        |      dz
  k\  r|r,r|r! *|j_                  |d|      |z  |       n *|j_                  |d|      |       |	 K |r"|r *|jm                  |      |       |	 y y y c c}}}!}w 7 7 w)Nr*   c              3   J   K   | ]  \  }}j                  ||        y wr   )r  )r   r   r   r   rB   s      rC   r   z Table._render.<locals>.<genexpr>  s+      
(?$f OOG\6:(?s    #)safer   )r6   r1   r:   r5   r   r/   c              3   2   K   | ]  }t        |        y wr   )r|   )r   r   s     rC   r   z Table._render.<locals>.<genexpr>>  s     954SY5s   r   r3   r   r6   r/   r>   c                     rd}nrd}|dk(  rj                  | ||      S |dk(  rj                  | ||      S j                  | ||      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@  sj     'H$Hu$#--dE:uMM)#00uj%PP,,T5*eLLrE   foot)edger   r   headmidrow)7r   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   	set_shaper3   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   r  row_cellr#  
max_heightrG   r   r6   r   r   r   linesr  _cellr0   r   _dividerdividerline_no	last_cellrendered_cellrV   r  r  r  r  s.   ``                                        @@@@rC   r   zTable._render  s     ''

(8b9"W%6%6t7H7H7NB%OO
(1$,,(?
 .2#}2E-F	
 xx HHiw7G7GH     	 /34;K;Kt((*QU<<>,,&&&&NN	__
,, T^^\:T__l;T//> T^^\:T__l;T//> T]]L9T^^\:T..=L" t||F3\BBL**%%	.7	8R.S*E*E4.;J-+J #: 		%+-. 
 J/1EZ!JJL	%!'519O	 (+68W'E#tV!("NN"NN#__ "0 "  ,,OO"#DJJ/); - 
 !SZ8
U# (F  9599JM4=)M/M M 	M
 d7m$M M8 36fhw2W 3X.E5$ ""!%++.:	 	 3XE!H K"VV)Dl  #N(4%Q4aUV(X%eX
  }}**, ! y'A'AHNN'R   %Z0G "
4=e4D0	=#0#999(")M 5E !#"N  1  %Z0G).#0#999 */"N  1 +LLiL@,  1#//Kw+(Uc)nq6H-H(Z& LLYLG'Q( 
 ' LLYLG  #Nk /Tn I4??62LAAN 4ID : :sX   NV;$AV.)B4V;V6
V;%.V;V9
AV;V;#V;'V;<V;A5V;9V;)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[      st   > &\
s)O
 %)&*##'!$#'%+!& ! !48,:,:,0+/-1)1+37>&$>& !>& (#	>&
 }>& C=>& cgg>& 4.>& #>& >& >& >& >& >& >&  !>&" #>&$ %>&& Xi01'>&( y))>&* y)+>&, y)->&. i(/>&0  	*1>&2 '3>&4 )5>&6 7>&8 
9>&@  &'!%
$
 #
 	

 
 
 

 
@ 6 6 6 ]]T d   c   3  Y s y  +;	B sCc12   ^^0 W   $&#%5$
 -1,0%)#)*/%/##'#'#5$ 5$ !5$
 y)5$ y)5$ 	"5$ !5$ (5$ #5$ }5$ C=5$ C=5$ }5$ 5$  
!5$t &*!	-D/0-D 	"-D 	-D
 
-D^-- -+;-	-^> >+;>	c>@ $#Y$*.t*$AD$	c$ $LG G03G=CG	%GR$s $s $&& "& 	&
 
&Pr r+;rEI#Y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         j                          t         j                  t        |              t         j                          y r   )r   printrulerr   )r   s    rC   r+   r+     s$    MMOLL4)MMOrE   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.highlighterrL  pip._vendor.rich.table_timerrM  tabler{   r   rz   r+   rr   rU  rf   r6   rl   rk   rj   rS   rE   rC   <module>rh     s   1 1
 
 
  -  2 & !   / #  #    W& W& W&t M M M#J #@L @F z0<5	~	$(#
 	]&$ 	 	
 		2wgF.	

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