o
    =Ñ®a®
  ã                   @   sD   d Z ddlmZ ddlmZ ddlmZmZmZ G dd„ deƒZ	dS )zeAsciiTable is the main table class. To be inherited by other tables. Define convenience methods here.é    )Ú	BaseTable)Úterminal_size)Úcolumn_max_widthÚmax_dimensionsÚtable_widthc                   @   s<   e Zd ZdZdd„ Zedd„ ƒZedd„ ƒZedd	„ ƒZd
S )Ú
AsciiTablea  Draw a table using regular ASCII characters, such as ``+``, ``|``, and ``-``.

    :ivar iter table_data: List (empty or list of lists of strings) representing the table.
    :ivar str title: Optional title to show within the top border of the table.
    :ivar bool inner_column_border: Separates columns.
    :ivar bool inner_footing_row_border: Show a border before the last row.
    :ivar bool inner_heading_row_border: Show a border after the first row.
    :ivar bool inner_row_border: Show a border in between every row.
    :ivar bool outer_border: Show the top, left, right, and bottom border.
    :ivar dict justify_columns: Horizontal justification. Keys are column indexes (int). Values are right/left/center.
    :ivar int padding_left: Number of spaces to pad on the left side of every cell.
    :ivar int padding_right: Number of spaces to pad on the right side of every cell.
    c                 C   sF   t | jƒd }| jrdnd}| jrdnd}| j| j }t|||||ƒS )zÔReturn the maximum width of a column based on the current terminal width.

        :param int column_number: The column number to query.

        :return: The max width of the column.
        :rtype: int
        r   é   é   )r   Ú
table_dataÚouter_borderÚinner_column_borderÚpadding_leftÚpadding_rightr   )ÚselfZcolumn_numberZinner_widthsr   Úinner_borderÚpadding© r   ú>usr/lib/python3.10/site-packages/terminaltables/ascii_table.pyr      s
   zAsciiTable.column_max_widthc                 C   s   | j stƒ S t| j ƒd S )zWReturn a list of integers representing the widths of each table column without padding.r   )r
   Úlistr   ©r   r   r   r   Úcolumn_widths%   s   zAsciiTable.column_widthsc                 C   s   | j tƒ d kS )zSReturn True if the table fits within the terminal width, False if the table breaks.r   )r   r   r   r   r   r   Úok,   s   zAsciiTable.okc                 C   s>   t | j| j| jƒd }| jrdnd}| jrdnd}t|||ƒS )z<Return the width of the table including padding and borders.r   r   r	   )r   r
   r   r   r   r   r   )r   Zouter_widthsr   r   r   r   r   r   1   s   zAsciiTable.table_widthN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr   r   r   r   r   r   r   r      s    

r   N)
r   Zterminaltables.base_tabler   Zterminaltables.terminal_ior   Z"terminaltables.width_and_alignmentr   r   r   r   r   r   r   r   Ú<module>   s
    