Ë
    ³­ÂjCY  ã                   óL  — d Z ddlmZ ddgZdZdZdZdZdd	lZdd	l	Z		 dd	l
Z
d
„ Z	 dd	lZd„ ZddlmZ ej(                  dk\  reZeZneZeZd„ Zd„ Z G d„ de«      Z G d„ de«      Z G d„ d«      Ze dk(  ræ e«       Z!e!jE                  g d¢«       e!jG                  g d¢«       e!jI                  g d¢g d¢g d¢g d¢g«        e%e!jM                  «       «        e%«         e«       Z!e!jO                  ejP                  «       e!jS                  g d¢«       e!jE                  g d¢«       e!jI                  g d ¢g d!¢g d"¢g d#¢g d$¢g«        e%e!jM                  «       «       y	y	# e$ r2 	 dd	lZd„ Zn%# e$ r ej                  j                  d«       ‚ w xY wY �Œnw xY w# e$ r d„ ZY �Œuw xY w)%a¦  module to create simple ASCII tables


Example:

    table = Texttable()
    table.set_cols_align(["l", "r", "c"])
    table.set_cols_valign(["t", "m", "b"])
    table.add_rows([["Name", "Age", "Nickname"],
                    ["Mr\nXavier\nHuon", 32, "Xav'"],
                    ["Mr\nBaptiste\nClement", 1, "Baby"],
                    ["Mme\nLouise\nBourgeau", 28, "Lou\n\nLoue"]])
    print(table.draw())
    print()

    table = Texttable()
    table.set_deco(Texttable.HEADER)
    table.set_cols_dtype(['t',  # text
                          'f',  # float (decimal)
                          'e',  # float (exponent)
                          'i',  # integer
                          'a']) # automatic
    table.set_cols_align(["l", "r", "r", "r", "l"])
    table.add_rows([["text",    "float", "exp", "int", "auto"],
                    ["abcd",    "67",    654,   89,    128.001],
                    ["efghijk", 67.5434, .654,  89.6,  12800000000000000000000.00023],
                    ["lmn",     5e-78,   5e-78, 89.4,  .000000000000128],
                    ["opqrstu", .023,    5e+78, 92.,   12800000000000000000000]])
    print(table.draw())

Result:

    +----------+-----+----------+
    |   Name   | Age | Nickname |
    +==========+=====+==========+
    | Mr       |     |          |
    | Xavier   |  32 |          |
    | Huon     |     |   Xav'   |
    +----------+-----+----------+
    | Mr       |     |          |
    | Baptiste |   1 |          |
    | Clement  |     |   Baby   |
    +----------+-----+----------+
    | Mme      |     |   Lou    |
    | Louise   |  28 |          |
    | Bourgeau |     |   Loue   |
    +----------+-----+----------+

    text   float       exp      int     auto
    ===========================================
    abcd   67.000   6.540e+02   89    128.001
    efgh   67.543   6.540e-01   90    1.280e+22
    ijkl   0.000    5.000e-78   89    0.000
    mnop   0.023    5.000e+78   92    1.280e+22
é    )ÚdivisionÚ	TexttableÚArraySizeErrorz%Gerome Fournier <jef(at)foutaise.org>ÚMITz1.7.0añ  Jeff Kowalczyk:
    - textwrap improved import
    - comment concerning header output

Anonymous:
    - add_rows method, for adding rows in one go

Sergey Simonenko:
    - redefined len() function to deal with non-ASCII characters

Roger Lew:
    - columns datatype specifications

Brian Peterson:
    - better handling of unicode errors

Frank Sachsenheim:
    - add Python 2/3-compatibility

Maximilian Hils:
    - fix minor bug for Python 3 compatibility

frinkelpi:
    - preserve empty lines
Nc                 ó.   — t        j                  | |«      S ©N)ÚcjkwrapÚwrap©ÚtxtÚwidths     úO/home/uftp/.local/share/uv/tools/vcsi/lib/python3.12/site-packages/texttable.pyÚtextwrapperr   g   s   € Ü�|‰|˜C Ó'Ð'ó    c                 ó.   — t        j                  | |«      S r   )Útextwrapr
   r   s     r   r   r   l   s   € Ü—=‘=  eÓ,Ð,r   zCan't import textwrap module!
c                 ó@   — t        dt        j                  | «      «      S )ú:Return the rendering width of a unicode character
        r   )ÚmaxÚwcwidth©Úcs    r   Úuchar_widthr   w   s   € ô �1”g—o‘o aÓ(Ó)Ð)r   c                 ó`   — t        j                  | «      dv ryt        j                  | «      ryy)r   ÚWFé   r   é   )ÚunicodedataÚeast_asian_widthÚ	combiningr   s    r   r   r   |   s.   € ô ×'Ñ'¨Ó*¨dÑ2ØÜ×"Ñ" 1Ô%Øàr   )Úreduce)é   r   c                 ó  — t        | t        «      r| S t        | t        «      r	 t        | d«      S t        | «      S # t        $ r=}t        j
                  j                  d| ›d|›d�«       t        | dd«      cY d}~S d}~ww xY w)z7Return a unicode representation of a python object
    zutf-8z)UnicodeDecodeError exception for string 'z': Ú
ÚreplaceN)Ú
isinstanceÚunicode_typeÚ
bytes_typeÚUnicodeDecodeErrorÚsysÚstderrÚwrite)ÚobjÚstrerrors     r   Úobj2unicoder/   �   sv   € ô �#”|Ô$Øˆ
Ü	�CœÔ	$ð	9Ü  WÓ-Ð-ô
 ˜CÓ Ð øô	 "ò 	9Ü�J‰J×ÒÒUXÒZbÐcÔdÜ  W¨iÓ8Õ8ûð	9ús   ¤; »	BÁ2A<Á6BÁ<Bc                 óÂ   — t        | t        «      st        | t        «      r+t        t	        | «      D �cg c]  }t        |«      ‘Œ c}«      S | j                  «       S c c}w )zMRedefining len here so it will be able to work with non-ASCII characters
    )r&   r(   r'   Úsumr/   r   Ú__len__)Úiterabler   s     r   Úlenr4   Ÿ   sQ   € ô �(œJÔ'¬:°hÄÔ+MÜ¬K¸Ô,AÓBÑ,A q”K •NÐ,AÑBÓCÐCà×ÑÓ!Ð!ùò Cs   ³Ac                   ó   — e Zd ZdZd„ Zd„ Zy)r   zEException raised when specified rows don't fit the required size
    c                 ó@   — || _         t        j                  | |d«       y )NÚ )ÚmsgÚ	ExceptionÚ__init__)Úselfr8   s     r   r:   zArraySizeError.__init__¬   s   € ØˆŒÜ×Ñ˜4  bÕ)r   c                 ó   — | j                   S r   )r8   ©r;   s    r   Ú__str__zArraySizeError.__str__°   s   € Ø�x‰xˆr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r:   r>   © r   r   r   r   ¨   s   „ ñò*ór   c                   ó   — e Zd ZdZy)ÚFallbackToTextz#Used for failed conversion to floatN)r?   r@   rA   rB   rC   r   r   rE   rE   ´   s   „ Ù-Ør   rE   c                   óB  — e Zd ZdZdZdZdZd*d„Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd+d„Zd„ Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d „ Z#d!„ Z$d"„ Z%d,d#„Z&d$„ Z'd%„ Z(d&„ Z)d,d'„Z*d(„ Z+y))-r   r   r   é   é   c                 ó
  — | j                  |«       d| _        t        j                  t        j                  z  t        j
                  z  t        j                  z  | _        | j                  g d¢«       | j                  «        y)z­Constructor

        - max_width is an integer, specifying the maximum width of the table
        - if set to 0, size is unlimited, therefore cells won't be wrapped
        r"   )Ú-Ú|Ú+Ú=N)
Úset_max_widthÚ
_precisionr   ÚVLINESÚHLINESÚBORDERÚHEADERÚ_decoÚ	set_charsÚreset©r;   Ú	max_widths     r   r:   zTexttable.__init__À   s`   € ð 	×Ñ˜9Ô%ØˆŒä×%Ñ%¬	×(8Ñ(8Ñ8¼9×;KÑ;KÑKÜ×ÑñˆŒ
à�‰Ò+Ô,Ø�
‰
�r   c                 ó>   — d| _         d| _        g | _        g | _        | S )z<Reset the instance

        - reset rows and header
        N)Ú_hline_stringÚ	_row_sizeÚ_headerÚ_rowsr=   s    r   rV   zTexttable.resetÏ   s&   € ð "ˆÔØˆŒØˆŒØˆŒ
Øˆr   c                 ó0   — |dkD  r	|| _         | S d| _         | S )zÄSet the maximum width of the table

        - max_width is an integer, specifying the maximum width of the table
        - if set to 0, size is unlimited, therefore cells won't be wrapped
        r   F)Ú
_max_widthrW   s     r   rN   zTexttable.set_max_widthÛ   s%   € ð (1°1¢}˜)ˆŒØˆð ;@ˆŒØˆr   c                 óÔ   — t        |«      dk7  rt        d«      ‚|D �cg c]  }t        |«      ‘Œ c}D �cg c]  }|dd ‘Œ	 }}|\  | _        | _        | _        | _        | S c c}w c c}w )zéSet the characters used to draw lines between rows and columns

        - the array should contain 4 fields:

            [horizontal, vertical, corner, header]

        - default is set to:

            ['-', '|', '+', '=']
        rG   z!array should contain 4 charactersNr   )r4   r   ÚstrÚ_char_horizÚ
_char_vertÚ_char_cornerÚ_char_header)r;   ÚarrayÚsÚxs       r   rU   zTexttable.set_charsä   ss   € ô ˆu‹:˜Š?Ü Ð!DÓEÐEÙ38Ó!:±5¨a¤3 q¥6°5Ò!:Ó<Ñ!:˜A�!�B�Q’%Ð!:ˆÐ<à49ñ	2ˆÔ	˜4œ?ØÔ˜tÔ0Øˆùò ";ùÒ<s
   žA µA%c                 ó"   — || _         d| _        | S )a¯  Set the table decoration

        - 'deco' can be a combination of:

            Texttable.BORDER: Border around the table
            Texttable.HEADER: Horizontal line below the header
            Texttable.HLINES: Horizontal lines between rows
            Texttable.VLINES: Vertical lines between columns

           All of them are enabled by default

        - example:

            Texttable.BORDER | Texttable.HEADER
        N)rT   rZ   )r;   Údecos     r   Úset_decozTexttable.set_deco÷   s   € ð" ˆŒ
Ø!ˆÔØˆr   c                 ó6   — | j                  |«       || _        | S )zãSet the desired header alignment

        - the elements of the array should be either "l", "c" or "r":

            * "l": column flushed left
            * "c": column centered
            * "r": column flushed right
        )Ú_check_row_sizeÚ_header_align©r;   rf   s     r   Úset_header_alignzTexttable.set_header_align  s   € ð 	×Ñ˜UÔ#Ø"ˆÔØˆr   c                 ó6   — | j                  |«       || _        | S )zäSet the desired columns alignment

        - the elements of the array should be either "l", "c" or "r":

            * "l": column flushed left
            * "c": column centered
            * "r": column flushed right
        )rm   Ú_alignro   s     r   Úset_cols_alignzTexttable.set_cols_align  s   € ð 	×Ñ˜UÔ#ØˆŒØˆr   c                 ó6   — | j                  |«       || _        | S )a,  Set the desired columns vertical alignment

        - the elements of the array should be either "t", "m" or "b":

            * "t": column aligned on the top of the cell
            * "m": column aligned on the middle of the cell
            * "b": column aligned on the bottom of the cell
        )rm   Ú_valignro   s     r   Úset_cols_valignzTexttable.set_cols_valign(  s   € ð 	×Ñ˜UÔ#ØˆŒØˆr   c                 ó6   — | j                  |«       || _        | S )aW  Set the desired columns datatype for the cols.

        - the elements of the array should be either a callable or any of
          "a", "t", "f", "e", "i" or "b":

            * "a": automatic (try to use the most appropriate datatype)
            * "t": treat as text
            * "f": treat as float in decimal format
            * "e": treat as float in exponential format
            * "i": treat as int
            * "b": treat as boolean
            * a callable: should return formatted string for any value given

        - by default, automatic datatyping is used for each column
        )rm   Ú_dtypero   s     r   Úset_cols_dtypezTexttable.set_cols_dtype6  s   € ð" 	×Ñ˜UÔ#ØˆŒØˆr   c                 óø   — | j                  |«       	 t        t        t        |«      «      }t	        t
        |«      dk  rt        ‚	 || _
        | S # t        $ r! t        j                  j                  d«       ‚ w xY w)z¸Set the desired columns width

        - the elements of the array should be integers, specifying the
          width of each column. For example:

                [10, 20, 5]
        r   z-Wrong argument in column width specification
)rm   ÚlistÚmapÚintr!   ÚminÚ
ValueErrorr*   r+   r,   Ú_widthro   s     r   Úset_cols_widthzTexttable.set_cols_widthK  sv   € ð 	×Ñ˜UÔ#ð	ÜœœS %›Ó)ˆEÜ”c˜5Ó! QÒ&Ü Ð ð 'ð
 ˆŒØˆøô	 ò 	Ü�J‰J×ÑÐMÔNØð	ús   “2A Á*A9c                 óV   — t        |«      t        us|dk  rt        d«      ‚|| _        | S )zŽSet the desired precision for float/exponential formats

        - width must be an integer >= 0

        - default value is set to 3
        r   z'width must be an integer greater then 0)Útyper}   r   rO   )r;   r   s     r   Úset_precisionzTexttable.set_precision_  s.   € ô �E‹{œcÑ! U¨Q¢YÜÐFÓGÐGØˆŒØˆr   c                 ód   — | j                  |«       t        t        t        |«      «      | _        | S )z(Specify the header of the table
        )rm   r{   r|   r/   r\   ro   s     r   ÚheaderzTexttable.headerl  s*   € ð 	×Ñ˜UÔ#ÜœC¤¨UÓ3Ó4ˆŒØˆr   c                 ó  — | j                  |«       t        | d«      sdg| j                  z  | _        g }t	        |«      D ]&  \  }}|j                  | j                  ||«      «       Œ( | j                  j                  |«       | S )zSAdd a row in the rows stack

        - cells can contain newlines and tabs
        rx   Úa)rm   Úhasattrr[   rx   Ú	enumerateÚappendÚ_strr]   )r;   rf   ÚcellsÚirh   s        r   Úadd_rowzTexttable.add_rowt  ss   € ð 	×Ñ˜UÔ#ä�t˜XÔ&Ø˜% $§.¡.Ñ0ˆDŒKàˆÜ˜eÖ$‰DˆAˆqØ�L‰L˜Ÿ™ 1 a›Õ)ð %à�
‰
×Ñ˜%Ô Øˆr   c                 óÜ   — |rQt        |d«      r,t        |d«      r | j                  |j                  «       «       n| j                  |d   «       |dd }|D ]  }| j                  |«       Œ | S )züAdd several rows in the rows stack

        - The 'rows' argument can be either an iterator returning arrays,
          or a by-dimensional array
        - 'header' specifies if the first row should be used as the header
          of the table
        Ú__iter__Únextr   r   N)r‰   r†   r’   r�   )r;   Úrowsr†   Úrows       r   Úadd_rowszTexttable.add_rows…  sb   € ñ Ü�t˜ZÔ(¬W°T¸6Ô-BØ—‘˜DŸI™I›KÕ(à—‘˜D ™GÔ$Ø˜A˜B�x�ÛˆCØ�L‰L˜Õð àˆr   c                 ó~  — | j                   s| j                  sy| j                  «        | j                  «        d}| j	                  «       r|| j                  «       z  }| j                   rC|| j                  | j                   d¬«      z  }| j                  «       r|| j                  «       z  }d}| j                  D ]X  }|dz  }|| j                  |«      z  }| j                  «       sŒ-|t        | j                  «      k  sŒF|| j                  «       z  }ŒZ | j	                  «       r|| j                  «       z  }|dd S )zJDraw the table

        - the table is returned as a whole string
        Nr7   T)Úisheaderr   r   éÿÿÿÿ)r\   r]   Ú_compute_cols_widthÚ_check_alignÚ_has_borderÚ_hlineÚ
_draw_lineÚ_has_headerÚ_hline_headerÚ_has_hlinesr4   )r;   ÚoutÚlengthr”   s       r   ÚdrawzTexttable.drawš  s  € ð �|Š| D§J¢JØØ× Ñ Ô"Ø×ÑÔØˆØ×ÑÔØ�4—;‘;“=Ñ ˆCØ�<Š<Ø�4—?‘? 4§<¡<¸$�?Ó?Ñ?ˆCØ×ÑÔ!Ø�t×)Ñ)Ó+Ñ+�ØˆØ—:”:ˆCØ�a‰KˆFØ�4—?‘? 3Ó'Ñ'ˆCØ×ÑÕ! f¬s°4·:±:«Ó&>Ø�t—{‘{“}Ñ$‘ð	 ð
 ×ÑÔØ�4—;‘;“=Ñ ˆCØ�3�Bˆxˆr   c                 ól   — |€
t        «       ‚	 t        |«      S # t        t        f$ r t        «       ‚w xY wr   )rE   ÚfloatÚ	TypeErrorr   )Úclsrh   s     r   Ú	_to_floatzTexttable._to_floatµ  s;   € àˆ9Ü Ó"Ð"ð	#Ü˜“8ˆOøÜœ:Ð&ò 	#Ü Ó"Ð"ð	#ús   Ž
 ™3c           	      ó”   — t        |«      t        k(  rt        |«      S t        t        t        | j	                  |«      «      «      «      S )z)Integer formatting class-method.
        )rƒ   r}   ra   Úroundr¨   ©r§   rh   Úkws      r   Ú_fmt_intzTexttable._fmt_int¾  s6   € ô �‹7”cŠ>Ü�q“6ˆMä”sœ5 §¡¨qÓ!1Ó2Ó3Ó4Ð4r   c                 óP   — |j                  d«      }d|| j                  |«      fz  S )zÉFloat formatting class-method.

        - x parameter is ignored. Instead kw-argument f being x float-converted
          will be used.

        - precision will be taken from `n` kw-argument.
        Únz%.*f©Úgetr¨   ©r§   rh   r¬   r¯   s       r   Ú
_fmt_floatzTexttable._fmt_floatÇ  ó*   € ð �F‰F�3‹KˆØ˜˜CŸM™M¨!Ó,Ð-Ñ-Ð-r   c                 óP   — |j                  d«      }d|| j                  |«      fz  S )zÏExponential formatting class-method.

        - x parameter is ignored. Instead kw-argument f being x float-converted
          will be used.

        - precision will be taken from `n` kw-argument.
        r¯   z%.*er°   r²   s       r   Ú_fmt_expzTexttable._fmt_expÓ  r´   r   c                 ó   — t        |«      S )zString formatting class-method.)r/   r«   s      r   Ú	_fmt_textzTexttable._fmt_textß  s   € ô ˜1‹~Ðr   c                 ó*   — t        t        |«      «      S )zBoolean formatting class-method)ra   Úboolr«   s      r   Ú	_fmt_boolzTexttable._fmt_boolä  s   € ô ”4˜“7‹|Ðr   c                 ó  — | j                  |«      }t        |«      dkD  r| j                  }nX||k7  r| j                  }nF|t	        |«      z
  dk(  r)t        |t        «      r| j                  n| j                  }n| j                  } ||fi |¤ŽS )zauto formatting class-method.g    „×—Ar   )
r¨   Úabsr¶   r¸   rª   r&   rº   r»   r­   r³   )r§   rh   r¬   ÚfÚfns        r   Ú	_fmt_autozTexttable._fmt_autoé  su   € ð �M‰M˜!ÓˆÜˆq‹6�CŠ<Ø—‘‰BØ�!ŠVØ—‘‰BØ”�q“‰\˜QÒÜ",¨Q´Ô"5�—’¸3¿<¹<‰Bà—‘ˆBÙ�!‰{�r‰{Ðr   c                 óD  — | j                   | j                  | j                  | j                  | j                  | j
                  dœ}| j                  }| j                  |   }	 t        |«      r ||«      S  ||   ||¬«      S # t        $ r | j                  |«      cY S w xY w)zŽHandles string formatting of cell data

            i - index of the cell datatype in self._dtype
            x - cell data to format
        )rˆ   rŽ   Úbr¾   ÚeÚt)r¯   )
rÀ   r­   r»   r³   r¶   r¸   rO   rx   ÚcallablerE   )r;   rŽ   rh   ÚFMTr¯   Údtypes         r   rŒ   zTexttable._str÷  s“   € ð —‘Ø—‘Ø—‘Ø—‘Ø—‘Ø—‘ñˆð �O‰OˆØ—‘˜A‘ˆð	%Ü˜ŒÙ˜Q“x�à!�s˜5‘z ! qÔ)Ð)øÜò 	%Ø—>‘> !Ó$Ò$ð	%ús   Á"B Á5B ÂBÂBc                 óž   — | j                   st        |«      | _         y| j                   t        |«      k7  rt        d| j                   z  «      ‚y)zCCheck that the specified array fits the previous rows size
        z array should contain %d elementsN)r[   r4   r   ro   s     r   rm   zTexttable._check_row_size  sG   € ð �~Š~Ü  ›ZˆD�NØ�^‰^œs 5›zÒ)Ü Ð!CØ—.‘.ñ"!ó "ð "ð *r   c                 óB   — | j                   t        j                  z  dkD  S )z8Return a boolean, if vlines are required or not
        r   )rT   r   rP   r=   s    r   Ú_has_vlineszTexttable._has_vlines  ó   € ð �z‰zœI×,Ñ,Ñ,¨qÑ0Ð0r   c                 óB   — | j                   t        j                  z  dkD  S )z8Return a boolean, if hlines are required or not
        r   )rT   r   rQ   r=   s    r   r    zTexttable._has_hlines   rË   r   c                 óB   — | j                   t        j                  z  dkD  S )z7Return a boolean, if border is required or not
        r   )rT   r   rR   r=   s    r   r›   zTexttable._has_border&  rË   r   c                 óB   — | j                   t        j                  z  dkD  S )z<Return a boolean, if header line is required or not
        r   )rT   r   rS   r=   s    r   rž   zTexttable._has_header,  rË   r   c                 ó$   — | j                  d«      S )z'Print header's horizontal line
        T)Ú_build_hliner=   s    r   rŸ   zTexttable._hline_header2  s   € ð × Ñ  Ó&Ð&r   c                 ó\   — | j                   s| j                  «       | _         | j                   S )z!Print an horizontal line
        )rZ   rÐ   r=   s    r   rœ   zTexttable._hline8  s*   € ð ×!Ò!Ø!%×!2Ñ!2Ó!4ˆDÔØ×!Ñ!Ð!r   c                 óV  — | j                   }|r| j                  }|›|| j                  g| j                  «          ›|›�}|j	                  | j
                  D �cg c]  }||z  ‘Œ	 c}«      }| j                  «       r#| j                  ›|›|›|›| j                  ›d�}|S |dz  }|S c c}w )zTReturn a string used to separated rows or separate header from
        rows
        r$   )rb   re   rd   rÊ   Újoinr€   r›   )r;   Ú	is_headerÚhorizrg   r¯   Úls         r   rÐ   zTexttable._build_hline@  s³   € ð × Ñ ˆÙØ×%Ñ%ˆEá  t×'8Ñ'8Ð9¸$×:JÑ:JÓ:LÒMÙðˆð �F‰F t§{¢{Ó3¡{ !�E˜A“I {Ñ3Ó4ˆà×ÑÔØ"&×"3Ò"3±U¹A¹uØ×!Ó!ð#ˆAð ˆð �‰IˆAØˆùò 4s   ÁB&c                 ó.  — |j                  d«      }d}|D ]|  }d}|j                  d«      }t        |t        t        dt	        |«      dz   «      «      «      D ]-  \  }}|t	        |«      z   }|t	        |«      k  sŒ#|dz  dz   dz  }Œ/ t        ||«      }Œ~ |S )z�Return the width of the cell

        Special characters are taken into account to return the width of the
        cell, such like newlines and tabs
        r$   r   Ú	r   rH   )ÚsplitÚzipr{   Úranger4   r   )	r;   ÚcellÚ
cell_linesÚmaxiÚliner¢   ÚpartsÚpartrŽ   s	            r   Ú	_len_cellzTexttable._len_cellT  sž   € ð —Z‘Z Ó%ˆ
ØˆÛˆDØˆFØ—J‘J˜tÓ$ˆEÜ˜u¤d¬5°´C¸³JÀ±NÓ+CÓ&DÖE‘��aØ¤# d£)Ñ+�Ø”s˜5“z“>Ø$ a™i¨!™m¨qÑ0‘Fð Fô �t˜VÓ$‰Dð ð ˆr   c                 óD  — t        | d«      ryg }| j                  r(| j                  D �cg c]  }| j                  |«      ‘Œ }}| j                  D ]S  }t	        |t        t        t        |«      «      «      «      D ]'  \  }}	 t        ||   | j                  |«      «      ||<   Œ) ŒU t        |«      }t        |«      }d|dz
  z  ddg| j                  «          z   }| j                  ry||z   | j                  kD  rg	 | j                  ||z   k  rt        d«      ‚| j                  |z
  }	dg|z  }
d}|	dkD  r+|
|   ||   k  r|
|xx   dz  cc<   |	dz  }	|dz   |z  }|	dkD  rŒ+|
}|| _        yc c}w # t        t        f$ r$ |j                  | j                  |«      «       Y �Œ$w xY w)a  Return an array with the width of each column

        If a specific width has been specified, exit. If the total of the
        columns width exceed the table desired width, another width will be
        computed to fit, and cells will be wrapped.
        r€   Nr"   r   r   rG   z max_width too low to render data)r‰   r\   râ   r]   rÚ   r{   rÛ   r4   r   r¦   Ú
IndexErrorr‹   r1   r›   r_   r   r€   )r;   rÞ   rh   r”   rÜ   rŽ   ÚncolsÚcontent_widthÚ
deco_widthÚavailable_widthÚnewmaxis              r   r™   zTexttable._compute_cols_widthg  s¥  € ô �4˜Ô"ØØˆØ�<Š<Ø04·²Ó>±¨1�T—^‘^ AÕ&°ˆDÐ>Ø—:”:ˆCÜ˜c¤4¬¬c°#«h«Ó#8Ö9‘��Qð6Ü! $ q¡'¨4¯>©>¸$Ó+?Ó@�D˜’Gñ :ð ô �D“	ˆÜ˜D›	ˆØ˜˜a™‘[ A a 5¨×)9Ñ)9Ó);Ñ#<Ñ<ˆ
Ø�?Š? °
Ñ :¸d¿o¹oÒMðð �‰ %¨*Ñ"4Ò5Ü Ð!CÓDÐDØ"Ÿo™o°
Ñ:ˆOØ�c˜E‘kˆGØˆAØ! AÒ%Ø˜1‘:  Q¡Ò'Ø˜A“J !‘O“JØ# qÑ(�OØ˜‘U˜e‘O�ð	 " AÓ%ð
 ˆDØˆ�ùò5 ?øô
 "¤:Ð.ò 6Ø—K‘K §¡¨tÓ 4×5ð6ús   ªE'Â!E,Å,/FÆFc                 óÌ   — t        | d«      sdg| j                  z  | _        t        | d«      sdg| j                  z  | _        t        | d«      sdg| j                  z  | _        yy)zFCheck if alignment has been specified, set default one if not
        rn   r   rr   rÖ   ru   rÄ   N)r‰   r[   rn   rr   ru   r=   s    r   rš   zTexttable._check_align�  s^   € ô �t˜_Ô-Ø"% ¨¯©Ñ!7ˆDÔÜ�t˜XÔ&Ø˜% $§.¡.Ñ0ˆDŒKÜ�t˜YÔ'Ø˜5 4§>¡>Ñ1ˆD�Lð (r   c           	      ó¼  — | j                  ||«      }d}d}t        t        |d   «      «      D �]*  }| j                  «       r|d| j                  z  z  }d}t        || j                  | j                  «      D ]·  \  }}}	|dz  }||   }
|t        |
«      z
  }|r| j                  |dz
     }	|	dk(  r|||z  |
z   z  }n@|	dk(  r0|t        |dz  «      |z  |
z   t        |dz  |dz  z   «      |z  z   z  }n||
||z  z   z  }|t        |«      k  sŒ“|d	|| j                  g| j                  «          z  z  }Œ¹ |d
d|| j                  z   g| j                  «          z  z  }�Œ- |S )zPDraw a line

        Loop over a single cell length, over all the cells
        Ú r7   r   z%s r   Úrr   r   z %s z%s
)Ú_splititrÛ   r4   r›   rc   rÚ   r€   rr   rn   r}   rÊ   )r;   rß   r—   Úspacer¡   rŽ   r¢   rÜ   r   ÚalignÚ	cell_lineÚfills               r   r�   zTexttable._draw_lineš  s‹  € ð �}‰}˜T 8Ó,ˆØˆØˆÜ”s˜4 ™7“|×$ˆAØ×ÑÔ!Ø�u˜tŸ™Ñ.Ñ.�ØˆFÜ&)¨$°·±¸T¿[¹[Ö&IÑ"��e˜UØ˜!‘�Ø  ™G�	Øœs 9›~Ñ-�ÙØ ×.Ñ.¨v¸©zÑ:�EØ˜C’<Ø˜4 %™<¨)Ñ3Ñ3‘CØ˜c’\ØœC  Q¡›K¨%Ñ/°)Ñ;Ü! $ q¡&¨4°©6¡/Ó2°UÑ:ñ;ñ <‘Cð ˜9 t¨e¡|Ñ3Ñ3�CØœC ›IÓ%Ø˜6 U¨D¯O©OÐ$<¸T×=MÑ=MÓ=OÑ$PÑPÑP‘Cð 'Jð �6˜R ¨¯©Ñ!8Ð9¸$×:JÑ:JÓ:LÑMÑMÑMŠCð' %ð( ˆ
r   c           	      óÂ  — g }t        || j                  «      D ]n  \  }}g }|j                  d«      D ]B  }|j                  «       dk(  r|j	                  d«       Œ(|j                  t        ||«      «       ŒD |j	                  |«       Œp t        t        t        t        t        |«      «      «      }t        || j                  «      D ]•  \  }}	|rd}	|	dk(  rK|t        |«      z
  }
dgt        |
dz  «      z  |dd |j                  dgt        |
dz  |
dz  z   «      z  «       ŒZ|	dk(  rdg|t        |«      z
  z  |dd Œu|j                  dg|t        |«      z
  z  «       Œ— |S )	zªSplit each element of line to fit the column width

        Each element is turned into a list, result of the wrapping of the
        string to the desired width
        r$   r7   rÄ   Úmr   Nr   rÂ   )rÚ   r€   rÙ   Ústripr‹   Úextendr   r!   r   r{   r|   r4   ru   r}   )r;   rß   r—   Úline_wrappedrÜ   r   rf   r   Úmax_cell_linesÚvalignÚmissings              r   rî   zTexttable._splitit¹  sL  € ð ˆÜ˜t T§[¡[Ö1‰KˆD�%ØˆEØ—Z‘Z Ö%�Ø—7‘7“9 ’?Ø—L‘L Õ$à—L‘L¤¨Q°Ó!6Õ7ð	 &ð
 ×Ñ Õ&ð 2ô  ¤¤T¬#¬c°<Ó*@Ó%AÓBˆÜ ¨d¯l©lÖ;‰LˆD�&ÙØ�Ø˜Š}Ø(¬3¨t«9Ñ4�Ø˜4¤# g°¡kÓ"2Ñ2��R�a�Ø—‘˜R˜D¤3 w°¡{°W¸q±[Ñ'@Ó#AÑAÕBØ˜3’Ø˜4 >´C¸³IÑ#=Ñ>��R�a‘à—‘˜R˜D N´S¸³YÑ$>Ñ?Õ@ð <ð Ðr   N)éP   )T)F),r?   r@   rA   rR   rS   rQ   rP   r:   rV   rN   rU   rk   rp   rs   rv   ry   r�   r„   r†   r�   r•   r£   Úclassmethodr¨   r­   r³   r¶   r¸   r»   rÀ   rŒ   rm   rÊ   r    r›   rž   rŸ   rœ   rÐ   râ   r™   rš   r�   rî   rC   r   r   r   r   ¹   s4  „ à€FØ€FØ€FØ€Fóò
òòò&ò*òòòò*ò(òòó"ò*ð6 ñ#ó ð#ð ñ5ó ð5ð ñ	.ó ð	.ð ñ	.ó ð	.ð ñó ðð ñó ðð ñó ðò%ò2"ò1ò1ò1ò1ò'ò"óò(ò&&òP	2óó>r   Ú__main__)rÖ   rí   r   )rÄ   rô   rÂ   )ÚNameÚAgeÚNickname)zMr
Xavier
Huoné    zXav')zMr
Baptiste
Clementr   ÚBaby)zMme
Louise
Bourgeaué   z
Lou
 
Loue)rÄ   r¾   rÃ   rŽ   rˆ   )rÖ   rí   rí   rí   rÖ   )Útextr¥   Úexpr}   Úauto)ÚabcdÚ67iŽ  éY   gyé&1 `@)Úefghijkg_)ËÇâP@g!°rh‘íä?gffffffV@g@Œµx¯…D)ÚlmnçÜ�ÁØ†â/r  gš™™™™YV@gVçž¯B=)ÚopqrstugZd;ßO�—?g/'Û%—EPg      W@l      ÆZx^+)*rB   Ú
__future__r   Ú__all__Ú
__author__Ú__license__Ú__version__Ú__credits__r*   r   r	   r   ÚImportErrorr   r+   r,   r   r   Ú	functoolsr!   Úversion_infora   r'   Úbytesr(   Úunicoder/   r4   r9   r   rE   r   r?   Útablers   rv   r•   Úprintr£   rk   rS   ry   rC   r   r   Ú<module>r     sÜ  ðñ6õp  àÐ(Ð
)€à4€
Ø€Ø€ð€ó6 Û ðÛò(ðÛò*õ à×Ñ�vÒØ€LØ�Jà€LØ€Jò!ò"ô	�Yô 	ô	�Yô 	÷
\ñ \ð~ ˆzÒÙ‹K€EØ	×ÑšÔ)Ø	×Ñš/Ô*Ø	‡N�NÒ/Ú4Ú8ÚAðCô Dñ 
ˆ%�*‰*‹,ÔÙ	„Gá‹K€EØ	‡N�N�9×#Ñ#Ô$Ø	×Ñò ô  ð
 
×ÑÒ2Ô3Ø	‡N�NÒ>Ú?ÚUÚHÚOð	Qô Rñ
 
ˆ%�*‰*‹,Õð1 øð_ ò ðÛó	-øàò Ø�
‰
×ÑÐ:Ô;Øðúò	-ðûð$ ò 	õð	ús:   žE ¦F ÅFÅ#E+Å*FÅ+"FÆFÆFÆF#Æ"F#