§
    ]²Åj¬X  ã                   ó~   — 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. é    )Úversion_tuple)ÚBytesIO)Úlatex)Úpreview)Údebug)Ú	Printablec                 ó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    €€€úKC:\Projects\Historical\venv\Lib\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                 óæ  ‡‡‡‡‡‡‡
‡‡‡‡ ‡!‡"‡#‡$‡%‡&‡'‡(— 	 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„}ˆfd „}ddl
Št          ‰j        ¦  «        t          d!¦  «        k    �rpt          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          d/¦  «         |D ]}|                     ||¦  «         Œ|t,          _        dS t          d0¦  «         |D ]%}||j        v r|j                             |¦  «         Œ&t,          j        t,          _        dS |                      d1|¦  «         dS )2z/Setup printing in IPython interactive session. r   )Ú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ÚcycleÚIPythonÚ
_can_printr   s      €€€r   Ú_print_plainz,_init_ipython_printing.<locals>._print_plainO   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Úer3   r0   r2   r4   s      €€€€r   Ú_preview_wrapperz0_init_ipython_printing.<locals>._preview_wrapperV   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:r5   zutf-8)r   r   r6   r   r7   r8   Údecode)r9   r:   r;   Údvioptions_svgr0   r2   r4   s      €€€€r   Ú_svg_wrapperz,_init_ipython_printing.<locals>._svg_wrapperc   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   r7   )r9   r;   Ú	forecolorr   rD   s     €€€r   Ú_matplotlib_wrapperz3_init_ipython_printing.<locals>._matplotlib_wrapperp   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 rO   )Ú__repr__rQ   s     r   rT   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 rO   © )rR   rS   r)   s     €r   rT   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 rO   rX   )rR   rS   r)   r9   s     €€r   rT   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 rO   )Úhasattr)rR   Úhookr9   s     €r   rT   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ÚtyperP   rV   ÚallÚdictÚboolr   ÚanyÚfloatÚintÚRuntimeError)r9   Ú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©ri   r   r7   )	r9   Úsr;   r)   rH   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.
        rn   ro   rp   rq   z No fallback available.Nrs   )r9   rt   r;   r)   rA   r   ru   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
        rn   rr   NrX   )r9   rt   r)   rH   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.
        rn   ro   rp   NrX   )r9   rt   r)   r   ru   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   c                 ó´   •— | j         j        r. ‰|¦  «        }d|v rt          ¦   «          t          |¦  «         dS t          t          |¦  «        ¦  «         dS )zžIPython's pretty-printer display hook, for use in IPython 0.10

           This function was adapted from:

            ipython/IPython/hooks.py:155

        ú
N)ÚrcÚpprintr   r7   )Úselfr   Úoutr   s      €r   Ú_result_displayz/_init_ipython_printing.<locals>._result_displayÛ   s[   ø€ ð Œ7Œ>ð 	Ø �. Ñ%Ô%ˆCà�sˆ{ˆ{Ý‘”�å�#‰JŒJˆJˆJˆJå•$�s‘)”)ÑÔÐÐÐr   z0.11z
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Úresult_display)ÚIPython.lib.latextoolsr   ÚImportErrorÚcolorsÚlowerr   ÚroundÚsplitÚformatÚdefault_latexr(   r   Ú__version__rg   r^   r]   r_   r`   rd   rh   Údisplay_formatterÚ
formattersr   Úfor_typeÚ
_repr_svg_Útype_printersÚpopÚ_repr_disabledÚ
_repr_png_Ú_repr_latex_Úset_hook))Úipr   Ú	use_latexr0   rG   Ú	backcolorr4   ru   rk   Úlatex_printerrD   r   rC   Ú	imagesizeÚoffsetÚ
resolutionÚdviÚ	svg_scaler*   rv   rx   rz   r|   rƒ   Úprintable_typesÚplaintext_formatterÚclsÚsvg_formatterÚpng_formatterÚlatex_formatterr(   r)   rH   r<   rA   r3   r@   r2   r   r   rl   s)    ` `` ``` ``                  @@@@@@@@@@@r   Ú_init_ipython_printingr©   !   sà  øøøøøøøøøøøøøøøøøøø€ ðØ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ð*ð *ð *ð *ð *ð *ð *ð *ðð ð ð ð ð ð ð ðð ð ð ð ð$ €N€N€NÝ�WÔ(Ñ)Ô)­]¸6Ñ-BÔ-BÒBÑBõ !¥%­­sµI½tÅSÐIˆà Ô2Ô=¸lÔKÐð
 #¥i [Ñ0ð 	<ð 	<ˆCØ×(Ò(¨¨lÑ;Ô;Ð;Ð;àÔ,Ô7¸ÔHˆØ˜	Ð!Ð!ÝÐ6Ñ7Ô7Ð7Ø&ð >ð >�Ø×&Ò& sÐ,<Ñ=Ô=Ð=Ð=Ø#3�IÔ Ð åÐ>Ñ?Ô?Ð?Ø&ð 9ð 9�ð ˜-Ô5Ð5Ð5Ø!Ô/×3Ò3°CÑ8Ô8Ð8øÝ#,Ô#;�IÔ àÔ,Ô7¸ÔDˆØ˜Ð%Ð%ÝÐ6Ñ7Ô7Ð7Ø&ð >ð >�Ø×&Ò& sÐ,<Ñ=Ô=Ð=Ð=Ø#3�IÔ Ð Ø˜,Ò&Ð&ÝÐ=Ñ>Ô>Ð>Ø&ð Eð E�Ø×&Ò& sÐ,CÑDÔDÐDÐDØ#:�IÔ Ð åÐ>Ñ?Ô?Ð?Ø&ð 9ð 9�ð ˜-Ô5Ð5Ð5Ø!Ô/×3Ò3°CÑ8Ô8Ð8øÝ#,Ô#;�IÔ àÔ.Ô9¸,ÔGˆØÐ)Ð)Ð)ÝÐ:Ñ;Ô;Ð;Ø&ð Að A�Ø×(Ò(¨Ð.?Ñ@Ô@Ð@Ð@Ø%6�IÔ"Ð"Ð"åÐAÑBÔBÐBØ&ð ;ð ;�ð ˜/Ô7Ð7Ð7Ø#Ô1×5Ò5°cÑ:Ô:Ð:øÝ%.Ô%=�IÔ"Ð"Ð"ð 	�ŠÐ$ oÑ6Ô6Ð6Ð6Ð6s   • œ
)¨)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.iplibra   )Úshellr«   r¬   s      r   Ú_is_ipythonr°   3  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Ú10ptro   ç      ð?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          |¦  «        }|r¤| r¢	 ddl	}t          |j        ¦  «        t          d¦  «        k    rddlm} n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¦  «         t3          |||||	|
|||||fi |¤Ž dS t5          |fi |¤Ž dS )a2  
    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%   )ÚsstrreprFz1.0)Ú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¹   rX   )Ú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º   rX   )r¿   r   rÀ   rº   s     €€r   rÁ   zinit_printing.<locals>.<lambda>%  s+   ø€ ¨¨Øð*3ð *3Ø %ð*3Ø)1ð*3ð *3€ r   rn   zMinit_printing: Mode is not able to be set due to internalsof IPython printing)r   Úsympy.printing.printerrµ   Úsympy.printingr%   r¶   Úget_ipythonÚ	NameErrorr°   r(   r   r�   Ú!IPython.terminal.interactiveshellr·   Ú*IPython.frontend.terminal.interactiveshellÚcoder¸   ra   ÚjoinÚargvr   rˆ   Ú	NO_GLOBALÚset_global_settingsr•   r©   r   )Úpretty_printrº   r»   r›   r¼   r½   Ú	no_globalrš   r0   rG   rœ   r4   ru   rk   Ústr_printerÚpretty_printerr�   rD   r   r   rµ   r   Ú
in_ipythonr(   r·   r¸   Úmode_in_settingsrÀ   s    `` ``                     @r   Úinit_printingrÔ   H  s  øøøøø€ ðv €J€J€JØ.Ð.Ð.Ð.Ð.Ð.àð 	BØÐ%Ø+ˆNˆNà?Ð?Ð?Ð?Ð?Ð?Ð?àÐ"Ø(ˆNˆNàAÐAÐAÐAÐAÐAð €JØ	€zð	*Ý‘”ˆBð  D˜.ˆJˆJøõ ð 	ð 	ð 	ØˆDð	øøøð
 
ð %�*ð %Ý  ‘_”_ˆ
àð %�lð %ð	%ØˆNˆNˆNõ ˜WÔ0Ñ1Ô1µ]À5Ñ5IÔ5IÒIÐIØVÐVÐVÐVÐVÐVÐVà_Ð_Ð_Ð_Ð_Ð_Ø/Ð/Ð/Ð/Ð/Ð/õ
 ˜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: Ã:
DÄD)TNNNNNFNFNr±   r²   ro   TNNNr³   )Ú__doc__Úsympy.external.importtoolsr   Úior   Úsympy.printing.latexr   rŽ   Úsympy.printing.previewr   Úsympy.utilities.miscr   Úsympy.printing.defaultsr   r   r©   r°   rÌ   rÔ   rX   r   r   ú<module>rÜ      sè   ðØ =Ð =à 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø Ð Ð Ð Ð Ð à 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø *Ð *Ð *Ð *Ð *Ð *Ø &Ð &Ð &Ð &Ð &Ð &Ø -Ð -Ð -Ð -Ð -Ð -ð#ð #ð #ð*P7ð P7ð P7ðd/ð /ð /ð& €	à=AØ>BØCGØ4:Ø48Ø37Ø,/ðj:ð j:ð j:ð j:ð j:ð j:r   