403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/IPython/lib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/IPython/lib/__pycache__/latextools.cpython-311.pyc
�

�@�cu ���dZddlmZmZddlZddlZddlZddlZddlm	Z	ddl
Z
ddlmZm
Z
ddlmZmZddlmZddlmZdd	lmZmZmZdd
lmZGd�de��Z		dd�Zdd�Zdd�Zd�Zd�Z dZ!dd�Z"dS)zTools for handling LaTeX.�)�BytesIO�openN)�encodebytes)�Path�PurePath)�find_cmd�FindCmdError��
get_config)�SingletonConfigurable)�List�Bool�Unicode)�cast_unicodec�8�eZdZdZd�Zee��ddgd����d���Ze	dd	����d���Z
egd
�d����d���Zed����d���Zd
S)�	LaTeXToolz3An object to store configuration of the LaTeX tool.c��t��S)Nr
)�selfs �8/usr/lib/python3/dist-packages/IPython/lib/latextools.py�_config_defaultzLaTeXTool._config_defaults���|�|���
matplotlib�dvipngaPreferred backend to draw LaTeX math equations. Backends in the list are checked one by one and the first usable one is used.  Note that `matplotlib` backend is usable only for inline style equations.  To draw  display style equations, `dvipng` backend must be specified. )�helpT)�configzmUse breqn.sty to automatically break long equations. This configuration takes effect only for dvipng backend.)�amsmath�amsthm�amssymb�bmziA list of packages to use for dvipng backend. 'breqn' will be automatically appended when use_breqn=True.zKAdditional preamble to use when generating LaTeX source for dvipng backend.N)
�__name__�
__module__�__qualname__�__doc__rr
r�tag�backendsr�	use_breqn�packages�preamble�rrrrs������=�=�����t���	�	�L�(�+�H�
�
�
��#�T�#�
�
�
����C�
�
�
��#�T�#�
�
�	��t�.�.�.�F�
�
�
��#�T�#�
�
�	
��w��
�
�
��#�T�#�
�
�
�H�HrrF�Black��?c
���t|��}t���j}|�|d}||vrdS|dkrt}n�|dkr�t
}|�d��r�t|��dkr�	d�d�	d	�tj|d
d�d��D������}nz#t$r(}td�|����|�d}~wwxYwtd�|�����n"td
�|�����|||||��}	|r|	rt|	��}	|	S)alRender a LaTeX string to PNG.

    Parameters
    ----------
    s : str
        The raw string containing valid inline LaTeX.
    encode : bool, optional
        Should the PNG data base64 encoded to make it JSON'able.
    backend : {matplotlib, dvipng}
        Backend for producing PNG data.
    wrap : bool
        If true, Automatically wrap `s` as a LaTeX equation.
    color : string
        Foreground color name among dvipsnames, e.g. 'Maroon' or on hex RGB
        format, e.g. '#AA20FA'.
    scale : float
        Scale factor for the resulting PNG.
    None is returned when the backend cannot be used.

    Nrrr�#�zRGB {}� c�H�g|]}tt|d������ S)�)�str�int)�.0�xs  r�
<listcomp>z latex_to_png.<locals>.<listcomp>as8��6S�6S�6S�!�c�#�a��*�*�o�o�6S�6S�6Sr��zInvalid color specification {}.zNo such backend {0})rr�instancer%�latex_to_png_mpl�latex_to_png_dvipng�
startswith�len�format�join�textwrap�wrap�
ValueErrorr)
�s�encode�backendrA�color�scale�allowed_backends�f�e�bin_datas
          r�latex_to_pngrL=s���,	�Q���A� �)�)�+�+�4����"�1�%���&�&�&��t��,������	�H�	�	������C� � �		R��5�z�z�Q���]�$�O�O�C�H�H�6S�6S�6>�m�E�!�"�"�I�q�6Q�6Q�6S�6S�6S�-T�-T�U�U�E�E��!�]�]�]�$�%F�%M�%M�e�%T�%T�U�U�[\�\�����]����!�!B�!I�!I�%�!P�!P�Q�Q�Q�		R��.�5�5�g�>�>�?�?�?��q��D�%��'�'�H�
�)�(�)��x�(�(���Os�A
C�
D�#C=�=Dc��	ddlm}m}m}ddlm}ddlm}n#t$rYdSwxYw|�	dd��}|rd�
|��}	|�d�	��}	d
|z}
t��}|�
d��}|�|d|	�
��\}
}}}}|�|
dz|dzf���}|�d||z||	|���|�|��|�||
dd���|���S#t(t*|f$rYdSwxYw)Nr)�figure�font_manager�mathtext)�backend_agg)�ParseFatalExceptionz$$�$z${0}$�)�size�x�path�H)�dpi�prop)�figsize)�fontpropertiesrF�pngT)rYr>�transparent)rrNrOrP�matplotlib.backendsrQ�	pyparsingrR�ImportError�replacer>�FontPropertiesr�MathTextParser�parse�Figure�text�FigureCanvasAgg�savefig�getvaluerB�RuntimeError)rCrArFrGrNrOrPrQrRrZrY�buffer�parser�width�height�depth�_�figs                  rr:r:os����=�=�=�=�=�=�=�=�=�=�3�3�3�3�3�3�1�1�1�1�1�1�1�������t�t�����	
�	�	�$����A����O�O�A������*�*��*�3�3���E�k�������(�(��0�0��%+�\�\�!��$�\�%G�%G�"��v�u�a���m�m�U�R�Z��"��$=�m�>�>������E�F�N�A�d�%��H�H�H��#�#�C�(�(�(����F��E�t��D�D�D���� � � ����&9�:�����t�t����s��
'�'�CD1�1E�Ec��	td��td��n#t$rYdSwxYwd}tjdkr-t	j��}|xjtjzc_	ttj
����}d}d}d}|�|���dd�	��5}	|	�
t||����ddd��n#1swxYwYttjd
��5}
t	jdddd
|g||
|
|���t#d|z��}t	jddddt%|��ddddd||d|g||
|
|���ddd��n#1swxYwY|�|���d��5}	|	���cddd��t)j|��S#1swxYwYn*#tj$rYt)j|��dSwxYw	t)j|��dS#t)j|��wxYw)N�latexr�ntztmp.texztmp.dviztmp.png�w�utf8)�encoding�wbz-halt-on-errorz-interaction�	batchmode)�cwd�stdout�stderr�startupinfo�z-T�tightz-Dz-z�9z-bg�Transparentz-oz-fg�rb)rr	�os�name�
subprocess�STARTUPINFO�dwFlags�STARTF_USESHOWWINDOWr�tempfile�mkdtemp�joinpathr�
writelines�	genelatex�devnull�
check_call�roundr2�read�shutil�rmtree�CalledProcessError)rCrArFrGr~�workdir�tmpfile�dvifile�outfilerIr��
resolutions            rr;r;�sO��������������������t�t������K�	�w�$��� �,�.�.�����z�>�>���/��x�'�)�)�*�*��������
�
�
�g�
&�
&�
+�
+�C�&�
+�
A�
A�	-�Q�
�L�L��1�d�+�+�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-��"�*�d�
#�
#�	�w��!��*�N�K��Q����'�
�
�
�
��s�5�y�)�)�J��!������
�O�O����!������� ���'�)
�
�
�
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�B�
�
�g�
&�
&�
+�
+�D�
1�
1�	�Q��6�6�8�8�	�	�	�	�	�	�	�
	�
�g�����	�	�	�	����	�	�	�	�	���(������
�g����������	�
	�
�g��������
�g�������s��!�
/�/�2AG<�$C2�&G<�2C6�6G<�9C6�:G<�A%F�<G<�F�G<�F�+G<�;G0�G<�0G4�4G<�7G4�8G<�;H=�<H#�H=�"H#�#H=�=Ic��	td��tjd|gtjtj���}|���\}}|����dd��S#t$rYdSwxYw)z5Invoke kpsewhich command with an argument `filename`.�	kpsewhich)r|r}rwrbN)rr��Popen�PIPE�communicate�strip�decoder	)�filename�procr|r}s    rr�r��s���
��������
�(�#��?�:�?�<�<�<�� �+�+�-�-�����|�|�~�~�$�$�V�Y�7�7�7���
�
�
����
���s�A:A=�=
B�
Bc#�\K�t���}|o|jotd��}dV�|j}|r|dgz}|D]}d�|��V��dV�|jr	|jV�dV�|r
dV�|V�dV�n|rd	�|��V�n|V�d
V�dS)z+Generate LaTeX document for dvipng backend.z	breqn.styz\documentclass{article}�breqnz\usepackage{{{0}}}z\pagestyle{empty}z\begin{document}z\begin{dmath*}z\end{dmath*}z$${0}$$z\end{document}N)rr9r&r�r'r>r()�bodyrA�ltr�r'�packs      rr�r��s����	�	�	�	�	�B��<�R�\�<�i��&<�&<�E�
$�$�$�$��{�H��(��w�i�'���1�1��#�*�*�4�0�0�0�0�0�0�
����	�{���k����
�����������
�
�
������	
������%�%�%�%�%�%��
�
�
�
�����rz-<img src="data:image/png;base64,%s" alt=%s />�imagec�j�t|d����d��}|rt||fzSdS)z�Render LaTeX to HTML with embedded PNG data using data URIs.

    Parameters
    ----------
    s : str
        The raw string containing valid inline LateX.
    alt : str
        The alt text to use for the HTML.
    T)rD�asciiN)rLr��_data_uri_template_png)rC�alt�base64_datas   r�
latex_to_htmlr��sF���q��.�.�.�5�5�g�>�>�K��<�%�+�s�);�;�;�<�<r)FNFr*r+)r*r+)r�)#r#�iorrr�r�r�r��base64rr@�pathlibrr�IPython.utils.processrr	�traitlets.configr�traitlets.config.configurabler�	traitletsr
rr�IPython.utils.py3compatrrrLr:r;r�r�r�r�r)rr�<module>r�s�����
��������	�	�	�	�����
�
�
�
���������������"�"�"�"�"�"�"�"�8�8�8�8�8�8�8�8�'�'�'�'�'�'�?�?�?�?�?�?�)�)�)�)�)�)�)�)�)�)�0�0�0�0�0�0�"�"�"�"�"�%�"�"�"�JCJ��/�/�/�/�d����<<�<�<�<�~

�

�

����2N��<�<�<�<�<�<r

Youez - 2016 - github.com/yon3zu
LinuXploit