Ë
    7^(h.  ã                   óT   — d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	  G d„ d«      Z
y)	é    )ÚTuple)ÚS)ÚSymbol)ÚSympifyError)ÚFunctionTypec                   ó@   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zy
)Ú	TableForma»  
    Create a nice table representation of data.

    Examples
    ========

    >>> from sympy import TableForm
    >>> t = TableForm([[5, 7], [4, 2], [10, 3]])
    >>> print(t)
    5  7
    4  2
    10 3

    You can use the SymPy's printing system to produce tables in any
    format (ascii, latex, html, ...).

    >>> print(t.as_latex())
    \begin{tabular}{l l}
    $5$ & $7$ \\
    $4$ & $2$ \\
    $10$ & $3$ \\
    \end{tabular}

    c                 ó  — ddl m} t        ||«      r|j                  «       }t	        |«      }|j                  dd«      }d}|€d}d}t        |«      }t        d„ |D «       «      }t        |«      D ]d  \  }}	t	        |	«      |k7  r!|	j                  |g|t	        |	«      z
  z  «       t        |	«      D ]  \  }
}|€|s|}n	 t        |«      }||	|
<   Œ |	||<   Œf t        |D �cg c]
  }t        |Ž ‘Œ c}Ž }|j                  d	ddg«      }|d
k(  rt        d|dz   «      t        d|dz   «      g}n1|\  }}|d
k(  rt        d|dz   «      }|d
k(  rt        d|dz   «      }||g}d}|j                  dd«      }d„ } ||«      }||v r|g|z  }n4g }|D ]-  } ||«      }|j                  |«       |dvsŒ!t!        d|z  «      ‚ |d   rt	        |«      |dz   k(  r|d   }|dd }nd}t	        |«      |k7  rt!        d|›dt	        |«      ›�«      ‚|j                  ddg|z  «      }|j                  dd«      }|| _        || _        || _        || _        || _        || _        || _        || _        y# t        $ r t        t        |«      «      }Y �Œ½w xY wc c}w )aî  
        Creates a TableForm.

        Parameters:

            data ...
                            2D data to be put into the table; data can be
                            given as a Matrix

            headings ...
                            gives the labels for rows and columns:

                            Can be a single argument that applies to both
                            dimensions:

                                - None ... no labels
                                - "automatic" ... labels are 1, 2, 3, ...

                            Can be a list of labels for rows and columns:
                            The labels for each dimension can be given
                            as None, "automatic", or [l1, l2, ...] e.g.
                            ["automatic", None] will number the rows

                            [default: None]

            alignments ...
                            alignment of the columns with:

                                - "left" or "<"
                                - "center" or "^"
                                - "right" or ">"

                            When given as a single value, the value is used for
                            all columns. The row headings (if given) will be
                            right justified unless an explicit alignment is
                            given for it and all other columns.

                            [default: "left"]

            formats ...
                            a list of format strings or functions that accept
                            3 arguments (entry, row number, col number) and
                            return a string for the table entry. (If a function
                            returns None then the _print method will be used.)

            wipe_zeros ...
                            Do not show zeros in the table.

                            [default: True]

            pad ...
                            the string to use to indicate a missing value (e.g.
                            elements that are None or those that are missing
                            from the end of a row (i.e. any row that is shorter
                            than the rest is assumed to have missing values).
                            When None, nothing will be shown for values that
                            are missing from the end of a row; values that are
                            None, however, will be shown.

                            [default: None]

        Examples
        ========

        >>> from sympy import TableForm, Symbol
        >>> TableForm([[5, 7], [4, 2], [10, 3]])
        5  7
        4  2
        10 3
        >>> TableForm([list('.'*i) for i in range(1, 4)], headings='automatic')
          | 1 2 3
        ---------
        1 | .
        2 | . .
        3 | . . .
        >>> TableForm([[Symbol('.'*(j if not i%2 else 1)) for i in range(3)]
        ...            for j in range(4)], alignments='rcl')
            .
          . . .
         .. . ..
        ... . ...
        r   ©ÚMatrixÚpadNFú Tc              3   ó2   K  — | ]  }t        |«      –— Œ y ­w©N©Úlen)Ú.0Úlines     úV/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/printing/tableform.pyú	<genexpr>z%TableForm.__init__.<locals>.<genexpr>„   s   è ø€ Ò,˜t”�T—Ñ,ùó   ‚ÚheadingsÚ	automaticé   )ÚlÚrÚcÚ
alignmentsr   c                 ó²   — | j                  «       j                  «       } t        | «      dkD  rddddœj                  | | «      S ddddœj                  | | «      S )Nr   r   r   r   )ÚleftÚrightÚcenter)ú<ú>ú^)ÚstripÚlowerr   Úget)Úas    r   Ú
_std_alignz&TableForm.__init__.<locals>._std_align£   sS   € Ø—‘“	—‘Ó!ˆAÜ�1‹v˜ŠzØ #¨c¸SÑA×EÑEÀaÈÓKÐKà  s°Ñ5×9Ñ9¸!¸QÓ?Ð?ó    zalignment "%s" unrecognizedr   z%wrong number of alignments: expected z	 but got ÚformatsÚ
wipe_zeros)Úsympy.matrices.denser   Ú
isinstanceÚtolistr   r(   r   ÚmaxÚ	enumerateÚextendr   r   Ústrr   ÚrangeÚappendÚ
ValueErrorÚ_wÚ_hÚ_linesÚ	_headingsÚ_head_alignÚ_alignmentsÚ_column_formatsÚ_wipe_zeros)ÚselfÚdataÚkwargr   r9   r   Úok_Noner8   Úir   ÚjÚljÚdr:   r   r;   Úh1Úh2Úallowr   r*   Ú	std_alignr=   r)   r<   r>   r?   s                              r   Ú__init__zTableForm.__init__#   sì  € õf 	0ô �d˜FÔ#Ø—;‘;“=ˆDÜ�‹Yˆð �i‰i˜˜tÓ$ˆØˆØˆ;ØˆCØˆGÜ�S‹kˆÜÑ, tÔ,Ó,ˆÜ  “ò 	‰GˆAˆtÜ�4‹y˜BŠØ—‘˜S˜E 2¬¨D«	¡>Ñ2Ô3Ü" 4›ò 	‘��2Ø�:Ù"Ø ™ð-Ü˜r›U˜ð ��Q’ð	ð ˆD�ŠGð	ô ¨DÖ1 qœ šÒ1Ð2ˆà—9‘9˜Z¨$°¨Ó6ˆØ�{Ò"Ü˜q " q¡&Ó)¬5°°B¸±FÓ+;Ð<‰Ià‰FˆB�Ø�[Ò Ü˜1˜b 1™fÓ%�Ø�[Ò Ü˜1˜b 1™fÓ%�Ø˜R˜ˆIàˆØ—Y‘Y˜|¨SÓ1ˆ
ò	@ñ ˜zÓ*ˆ	Ø˜ÑØ$˜+ b™.‰KàˆKØò $�Ù& q›M�	Ø×"Ñ" 9Ô-Ø OÒ3Ü$Ð%BØ"ñ&#ó $ð $ð	$ð �QŠ<œC Ó,°°Q±Ò6Ø% a™.ˆKØ% a b˜/‰KàˆKÜˆ{Ó˜rÒ!Ýâ”S˜Ô%ð'ó(ð (ð  Ÿ)™) I°¨v°b©yÓ9ˆà—i‘i ¨dÓ3ˆàˆŒØˆŒØˆŒØ"ˆŒØ&ˆÔØ&ˆÔØ.ˆÔØ&ˆÕøôu (ò -Ü#¤C¨£G›_›ð-üò 2s   Â>I&Ã J
É&JÊJc                 ó"   — ddl m}  || d ¬«      S ©Nr   )Ússtr)Úorder©r4   rO   ©r@   rO   s     r   Ú__repr__zTableForm.__repr__Ë   ó   € ÝÙ�D Ô%Ð%r+   c                 ó"   — ddl m}  || d ¬«      S rN   rQ   rR   s     r   Ú__str__zTableForm.__str__Ï   rT   r+   c                 ó2   — ddl m}  || j                  «      S )a�  Returns the data of the table in Matrix form.

        Examples
        ========

        >>> from sympy import TableForm
        >>> t = TableForm([[5, 7], [4, 2], [10, 3]], headings='automatic')
        >>> t
          | 1  2
        --------
        1 | 5  7
        2 | 4  2
        3 | 10 3
        >>> t.as_matrix()
        Matrix([
        [ 5, 7],
        [ 4, 2],
        [10, 3]])
        r   r   )r.   r   r:   )r@   r   s     r   Ú	as_matrixzTableForm.as_matrixÓ   s   € õ( 	0Ù�d—k‘kÓ"Ð"r+   c                 ó   — t        | «      S r   ©r4   )r@   s    r   Úas_strzTableForm.as_strê   s   € ä�4‹yÐr+   c                 ó   — ddl m }  || «      S )Nr   ©Úlatexr]   )r@   r^   s     r   Úas_latexzTableForm.as_latexî   s   € Ý Ù�T‹{Ðr+   c           	      ó¼  — dg| j                   z  }g }| j                  D ]y  }g }t        | j                   «      D ]L  }t        ||   «      }| j                  r|dk(  rd}t        |«      }|||   kD  r|||<   |j                  |«       ŒN |j                  |«       Œ{ | j                  d   rR| j                  d   D �	cg c]  }	t        |	«      ‘Œ c}	| j                  d<   t        d„ | j                  d   D «       «      }
| j                  d   rog }t        | j                   «      D ]F  }t        | j                  d   |   «      }t        |«      }|||   kD  r|||<   |j                  |«       ŒH || j                  d<   g }d„ }t        | j                  |«      D ��cg c]  \  }} |||«      ‘Œ }}}| j                  d   r5|j                  d || j                  
«      «       |j                  dd«       dj                  |«      dz   }g }| j                  d   rf| j                  d   }| j                  d   rd	g|z   }|t        |«      z  }|j                  |«       |j                  d
t        |«      dz
  z  dz   «       t        |«      D ]®  \  }}t        |«      D ��cg c]-  \  }}| j                  |   dk7  r|n|j!                  ||   «      ‘Œ/ }}}| j                  d   r:| j                  d   |   }| j                  dk7  r|n|j!                  
«      }|g|z   }|j                  |t        |«      z  «       Œ° d	j                  |«      dd S c c}	w c c}}w c c}}w )zÛ
        Returns the string representation of 'self'.

        Examples
        ========

        >>> from sympy import TableForm
        >>> t = TableForm([[5, 7], [4, 2], [10, 3]])
        >>> s = t.as_str()

        r   Ú0r   c              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr   r   )r   Úxs     r   r   z&TableForm._sympystr.<locals>.<genexpr>  s   è ø€ Ò@¨œc !ŸfÑ@ùr   r   c                 ó2   — d| dk(  rdnd›t        |«      ›d�S )Nz%r   ú-Ú ÚsrZ   )ÚalignÚws     r   Ú_alignz#TableForm._sympystr.<locals>._align  s!   � à š‘¨"Ð,Ü�A•ðð r+   ú|ú
rf   re   r   Néÿÿÿÿ)r8   r:   r5   r4   r?   r   r6   r;   r1   Úzipr=   Úinsertr<   ÚjoinÚtupler2   r"   )r@   ÚpÚcolumn_widthsÚlinesr   Únew_linerD   rg   ri   rc   Ú_head_widthÚ
format_strrj   rh   rG   Ú
first_linerE   r   s                     r   Ú	_sympystrzTableForm._sympystrò   sS  € ð ˜˜dŸg™g™ˆØˆØ—K‘Kò 	#ˆDØˆHÜ˜4Ÿ7™7“^ò #�ä˜˜Q™“L�Ø×#Ò#¨¨cªØ�AÜ˜“F�Ø�} QÑ'Ò'Ø'(�M !Ñ$Ø—‘ Õ"ð#ð �L‰L˜Õ"ð	#ð �>‰>˜!ÒØ15·±ÀÑ1BÖ C¨A¤ Q¥Ò CˆD�N‰N˜1ÑÜÑ@¨d¯n©n¸QÑ.?Ô@Ó@ˆKà�>‰>˜!ÒØˆHÜ˜4Ÿ7™7“^ò #�ä˜Ÿ™ qÑ)¨!Ñ,Ó-�Ü˜“F�Ø�} QÑ'Ò'Ø'(�M !Ñ$Ø—‘ Õ"ð#ð !)ˆD�N‰N˜1Ñàˆ
ò	ô
 ˜$×*Ñ*¨MÓ:÷<©8¨5°!‘f˜U AÕ&ð <ˆ
ñ <à�>‰>˜!ÒØ×Ñ˜a¡¨×(8Ñ(8¸+Ó!FÔGØ×Ñ˜a Ô%Ø—X‘X˜jÓ)¨DÑ0ˆ
àˆØ�>‰>˜!ÒØ—‘˜qÑ!ˆAØ�~‰~˜aÒ Ø�D˜1‘H�Ø#¤e¨A£hÑ.ˆJØ�H‰H�ZÔ Ø�H‰H�SœC 
›O¨aÑ/Ñ0°4Ñ7Ô8Ü  Ó'ò 	,‰GˆAˆtä8AÀ$»÷IÙ04°°1ð ×&Ñ& qÑ)¨SÒ0‘Ø—‘˜-¨Ñ*Ó+ñ,ð IˆAñ Ià�~‰~˜aÒ Ø—N‘N 1Ñ% aÑ(�Ø×*Ñ*¨cÒ1‘QØ—X‘X˜kÓ*ð à�C˜!‘G�Ø�H‰H�Z¤%¨£(Ñ*Õ+ð	,ð �w‰w�q‹z˜#˜2ˆÐùòY !Dùó(<ùó Is   Â;MÆMÊ2Mc                 ó¬  — | j                   d   rUg }t        | j                  «      D ],  }|j                  t	        | j                   d   |   «      «       Œ. || j                   d<   g }| j                   d   r@| j                   d   D �cg c]  }t	        |«      ‘Œ c}| j                   d<   | j
                  g}|j                  | j                  «       ddj                  |«      z   dz   }| j                   d   rE| j                   d   }| j                   d   rdg|z   }dj                  |«      dz   d	z   }||z  }|d
z  }t        | j                  «      D ]ö  \  }}	g }t        |	«      D ]¢  \  }
}| j                  r|dv r|j                  d«       Œ(| j                  |
   }|rEt        |t        «      r ||||
«      }|€|j                  |«      }n||z  }|j                  |«       Œ~|j                  |«      }|j                  d|z  «       Œ¤ | j                   d   r| j                   d   |   g|z   }|dj                  |«      dz   d	z   z  }Œø |dz  }|S c c}w )z>
        Returns the string representation of 'self'.
        r   r   z\begin{tabular}{r   z}
rf   z & z \\rl   z\hline
)r   ra   z$%s$z\end{tabular})r;   r5   r8   r6   r4   r<   r3   r=   rp   r2   r:   r?   r>   r/   r   Ú_print)r@   Úprinterru   rD   r   rc   rg   rG   rx   r   rE   ÚfÚvs                r   Ú_latexzTableForm._latex=  sJ  € ð
 �>‰>˜!ÒØˆHÜ˜4Ÿ7™7“^ò ;�à—‘¤ D§N¡N°1Ñ$5°aÑ$8Ó 9Õ:ð;ð !)ˆD�N‰N˜1Ñàˆ
Ø�>‰>˜!ÒØ15·±ÀÑ1BÖ C¨A¤ Q¥Ò CˆD�N‰N˜1ÑØ×*Ñ*Ð+ˆJØ×Ñ˜$×*Ñ*Ô+à #§(¡(¨:Ó"6Ñ6¸Ñ>ˆà�>‰>˜!ÒØ—‘˜qÑ!ˆAØ�~‰~˜aÒ Ø�D˜1‘H�ØŸ™ A›¨Ñ/°$Ñ6ˆJØ�‰OˆAØÐ!Ñ!ˆAÜ  §¡Ó-ò 	/‰GˆAˆtØˆAÜ! $›ò )‘��1Ø×#Ò#¨¨h©Ø—H‘H˜S”MØØ×(Ñ(¨Ñ+�ÙÜ! !¤\Ô2Ù˜a  A›J˜Ø˜9Ø '§¡¨qÓ 1™Aà ™E˜Ø—H‘H˜Q•KàŸ™ qÓ)�AØ—H‘H˜V a™ZÕ(ð)ð  �~‰~˜aÒ Ø—^‘^ AÑ& qÑ)Ð*¨QÑ.�Ø�—‘˜A“ Ñ'¨$Ñ.Ñ.‰Að)	/ð* 	
ÐÑˆØˆùòG !Ds   ÂIN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rL   rS   rV   rX   r[   r_   ry   r   © r+   r   r	   r	   	   s3   „ ñò2f'òP&ò&ò#ò.òòIóV1r+   r	   N)Úsympy.core.containersr   Úsympy.core.singletonr   Úsympy.core.symbolr   Úsympy.core.sympifyr   Útypesr   r	   r„   r+   r   ú<module>rŠ      s    ðÝ 'Ý "Ý $Ý +å ÷eò er+   