o
    =Ѯa
                     @   s0   d Z ddlmZ ddlmZ G dd deZdS )z"GithubFlavoredMarkdownTable class.    )
AsciiTable)combinec                       s0   e Zd ZdZ fddZdd Zdd Z  ZS )GithubFlavoredMarkdownTablea?  Github flavored markdown table.

    https://help.github.com/articles/github-flavored-markdown/#tables

    :ivar iter table_data: List (empty or list of lists of strings) representing the table.
    :ivar dict justify_columns: Horizontal justification. Keys are column indexes (int). Values are right/left/center.
    c                    s   t t| | dS )zwConstructor.

        :param iter table_data: List (empty or list of lists of strings) representing the table.
        N)superr   __init__)self
table_data	__class__ ?usr/lib/python3.10/site-packages/terminaltables/github_table.pyr      s   z$GithubFlavoredMarkdownTable.__init__c                 C   s   t | j}| j}| j}| j}t }t|D ]H\}}	| j|}
t	d|	}	|
dkr4|
d||	d    q|
dkrD|
||	d  d  q|
dkrV|
d||	d   d  q|
||	  qt||||S )a  Handle the GitHub heading border.

        E.g.:
        |:---|:---:|---:|----|

        :param _: Unused.
        :param iter outer_widths: List of widths (with padding) for each column.

        :return: Prepared border strings in a generator.
        :rtype: iter
           left:   rightcenter   )strZCHAR_INNER_HORIZONTALZCHAR_OUTER_LEFT_VERTICALZCHAR_INNER_VERTICALZCHAR_OUTER_RIGHT_VERTICALlist	enumerateZjustify_columnsgetmaxappendr   )r   _outer_widthsZ
horizontalr   Z	intersectr   columnsiwidthZjustifyr   r   r   horizontal_border   s    

z-GithubFlavoredMarkdownTable.horizontal_borderc                 c   sP    t | jD ]\}}| |d||| D ]}|V  q|dkr%| d|V  qdS )aR  Combine everything and yield every line of the entire table with borders.

        :param iter inner_widths: List of widths (no padding) for each column.
        :param iter inner_heights: List of heights (no padding) for each row.
        :param iter outer_widths: List of widths (with padding) for each column.
        :return:
        rowr   N)r   r   Zgen_row_linesr   )r   Zinner_widthsZinner_heightsr   r   r    liner   r   r   	gen_table8   s   z%GithubFlavoredMarkdownTable.gen_table)__name__
__module____qualname____doc__r   r   r"   __classcell__r   r   r	   r   r      s
     r   N)r&   Zterminaltables.ascii_tabler   Zterminaltables.buildr   r   r   r   r   r   <module>   s    