§
    OŠtj:T  ã                   ó~   — d Z 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 ddlmZ d„ Zd	„ Zd
„ ZdZ	 	 	 	 	 	 	 dd„ZdS )z7Tools for setting up printing in interactive sessions. é    )ÚBytesIO)Úlatex)Úpreview)Údebug)Ú	Printable)Úimport_modulec                 ó8   ‡ ‡‡— ddl }ddlŠˆˆˆ fd„}||_        dS )z.Setup printing in Python interactive session. r   Nc                 óX   •— | �&d‰_         t           ‰| fi ‰¤Ž¦  «         | ‰_         dS dS )z’Python's pretty-printer display hook.

           This function was adapted from:

            https://www.python.org/dev/peps/pep-0217/

        N)Ú_Úprint)ÚargÚbuiltinsÚsettingsÚstringify_funcs    €€€úX/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/interactive/printing.pyÚ_displayhookz+_init_python_printing.<locals>._displayhook   sC   ø€ ð ˆ?ØˆHŒJÝ�.�. Ð1Ð1¨Ð1Ð1Ñ2Ô2Ð2ØˆHŒJˆJˆJð ˆ?ó    )Úsysr   Údisplayhook)r   r   r   r   r   s   ``  @r   Ú_init_python_printingr      sG   øøø€ à€J€J€JØ€O€O€Oðð ð ð ð ð ð ð #€C„O€O€Or   c                 óz  ‡‡‡‡‡‡‡
‡‡‡‡‡ ‡!‡"‡#‡$‡%‡&‡'— t          dd¬¦  «        Š	 ddlmŠ& n# t          $ r Y nw xY w‰€=| j                             ¦   «         }|dk    rdŠn|d	k    rd
ŠndŠt          d‰¦  «         |dk    rd‰z  Š$ndŠ$d}d}t          d‰
z  ¦  «        }d|||‰|fz  }|                     ¦   «         Š"d‰
z  }dd 	                    |¦  «        gŠ#t          d‰"¦  «         t          d‰#¦  «         |	pt          Š%ˆˆˆfd„}ˆ"ˆˆ$ˆfd„Š ˆ#ˆˆ$ˆfd„Š!ˆˆ&ˆ
fd„ŠdŠ'ˆˆˆ'fd„Šˆˆˆ ˆ%ˆˆfd„}ˆˆ!ˆ%ˆˆfd „}ˆˆˆ%ˆfd!„}ˆˆ%ˆˆfd"„}t          t          t          t          t          t           t"          g}| j        j        d#         }|t(          gz   D ]}|                     ||¦  «         Œ| j        j        d$         }|d%v r7t          d&¦  «         |D ]}|                     ||¦  «         Œ|t(          _        nMt          d'¦  «         |D ]%}||j        v r|j                             |¦  «         Œ&t(          j        t(          _        | j        j        d(         }|d)v r7t          d*¦  «         |D ]}|                     ||¦  «         Œ|t(          _        nŠ|d+k    r7t          d,¦  «         |D ]}|                     ||¦  «         Œ|t(          _        nMt          d-¦  «         |D ]%}||j        v r|j                             |¦  «         Œ&t(          j        t(          _        | j        j        d.         }|d/v r8t          d0¦  «         |D ]}|                     ||¦  «         Œ|t(          _        dS t          d1¦  «         |D ]%}||j        v r|j                             |¦  «         Œ&t(          j        t(          _        dS )2z/Setup printing in IPython interactive session. ÚIPythonz1.0)Úmin_module_versionr   )Úlatex_to_pngNÚlightbgÚBlackÚlinuxÚWhiteÚGrayz*init_printing: Automatic foreground color:Úsvgz
\special{color %s}Ú Útightz0cm,0cmé–   z-T %s -D %d -bg %s -fg %s -O %sg«ªªªªª @z
--no-fontsz
--scale={}zinit_printing: DVIOPTIONS:zinit_printing: DVIOPTIONS_SVG:c                 óÂ   •—  ‰| ¦  «        r |                       ‰| ¦  «        ¦  «         dS |                      ‰j        j                             | ¦  «        ¦  «         dS )z*caller for pretty, for use in IPython 0.11N)ÚtextÚlibÚpretty)r   ÚpÚcycler   Ú
_can_printr   s      €€€r   Ú_print_plainz,_init_ipython_printing.<locals>._print_plainP   s`   ø€ àˆ:�c‰?Œ?ð 	3Ø�FŠF�>�> #Ñ&Ô&Ñ'Ô'Ð'Ð'Ð'à�FŠF�7”;Ô%×,Ò,¨SÑ1Ô1Ñ2Ô2Ð2Ð2Ð2r   c           
      óÜ   •— t          ¦   «         }	 t          | dd‰|‰‰‰¬¦  «         n1# t          $ r$}t          ddt	          |¦  «        ¦  «         ‚ d }~ww xY w|                     ¦   «         S )NÚpngr   ©ÚoutputÚviewerÚeulerÚoutputbufferÚextra_preambleÚ
dvioptionsÚfontsizezpng printing:ú"_preview_wrapper exception raised:)r   r   Ú	Exceptionr   ÚreprÚgetvalue)ÚoÚ
exprbufferÚer4   r1   r3   r5   s      €€€€r   Ú_preview_wrapperz0_init_ipython_printing.<locals>._preview_wrapperW   s—   ø€ Ý‘Y”Yˆ
ð	Ý�A˜e¨I¸UØ!+¸NØ)°Hð>ñ >ô >ð >ð >øõ ð 	ð 	ð 	å�/Ð#GÝ�q‘'”'ñô ð àøøøøð		øøøð
 ×"Ò"Ñ$Ô$Ð$ó   ‘) ©
A³AÁAc           
      ó  •— t          ¦   «         }	 t          | dd‰|‰‰‰¬¦  «         n1# t          $ r$}t          ddt	          |¦  «        ¦  «         ‚ d }~ww xY w|                     ¦   «                              d¦  «        S )Nr    r   r.   zsvg printing:r6   zutf-8)r   r   r7   r   r8   r9   Údecode)r:   r;   r<   Údvioptions_svgr1   r3   r5   s      €€€€r   Ú_svg_wrapperz,_init_ipython_printing.<locals>._svg_wrapperd   sª   ø€ Ý‘Y”Yˆ
ð	Ý�A˜e¨I¸UØ!+¸NØ-¸ðBñ Bô Bð Bð Bøõ ð 	ð 	ð 	å�/Ð#GÝ�q‘'”'ñô ð àøøøøð		øøøð
 ×"Ò"Ñ$Ô$×+Ò+¨GÑ4Ô4Ð4r>   c                 óÄ   •— 	 	  ‰| ‰‰¬¦  «        S # t           $ r  ‰| ¦  «        cY S w xY w# t          $ r(}t          dt          |¦  «        ¦  «         Y d }~d S d }~ww xY w)N)ÚcolorÚscalezmatplotlib exception caught:)Ú	TypeErrorÚ
ValueErrorr   r8   )r:   r<   Ú	forecolorr   rE   s     €€€r   Ú_matplotlib_wrapperz3_init_ipython_printing.<locals>._matplotlib_wrapperq   s–   ø€ ð	ð'Ø#�| A¨Y¸eÐDÑDÔDÐDøÝð 'ð 'ð 'Ø#�| A‘”Ð&Ð&Ð&ð'øøøøåð 	ð 	ð 	ÝÐ0µ$°q±'´'Ñ:Ô:Ð:Ø�4�4�4�4�4øøøøð	øøøs$   „ ’*§- ©*ª- ­
A·AÁA)Ú_latexÚ	_sympystrÚ_prettyÚ
_sympyreprc                 ót  •‡ — 	 t           t          t          t          f}t	          ‰ |¦  «        r]t          ‰ ¦  «        j        d„ |D ¦   «         vs t          ‰ ¦  «        j        d„ |D ¦   «         vrdS t          ˆfd„‰ D ¦   «         ¦  «        S t	          ‰ t          ¦  «        rt          ˆˆ fd„‰ D ¦   «         ¦  «        S t	          ‰ t          ¦  «        rdS t	          ‰ t          ¦  «        rdS t          ˆ fd„‰D ¦   «         ¦  «        rdS t	          ‰ t          t          f¦  «        r‰rdS dS # t          $ r Y dS w xY w)zÃReturn True if type o can be printed with one of the SymPy printers.

        If o is a container type, this is True if and only if every element of
        o can be printed in this way.
        c              3   ó$   K  — | ]}|j         V — Œd S ©N)Ú__str__©Ú.0Úis     r   ú	<genexpr>z=_init_ipython_printing.<locals>._can_print.<locals>.<genexpr>’   s$   è è € Ð+MÐ+M¸!¨A¬IÐ+MÐ+MÐ+MÐ+MÐ+MÐ+Mr   c              3   ó$   K  — | ]}|j         V — Œd S rP   )Ú__repr__rR   s     r   rU   z=_init_ipython_printing.<locals>._can_print.<locals>.<genexpr>“   s$   è è € Ð,OÐ,O¸A¨Q¬ZÐ,OÐ,OÐ,OÐ,OÐ,OÐ,Or   Fc              3   ó.   •K  — | ]} ‰|¦  «        V — Œd S rP   © )rS   rT   r*   s     €r   rU   z=_init_ipython_printing.<locals>._can_print.<locals>.<genexpr>•   s+   øè è € Ð4Ð4¨Q˜:˜: a™=œ=Ð4Ð4Ð4Ð4Ð4Ð4r   c              3   óP   •K  — | ] } ‰|¦  «        o ‰‰|         ¦  «        V — Œ!d S rP   rY   )rS   rT   r*   r:   s     €€r   rU   z=_init_ipython_printing.<locals>._can_print.<locals>.<genexpr>—   s>   øè è € ÐIÐIÀ!˜:˜: a™=œ=Ð=¨Z¨Z¸¸!¼Ñ-=Ô-=ÐIÐIÐIÐIÐIÐIr   Tc              3   ó8   •K  — | ]}t          ‰|¦  «        V — Œd S rP   )Úhasattr)rS   Úhookr:   s     €r   rU   z=_init_ipython_printing.<locals>._can_print.<locals>.<genexpr>�   s-   øè è € ÐAÐA¨$•W˜Q Ñ%Ô%ÐAÐAÐAÐAÐAÐAr   )ÚlistÚtupleÚsetÚ	frozensetÚ
isinstanceÚtyperQ   rW   ÚallÚdictÚboolr   ÚanyÚfloatÚintÚRuntimeError)r:   Úbuiltin_typesr*   Úprint_builtinÚprinting_hookss   ` €€€r   r*   z*_init_ipython_printing.<locals>._can_printƒ   ss  øø€ ð	õ "¥5­#­yÐ9ˆMÝ˜!˜]Ñ+Ô+ð õ ˜‘G”G”OÐ+MÐ+M¸}Ð+MÑ+MÔ+MÐMÐMÝ˜‘G”GÔ$Ð,OÐ,OÀÐ,OÑ,OÔ,OÐOÐOØ ˜5ÝÐ4Ð4Ð4Ð4°!Ð4Ñ4Ô4Ñ4Ô4Ð4Ý˜A�tÑ$Ô$ð ÝÐIÐIÐIÐIÐIÀqÐIÑIÔIÑIÔIÐIÝ˜A�tÑ$Ô$ð 	Ø�uÝ˜A�yÑ)Ô)ð à�tÝÐAÐAÐAÐA°.ÐAÑAÔAÑAÔAð à�tÝ˜A¥¥s˜|Ñ,Ô,ð °ð Ø�tØ�5øÝð 	ð 	ð 	Ø�5�5ð	øøøs6   „A*D) Á0D) Â0D) Â<D) ÃD) Ã*D) ÄD) Ä)
D7Ä6D7c                 ó  •—  ‰| ¦  «        rs ‰| fd‰i‰¤Ž}‰dk    rd|z  }	  ‰|¦  «        S # t           $ rD}t          dt          |¦  «        d¦  «         ‰dk    r ‰| fddi‰¤Ž} ‰|¦  «        cY d}~S d}~ww xY wdS )zˆ
        A function that returns a png rendered by an external latex
        distribution, falling back to matplotlib rendering
        ÚmodeÚplainú$\displaystyle %s$úpreview failed with:z# Falling back to matplotlib backendÚinlineN©rj   r   r8   )	r:   Úsr<   r*   rI   r=   r   Ú
latex_moder   s	      €€€€€€r   Ú_print_latex_pngz0_init_ipython_printing.<locals>._print_latex_png©   sì   ø€ ð
 ˆ:�a‰=Œ=ð 	.Ø��aÐ5Ð5˜jÐ5¨HÐ5Ð5ˆAØ˜WÒ$Ð$Ø)¨AÑ-�ð.Ø'Ð'¨Ñ*Ô*Ð*øÝð .ð .ð .ÝÐ,­d°1©g¬gØ;ñ=ô =ð =à Ò)Ð)Ø˜˜aÐ;Ð; hÐ;°(Ð;Ð;�AØ*Ð*¨1Ñ-Ô-Ð-Ð-Ð-Ð-Ð-Ð-øøøøð.øøøð	.ð 	.s   ¤
/ ¯
A=¹9A8Á2A=Á8A=c                 óÎ   •—  ‰| ¦  «        rX ‰| fd‰i‰¤Ž}‰dk    rd|z  }	  ‰|¦  «        S # t           $ r)}t          dt          |¦  «        d¦  «         Y d}~dS d}~ww xY wdS )zz
        A function that returns a svg rendered by an external latex
        distribution, no fallback available.
        ro   rp   rq   rr   z No fallback available.Nrt   )r:   ru   r<   r*   rB   r   rv   r   s      €€€€€r   Ú_print_latex_svgz0_init_ipython_printing.<locals>._print_latex_svg»   sÀ   ø€ ð
 ˆ:�a‰=Œ=ð 	1Ø��aÐ5Ð5˜jÐ5¨HÐ5Ð5ˆAØ˜WÒ$Ð$Ø)¨AÑ-�ð1Ø#�| A‘”Ð&øÝð 1ð 1ð 1ÝÐ,­d°1©g¬gØ/ñ1ô 1ð 1ð 1ð 1ð 1ð 1ð 1ð 1øøøøð1øøøð	1ð 	1s   ¤
/ ¯
A"¹AÁA"c                 óJ   •—  ‰| ¦  «        r ‰| fddi‰¤Ž} ‰|¦  «        S dS )zD
        A function that returns a png rendered by mathtext
        ro   rs   NrY   )r:   ru   r*   rI   r   r   s     €€€€r   Ú_print_latex_matplotlibz7_init_ipython_printing.<locals>._print_latex_matplotlibÊ   sL   ø€ ð ˆ:�a‰=Œ=ð 	*Ø��aÐ3Ð3˜hÐ3¨(Ð3Ð3ˆAØ&Ð& qÑ)Ô)Ð)ð	*ð 	*r   c                 óN   •—  ‰| ¦  «        r ‰| fd‰i‰¤Ž}‰dk    rd|z  S |S dS )zW
        A function to generate the latex representation of SymPy expressions.
        ro   rp   rq   NrY   )r:   ru   r*   r   rv   r   s     €€€€r   Ú_print_latex_textz1_init_ipython_printing.<locals>._print_latex_textÒ   sV   ø€ ð ˆ:�a‰=Œ=ð 	Ø��aÐ5Ð5˜jÐ5¨HÐ5Ð5ˆAØ˜WÒ$Ð$Ø,¨qÑ0Ð0ØˆHð		ð 	r   z
text/plainzimage/svg+xml)r    z"init_printing: using svg formatterz*init_printing: not using any svg formatterz	image/png)Tr-   z"init_printing: using png formatterÚ
matplotlibz)init_printing: using matplotlib formatterz*init_printing: not using any png formatterz
text/latex)TÚmathjaxz&init_printing: using mathjax formatterz-init_printing: not using text/latex formatter)r   ÚIPython.lib.latextoolsr   ÚImportErrorÚcolorsÚlowerr   ÚroundÚsplitÚformatÚdefault_latexrh   r_   r^   r`   ra   re   ri   Údisplay_formatterÚ
formattersr   Úfor_typeÚ
_repr_svg_Útype_printersÚpopÚ_repr_disabledÚ
_repr_png_Ú_repr_latex_)(Úipr   Ú	use_latexr1   rH   Ú	backcolorr5   rv   rl   Úlatex_printerrE   r   rD   Ú	imagesizeÚoffsetÚ
resolutionÚdviÚ	svg_scaler+   rw   ry   r{   r}   Úprintable_typesÚplaintext_formatterÚclsÚsvg_formatterÚpng_formatterÚlatex_formatterr   r*   rI   r=   rB   r4   rA   r3   r   r   rm   s(    ` `` ``` ``                 @@@@@@@@@@@r   Ú_init_ipython_printingr    !   s“  øøøøøøøøøøøøøøøøøøø€ õ ˜I¸%Ð@Ñ@Ô@€GðØ7Ð7Ð7Ð7Ð7Ð7Ð7øÝð ð ð Øˆðøøøð ÐØ”	—’Ñ!Ô!ˆØ�IÒÐØˆIˆIØ�gÒÐØˆIˆIð ˆIÝÐ:¸IÑFÔFÐFà�EÒÐØ0°9Ñ<ˆˆàˆà€IØ€FÝ�s˜5‘yÑ!Ô!€JØ
,Ø�:˜y¨)°Vð0=ñ =€Cà—’‘”€Jà�u‘€IØ" L×$7Ò$7¸	Ñ$BÔ$BÐC€Nå	Ð
&¨
Ñ3Ô3Ð3Ý	Ð
*¨NÑ;Ô;Ð;àÐ*�]€Eð3ð 3ð 3ð 3ð 3ð 3ð 3ð%ð %ð %ð %ð %ð %ð %ð %ð5ð 5ð 5ð 5ð 5ð 5ð 5ð 5ðð ð ð ð ð ð ð F€Nð!ð !ð !ð !ð !ð !ð !ðL.ð .ð .ð .ð .ð .ð .ð .ð .ð .ð$1ð 1ð 1ð 1ð 1ð 1ð 1ð 1ð 1ð*ð *ð *ð *ð *ð *ð *ð *ðð ð ð ð ð ð ð õ �e¥T­3µ	½4ÅÐE€OàÔ.Ô9¸,ÔGÐð
 ¥) Ñ,ð 8ð 8ˆØ×$Ò$ S¨,Ñ7Ô7Ð7Ð7àÔ(Ô3°OÔD€MØ�IÐÐÝÐ2Ñ3Ô3Ð3Ø"ð 	:ð 	:ˆCØ×"Ò" 3Ð(8Ñ9Ô9Ð9Ð9Ø/�	ÔÐåÐ:Ñ;Ô;Ð;Ø"ð 	5ð 	5ˆCð �mÔ1Ð1Ð1ØÔ+×/Ò/°Ñ4Ô4Ð4øÝ(Ô7�	ÔàÔ(Ô3°KÔ@€MØ�MÐ!Ð!ÝÐ2Ñ3Ô3Ð3Ø"ð 	:ð 	:ˆCØ×"Ò" 3Ð(8Ñ9Ô9Ð9Ð9Ø/�	ÔÐØ	�lÒ	"Ð	"ÝÐ9Ñ:Ô:Ð:Ø"ð 	Að 	AˆCØ×"Ò" 3Ð(?Ñ@Ô@Ð@Ð@Ø6�	ÔÐåÐ:Ñ;Ô;Ð;Ø"ð 	5ð 	5ˆCð �mÔ1Ð1Ð1ØÔ+×/Ò/°Ñ4Ô4Ð4øÝ(Ô7�	ÔàÔ*Ô5°lÔC€OØÐ%Ð%Ð%ÝÐ6Ñ7Ô7Ð7Ø"ð 	=ð 	=ˆCØ×$Ò$ SÐ*;Ñ<Ô<Ð<Ð<Ø!2�	ÔÐÐåÐ=Ñ>Ô>Ð>Ø"ð 	7ð 	7ˆCð �oÔ3Ð3Ð3ØÔ-×1Ò1°#Ñ6Ô6Ð6øÝ!*Ô!9�	ÔÐÐs   ¦- ­
:¹:c                 óž   — ddl m} d|vrdS 	 ddlm} n*# t          $ r 	 ddlm} n# t          $ r Y Y dS w xY wY nw xY wt          | |¦  «        S )z%Is a shell instance an IPython shell?r   )Úmodulesr   F)ÚInteractiveShell)r   r¢   ÚIPython.core.interactiveshellr£   r�   ÚIPython.iplibrb   )Úshellr¢   r£   s      r   Ú_is_ipythonr§     s¶   € ð ÐÐÐÐÐØ˜ÐÐØˆuð	ØBÐBÐBÐBÐBÐBÐBøÝð ð ð ð	Ø6Ð6Ð6Ð6Ð6Ð6Ð6øÝð 	ð 	ð 	ð �5�5�5ð	øøøð 7Ð6ðøøøõ �eÐ-Ñ.Ô.Ð.s$   Ž •
< '¦<§
6±<µ6¶<»<FTNÚTransparentÚ10ptrp   ç      ð?c                 óÄ  ‡‡‡‡‡— ddl }ddlm} | r|�|}nddlm} n|�|}nddlm} d}|€$	 t          ¦   «         }|du}n# t          $ r Y nw xY w|r|st          |¦  «        }|rt| rr	 ddl	m
} ddlm} t          |||f¦  «        sBd	d
                     |j        ¦  «        vr&‰€t!          d¦  «         dŠ|€t!          d¦  «         d}n# t"          $ r Y nw xY wt$          s|s|                     ‰‰‰‰¬¦  «         n|Š| r
ˆˆˆˆˆfd„}nˆˆfd„}|r@|                     dd¦  «        }|rt!          d¦  «         t+          |||||	|
|||||fi |¤Ž dS t-          |fi |¤Ž dS )a,  
    Initializes pretty-printer depending on the environment.

    Parameters
    ==========

    pretty_print : bool, default=True
        If ``True``, use :func:`~.pretty_print` to stringify or the provided pretty
        printer; if ``False``, use :func:`~.sstrrepr` to stringify or the provided string
        printer.
    order : string or None, default='lex'
        There are a few different settings for this parameter:
        ``'lex'`` (default), which is lexographic order;
        ``'grlex'``, which is graded lexographic order;
        ``'grevlex'``, which is reversed graded lexographic order;
        ``'old'``, which is used for compatibility reasons and for long expressions;
        ``None``, which sets it to lex.
    use_unicode : bool or None, default=None
        If ``True``, use unicode characters;
        if ``False``, do not use unicode characters;
        if ``None``, make a guess based on the environment.
    use_latex : string, bool, or None, default=None
        If ``True``, use default LaTeX rendering in GUI interfaces (png and
        mathjax);
        if ``False``, do not use LaTeX rendering;
        if ``None``, make a guess based on the environment;
        if ``'png'``, enable LaTeX rendering with an external LaTeX compiler,
        falling back to matplotlib if external compilation fails;
        if ``'matplotlib'``, enable LaTeX rendering with matplotlib;
        if ``'mathjax'``, enable LaTeX text generation, for example MathJax
        rendering in IPython notebook or text rendering in LaTeX documents;
        if ``'svg'``, enable LaTeX rendering with an external latex compiler,
        no fallback
    wrap_line : bool
        If True, lines will wrap at the end; if False, they will not wrap
        but continue as one line. This is only relevant if ``pretty_print`` is
        True.
    num_columns : int or None, default=None
        If ``int``, number of columns before wrapping is set to num_columns; if
        ``None``, number of columns before wrapping is set to terminal width.
        This is only relevant if ``pretty_print`` is ``True``.
    no_global : bool, default=False
        If ``True``, the settings become system wide;
        if ``False``, use just for this console/session.
    ip : An interactive console
        This can either be an instance of IPython,
        or a class that derives from code.InteractiveConsole.
    euler : bool, optional, default=False
        Loads the euler package in the LaTeX preamble for handwritten style
        fonts (https://www.ctan.org/pkg/euler).
    forecolor : string or None, optional, default=None
        DVI setting for foreground color. ``None`` means that either ``'Black'``,
        ``'White'``, or ``'Gray'`` will be selected based on a guess of the IPython
        terminal color setting. See notes.
    backcolor : string, optional, default='Transparent'
        DVI setting for background color. See notes.
    fontsize : string or int, optional, default='10pt'
        A font size to pass to the LaTeX documentclass function in the
        preamble. Note that the options are limited by the documentclass.
        Consider using scale instead.
    latex_mode : string, optional, default='plain'
        The mode used in the LaTeX printer. Can be one of:
        ``{'inline'|'plain'|'equation'|'equation*'}``.
    print_builtin : boolean, optional, default=True
        If ``True`` then floats and integers will be printed. If ``False`` the
        printer will only print SymPy types.
    str_printer : function, optional, default=None
        A custom string printer function. This should mimic
        :func:`~.sstrrepr`.
    pretty_printer : function, optional, default=None
        A custom pretty printer. This should mimic :func:`~.pretty`.
    latex_printer : function, optional, default=None
        A custom LaTeX printer. This should mimic :func:`~.latex`.
    scale : float, optional, default=1.0
        Scale the LaTeX output when using the ``'png'`` or ``'svg'`` backends.
        Useful for high dpi screens.
    settings :
        Any additional settings for the ``latex`` and ``pretty`` commands can
        be used to fine-tune the output.

    Examples
    ========

    >>> from sympy.interactive import init_printing
    >>> from sympy import Symbol, sqrt
    >>> from sympy.abc import x, y
    >>> sqrt(5)
    sqrt(5)
    >>> init_printing(pretty_print=True) # doctest: +SKIP
    >>> sqrt(5) # doctest: +SKIP
      ___
    \/ 5
    >>> theta = Symbol('theta') # doctest: +SKIP
    >>> init_printing(use_unicode=True) # doctest: +SKIP
    >>> theta # doctest: +SKIP
    \u03b8
    >>> init_printing(use_unicode=False) # doctest: +SKIP
    >>> theta # doctest: +SKIP
    theta
    >>> init_printing(order='lex') # doctest: +SKIP
    >>> str(y + x + y**2 + x**2) # doctest: +SKIP
    x**2 + x + y**2 + y
    >>> init_printing(order='grlex') # doctest: +SKIP
    >>> str(y + x + y**2 + x**2) # doctest: +SKIP
    x**2 + x + y**2 + y
    >>> init_printing(order='grevlex') # doctest: +SKIP
    >>> str(y * x**2 + x * y**2) # doctest: +SKIP
    x**2*y + x*y**2
    >>> init_printing(order='old') # doctest: +SKIP
    >>> str(x**2 + y**2 + x + y) # doctest: +SKIP
    x**2 + x + y**2 + y
    >>> init_printing(num_columns=10) # doctest: +SKIP
    >>> x**2 + x + y**2 + y # doctest: +SKIP
    x + y +
    x**2 + y**2

    Notes
    =====

    The foreground and background colors can be selected when using ``'png'`` or
    ``'svg'`` LaTeX rendering. Note that before the ``init_printing`` command is
    executed, the LaTeX rendering is handled by the IPython console and not SymPy.

    The colors can be selected among the 68 standard colors known to ``dvips``,
    for a list see [1]_. In addition, the background color can be
    set to  ``'Transparent'`` (which is the default value).

    When using the ``'Auto'`` foreground color, the guess is based on the
    ``colors`` variable in the IPython console, see [2]_. Hence, if
    that variable is set correctly in your IPython console, there is a high
    chance that the output will be readable, although manual settings may be
    needed.


    References
    ==========

    .. [1] https://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips

    .. [2] https://ipython.readthedocs.io/en/stable/config/details.html#terminal-colors

    See Also
    ========

    sympy.printing.latex
    sympy.printing.pretty

    r   N)ÚPrinter)r'   )ÚsstrreprF)ÚTerminalInteractiveShell)ÚInteractiveConsolezipython-consoler!   z*init_printing: Setting use_unicode to TrueTz(init_printing: Setting use_latex to True©ÚorderÚuse_unicodeÚ	wrap_lineÚnum_columnsc                 ó    •—  ‰| f‰‰‰‰dœ|¤ŽS )Nr°   rY   )Úexprr   Ú_stringify_funcr´   r±   r²   r³   s     €€€€€r   ú<lambda>zinit_printing.<locals>.<lambda>ÿ  s8   ø€ Ø,˜_¨Tð 9¸Ø9DØ7@Ø9Dð9ð 9ð 08ð	9ð 9ð r   c                 ó   •—  ‰| fd‰i|¤ŽS )Nr±   rY   )r¶   r   r·   r±   s     €€r   r¸   zinit_printing.<locals>.<lambda>  s+   ø€ ¨¨Øð*3ð *3Ø %ð*3Ø)1ð*3ð *3€ r   ro   zMinit_printing: Mode is not able to be set due to internalsof IPython printing)r   Úsympy.printing.printerr¬   Úsympy.printingr'   r­   Úget_ipythonÚ	NameErrorr§   Ú!IPython.terminal.interactiveshellr®   Úcoder¯   rb   ÚjoinÚargvr   r�   Ú	NO_GLOBALÚset_global_settingsr�   r    r   )Úpretty_printr±   r²   r’   r³   r´   Ú	no_globalr‘   r1   rH   r“   r5   rv   rl   Ústr_printerÚpretty_printerr”   rE   r   r   r¬   r   Ú
in_ipythonr®   r¯   Úmode_in_settingsr·   s    `` ``                    @r   Úinit_printingrÊ   1  sÎ  øøøøø€ ðv €J€J€JØ.Ð.Ð.Ð.Ð.Ð.àð 	BØÐ%Ø+ˆNˆNà?Ð?Ð?Ð?Ð?Ð?Ð?àÐ"Ø(ˆNˆNàAÐAÐAÐAÐAÐAð €JØ	€zð	*Ý‘”ˆBð  D˜.ˆJˆJøõ ð 	ð 	ð 	ØˆDð	øøøð
 
ð %�*ð %Ý  ‘_”_ˆ
àð %�lð %ð	%ØRÐRÐRÐRÐRÐRØ/Ð/Ð/Ð/Ð/Ð/õ
 ˜bÐ#5Ð7OÐ"PÑQÔQð %Ø)°·²¸¼Ñ1BÔ1BÐBÐBØÐ&ÝÐFÑGÔGÐGØ"&�KØÐ$ÝÐDÑEÔEÐEØ $�Iøøõ ð 	ð 	ð 	ØˆDð	øøøõ ð 3˜Yð 3Ø×#Ò#¨%¸[Ø.7À[ð 	$ñ 	Rô 	Rð 	Rð 	Rð )ˆàð 
	3ð9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ˆNˆNð3ð 3ð 3ð 3ð 3ð ð ð 
:Ø#Ÿ<š<¨°Ñ5Ô5ÐØð 	)Ýð (ñ )ô )ð )å˜r >°9¸eØ(¨)°X¸zØ,¨m¸Uð	+ð 	+ð "*ð	+ð 	+ð 	+ð 	+ð 	+õ
 	˜nÐ9Ð9°Ð9Ð9Ð9Ð9Ð9s#   ®A Á
AÁAÁ)C
 Ã

CÃC)TNNNNNFNFNr¨   r©   rp   TNNNrª   )Ú__doc__Úior   Úsympy.printing.latexr   r‡   Úsympy.printing.previewr   Úsympy.utilities.miscr   Úsympy.printing.defaultsr   Úsympy.externalr   r   r    r§   rÂ   rÊ   rY   r   r   ú<module>rÒ      sè   ðØ =Ð =à Ð Ð Ð Ð Ð à 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø *Ð *Ð *Ð *Ð *Ð *Ø &Ð &Ð &Ð &Ð &Ð &Ø -Ð -Ð -Ð -Ð -Ð -Ø (Ð (Ð (Ð (Ð (Ð (ð#ð #ð #ð*y:ð y:ð y:ðv/ð /ð /ð& €	à=AØ>BØCGØ4:Ø48Ø37Ø,/ðc:ð c:ð c:ð c:ð c:ð c:r   