403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.9/site-packages/sphinx/ext/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/sphinx/ext/__pycache__/imgmath.cpython-39.opt-1.pyc
a

�ab4�@s�dZddlZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZmZm
Z
mZddlmZddlmZddlZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZmZddl m!Z!m"Z"ddl#m$Z$m%Z%ddl&m'Z'ddl(m)Z)m*Z*ddl+m,Z,ddl-m.Z.e!�/e0�Z1e�2edd�Z3Gdd�de�Z4Gdd�de�Z5dZ6e�7d�Z8e�7d�Z9e�7d�Z:e;e<d�dd �Z=e;e<dd!�d"d#�Z>dFe;e;ee;e;d%�d&d'�Z?ee;d(�d)d*�Z@e;ee;d+�d,d-�ZAe
e;e;ee;e;fd.�d/d0�ZBe;eee;e<fd1�d2d3�ZCe;eee;e<fd1�d4d5�ZDe.e;ee;e<fd6�d7d8�ZEeeFdd9�d:d;�ZGe.ee;d<�d=d>�ZHe.ejIdd<�d?d@�ZJe.ejKdd<�dAdB�ZLeee;efdC�dDdE�ZMdS)Gz�
    sphinx.ext.imgmath
    ~~~~~~~~~~~~~~~~~~

    Render math in HTML via dvipng or dvisvgm.

    :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�path)�PIPE�CalledProcessError)�Any�Dict�List�Tuple)�nodes)�Element)�package_dir)�Sphinx)�Builder)�Config)�SphinxError)�_�__)�logging�sha1)�get_node_equation_number�wrap_displaymath)�	ensuredir)�read_png_depth�write_png_depth)�
LaTeXRenderer)�HTMLTranslatorZ	templates�imgmathcs.eZdZdZdeeedd��fdd�
Z�ZS)�MathExtErrorzMath extension errorN)�msg�stderr�stdout�returncs0|r|d|7}|r |d|7}t��|�dS)Nz

[stderr]
z

[stdout]
)�super�__init__)�selfrrr��	__class__��6/usr/lib/python3.9/site-packages/sphinx/ext/imgmath.pyr"-s
zMathExtError.__init__)NN)�__name__�
__module__�__qualname__�category�strr"�
__classcell__r&r&r$r'r*src@seZdZdZdS)�InvokeErrorzerrors on invoking converters.N)r(r)r*�__doc__r&r&r&r'r.5sr.)�png�svgz\[\d+ depth=(-?\d+)\]z.*, depth=(.*)ptz<!-- DEPTH=(-?\d+) -->)�filenamer cCsbt|��F}|D]}qt�|�}|r>t|�d��Wd�SWd�dS1sT0YdS)z9Read the depth from comment at last line of SVG file
    �N)�open�depthsvgcomment_re�match�int�group)r2�f�line�matchedr&r&r'�read_svg_depth@s

r<)r2�depthr cCs<t|d��}|�d|�Wd�n1s.0YdS)z<Write the depth to SVG file as a comment at end of file
    �az
<!-- DEPTH=%s -->N)r4�write)r2r=r9r&r&r'�write_svg_depthMsr@�)�image_format�math�config�confdirr cCs�|jtt|jd��|j|dkr$dnd|d�}|jr:d}nd}|jD].}t�|||�}t�|�rDt	��
||�SqDt	t��
||�S)zGenerate LaTeX macro.g333333�?r0rAz
,tightpage)ZfontsizeZbaselineskipZpreambleZ	tightpagerCz
preview.tex_tztemplate.tex_t)�imgmath_font_sizer7�round�imgmath_latex_preamble�imgmath_use_preview�templates_pathr�join�existsrZrender)rBrCrDrEZ	variablesZ
template_nameZtemplate_dir�templater&r&r'�generate_latex_macroTs�

rN)�builderr cCst|d�st��|_|jS)z�Create temporary directory.

    use only one tempdir per build -- the use of a directory is cleaner
    than using temporary files, since we can clean up everything at once
    just removing the whole directory (see cleanup_tempdir)
    �_imgmath_tempdir)�hasattr�tempfileZmkdtemprP)rOr&r&r'�ensure_tempdirls

rS)�latexrOr c
Cst|�}t�|d�}t|ddd��}|�|�Wd�n1sB0Y|jjdg}|�|jj�|�	d�z$t
j|tt|ddd	�t�|d
�WSt
y�}z&t�td�|jj�t|�WYd}~n@d}~0t�y}ztd|j|j�|�WYd}~n
d}~00dS)
z%Compile LaTeX macros for math to DVI.zmath.tex�wzutf-8)�encodingNz--interaction=nonstopmodeT�ascii)rr�cwd�checkrVzmath.dvizYLaTeX command %r cannot be run (needed for math display), check the imgmath_latex settingzlatex exited with error)rSrrKr4r?rD�
imgmath_latex�extend�imgmath_latex_args�append�
subprocess�runr�OSError�logger�warningrr.rrrr)rTrO�tempdirr2r9�command�excr&r&r'�compile_mathys&(
�
�rf)rd�namer c
Cs�z"tj|ttddd�}|j|jfWStyd}z*t�td�||d|�t	|�WYd}~nBd}~0t
y�}z"td||j|j�|�WYd}~n
d}~00dS)z*Convert DVI file to specific image format.TrW)rrrYrVzS%s command %r cannot be run (needed for math display), check the imgmath_%s settingrNz%s exited with error)r^r_rrrr`rarbrr.rr)rdrg�retrer&r&r'�convert_dvi_to_image�s

�ri)�dvipathrOr cCs�t|�}t�|d�}d}|jjd|dddg}|�|jj�|jjrL|�d�|�|�t	||�\}}d}|jjr�|�
�D].}	t�|	�}
|
rxt
|
�d	��}t||�q�qx||fS)
zConvert DVI file to PNG image.zmath.png�dvipng�-oz-TZtightz-z9z--depthNr3)rSrrKrD�imgmath_dvipngr[�imgmath_dvipng_argsrIr]ri�
splitlines�depth_rer6r7r8r�rjrOrcr2rgrdrrr=r:r;r&r&r'�convert_dvi_to_png�s$



rrcCs�t|�}t�|d�}d}|jjd|g}|�|jj�|�|�t||�\}}d}|jj	r�|�
�D]:}	t�|	�}
|
r`t
t|
�d��dd�}t||�q�q`||fS)zConvert DVI file to SVG image.zmath.svg�dvisvgmrlNr3�dg�z�GR@)rSrrKrD�imgmath_dvisvgmr[�imgmath_dvisvgm_argsr]rirIro�depthsvg_rer6rG�floatr8r@rqr&r&r'�convert_dvi_to_svg�s 


ry)r#rCr c
Csp|jjj��}|tvrtd��t|||jj|jj�}dt|�	���
�|f}t�|jj
d|�}t�|jj|jjd|�}t�|�r�|dkr�t|�}n|dkr�t|�}||fSt|jd�s�t|jd�r�dSzt||j�}Wnty�d	|j_YdS0z:|dk�rt||j�\}	}n|dk�r,t||j�\}	}Wnt�yLd	|j_YdS0tt�|��t�|	|�||fS)
a�Render the LaTeX math expression *math* using latex and dvipng or
    dvisvgm.

    Return the filename relative to the built document and the "depth",
    that is, the distance of image bottom and baseline in pixels, if the
    option to use preview_latex is switched on.

    Error handling may seem strange, but follows a pattern: if LaTeX or dvipng
    (dvisvgm) aren't available, only a warning is generated (since that enables
    people on machines without these programs to at least build the rest of the
    docs successfully).  If the programs are there, however, they may not fail
    since that indicates a problem in the math source.
    z2imgmath_image_format must be either "png" or "svg"z%s.%srCr0r1�_imgmath_warned_latex� _imgmath_warned_image_translator)NNT)rOrD�imgmath_image_format�lower�SUPPORT_FORMATrrNrEr�encodeZ	hexdigest�	posixpathrK�imgpathrZoutdirZimagedir�isfilerr<rQrfr.rzrrryr{r�dirname�shutil�move)
r#rCrBrTr2ZrelfnZoutfnr=rjr�r&r&r'�render_math�sJ�


�

r�)�apprer cCsB|rdSt|jd�sdSzt�|jj�Wnty<Yn0dS)NrP)rQrOr��rmtreeZ_mathpng_tempdir�	Exception)r�rer&r&r'�cleanup_tempdirsr�)r#�noder cCs$|jjjr d|�|�����SdS)Nz	 alt="%s"rA)rOrD�imgmath_add_tooltipsr�astext�strip)r#r�r&r&r'�get_tooltips
r�c
Cs�zt|d|��d�\}}Wnlty�}zTt|�}tj|ddg|��d�}|�|�t�t	d�|��|�tj
|�WYd}~n
d}~00|dur�|j�d|�
|������n8d|t||�}|dur�|d|7}|j�|d	�tj
�dS)
N�$�WARNING���type�levelZbackrefs�sourcezdisplay latex %r: %sz<span class="math">%s</span>z<img class="math" src="%s"z style="vertical-align: %dpx"z/>)r�r�rr,r	�system_message�	walkaboutrarbr�SkipNode�bodyr]rr�r�)r#r��fnamer=rer�sm�cr&r&r'�html_visit_math$s&
�
�r�c	
CsX|dr|��}nt|��dd�}zt||�\}}Wnlty�}zTt|�}tj|ddg|��d�}|�|�t�	t
d�|��|�tj|�WYd}~n
d}~00|j�
|j|ddd	��|j�
d
�|d�rt||�}|j�
d|�|�|td
��|j�
d�|du�r0|j�
d|�|������n|j�
d|t||�d�tj�dS)NZnowrapFr�r�r�zinline latex %r: %sZdivrC)ZCLASSz<p>�numberz<span class="eqno">(%s)zPermalink to this equationz</span>z'<span class="math">%s</span></p>
</div>z
<img src="%s"z
/></p>
</div>)r�rr�rr,r	r�r�rarbrr�r�r]ZstarttagrZadd_permalink_refrrr�r�)	r#r�rTr�r=rerr�r�r&r&r'�html_visit_displaymath:s8

�



��r�)r�r cCs�|�dtdftdf�|�ddd�|�ddd�|�ddd�|�d	d
d�|�ddd�|�d
gd�d�|�ddgd�|�dgd�|�ddd�|�ddd�|�ddd�|�dt�tjdd�S)Nrr|r0ZhtmlrmrkrursrZrTrIFrn)z-gammaz1.5z-DZ110z-bgZTransparentrvz
--no-fontsr\rHrAr�TrF�zbuild-finished)�versionZparallel_read_safe)Zadd_html_math_rendererr�r�Zadd_config_valueZconnectr��sphinxZ__display_version__)r�r&r&r'�setupYs(��r�)rA)Nr/r��rer�r^rR�osrrr�typingrrrrZdocutilsr	Zdocutils.nodesr
r�rZsphinx.applicationrZsphinx.buildersr
Z
sphinx.configrZ
sphinx.errorsrZ
sphinx.localerrZsphinx.utilrrZsphinx.util.mathrrZsphinx.util.osutilrZsphinx.util.pngrrZsphinx.util.templaterZsphinx.writers.htmlrZ	getLoggerr(rarKrJrr.r~�compilerprwr5r,r7r<r@rNrSrfrirrryr�r�r�r�rCr�Z
math_blockr�r�r&r&r&r'�<module>s`





��
>

Youez - 2016 - github.com/yon3zu
LinuXploit