403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/lib/python3.9/dist-packages/matplotlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/lib/python3.9/dist-packages/matplotlib/__pycache__/texmanager.cpython-39.pyc
a

���h�:�@s�dZddlZddlZddlZddlZddlmZddlZddlm	Z	ddl
ZddlZ
ddlmZmZmZe�e�Zdd�dd�ZGd	d
�d
�ZdS)a�
Support for embedded TeX expressions in Matplotlib.

Requirements:

* LaTeX.
* \*Agg backends: dvipng>=1.6.
* PS backend: PSfrag, dvips, and Ghostscript>=9.0.
* PDF and SVG backends: if LuaTeX is present, it will be used to speed up some
  post-processing steps, but note that it is not used to parse the TeX string
  itself (only LaTeX is supported).

To enable TeX rendering of all text in your Matplotlib figure, set
:rc:`text.usetex` to True.

TeX and dvipng/dvips processing results are cached
in ~/.matplotlib/tex.cache for reuse between sessions.

`TexManager.get_rgba` can also be used to directly obtain raster output as RGBA
NumPy arrays.
�N)�Path)�TemporaryDirectory)�_api�cbook�dviread��optioncCs&|durd|�d�nd}d||d�S)a$
    Output LaTeX code that loads a package (possibly with an option) if it
    hasn't been loaded yet.

    LaTeX cannot load twice a package with different options, so this helper
    can be used to protect against users loading arbitrary packages/options in
    their custom preamble.
    N�[�]�z]\makeatletter\@ifpackageloaded{%(package)s}{}{\usepackage%(option)s{%(package)s}}\makeatother��packager�rrr�?/usr/local/lib/python3.9/dist-packages/matplotlib/texmanager.py�_usepackage_if_not_loaded's	�rc@s0eZdZdZe�d�Zej�	e
��d�ZiZ
dZddddd	d	d
dddd
dddddd�Zddddddddddddd�Zejdd��Zedd��Zedd��Zed5dd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zedd'�d(d)��Zed*d+��Zed,d-��Zed6d.d/��Zed7d1d2��Z ed8d3d4��Z!dS)9�
TexManagera
    Convert strings to dvi files using TeX, caching the results to a directory.

    The cache directory is called ``tex.cache`` and is located in the directory
    returned by `.get_cachedir`.

    Repeated calls to this constructor always return the same instance.
    z3.8z	tex.cache)�serif�
sans-serif�cursive�	monospacez\renewcommand{\rmdefault}{pnc}z\renewcommand{\rmdefault}{pbk}z\usepackage{mathptmx}z\usepackage{mathpazo}z\usepackage{chancery}z\usepackage{charter}rz\usepackage{helvet}z\usepackage{avant}z\usepackage{courier}z\usepackage{type1ec})�new century schoolbook�bookman�times�palatino�
zapf chanceryr�charterrr�	helvetica�avant garde�courierr�computer modern roman�computer modern sans serif�computer modern typewriterrrrr)rrrrrrrrrrr r!cCst|j�jddd�t�|�S)NT��parents�exist_ok)r�	_texcache�mkdir�object�__new__��clsrrrr(kszTexManager.__new__cCs�tjd}t|�dkr"|d��nd}t|�dkrD||jvrD|dfSt|�dkrh||jvrh|j|dfSt�dd�	|j��d	SdS)
z<Return the font family name and whether the font is reduced.�font.family�rNFTzXfont.family must be one of (%s) when text.usetex is True. serif will be used by default.z, )rF)
�mpl�rcParams�len�lower�_font_families�_font_preambles�_font_types�_log�info�join)r*�ffZff_valrrr�_get_font_family_and_reducedps

�z'TexManager._get_font_family_and_reducedc
s(|��\}}i�|jD]�}|rD||krD|jtjdd���|<qtjd|D]P}|��|jvr�|j|���|<t�d|||j|���qqRt�d|�qRt�d|�|j|�|<q�fdd�d	D�}|d
kr�|�	�d
�|�	d�d�
t|��}|d
k�rdn|dk�rdnd}||fS)Nr+rzfont.zfamily: %s, font: %s, info: %sz&%s font is not compatible with usetex.zPNo LaTeX-compatible font found for the %s fontfamily in rcParams. Using default.csh|]}�|�qSrr)�.0�family�Z	preamblesrr�	<setcomp>�s�z<TexManager._get_font_preamble_and_command.<locals>.<setcomp>)rrrrz\usepackage{type1cm}�
rz	\sffamilyrz	\ttfamilyz	\rmfamily)r8r1r2r-r.r0r4�debugr5�addr6�sorted)r*Zrequested_familyZis_reduced_fontZfont_family�font�cmd�preamble�fontcmdrr;r�_get_font_preamble_and_commandsH
�
����
�
�z)TexManager._get_font_preamble_and_commandNc
Cs�|�||�t|�}t�|�d����}t|j�}d\}}td|||�D]}	|t||	|	d��}qJ|j	ddd�t
j�||�S)zU
        Return a filename based on a hash of the string, fontsize, and dpi.
        �utf-8)�rGrrGTr")
�_get_tex_source�str�hashlib�md5�encode�	hexdigestrr%�ranger&�os�pathr6)
r*�tex�fontsize�dpi�srcZfilehash�filepathZnum_lettersZ
num_levels�irrr�get_basefile�s
zTexManager.get_basefilecCs|��\}}|S)zU
        Return a string containing font configuration for the tex preamble.
        )rE)r*�
font_preamble�commandrrr�get_font_preamble�szTexManager.get_font_preamblecCs
tjdS)z>Return a string containing user additions to the tex preamble.ztext.latex.preamble)r-r.r)rrr�get_custom_preamble�szTexManager.get_custom_preamblec"Cs�|��\}}d|}d�ddddd|dd	d
ddd
|��ddtddd�ddtd�ddddddd|�d|�d�dd |�d!|�d�d"g�S)#z;Return the complete TeX source for processing a TeX string.g�?r=z\documentclass{article}z=% Pass-through \mathdefault, which is used in non-usetex modez>% to use the default text font but was historically suppressedz% in usetex mode.z \newcommand{\mathdefault}[1]{#1}z\usepackage[utf8]{inputenc}z.\DeclareUnicodeCharacter{2212}{\ensuremath{-}}z3% geometry is loaded before the custom preamble as z<% convert_psfrags relies on a custom preamble to change the z% geometry.z1\usepackage[papersize=72in, margin=1in]{geometry}z?% Use `underscore` package to take care of underscores in text.z?% The [strings] option allows to use underscores in file names.Z
underscore�stringsrz;% Custom packages (e.g. newtxtext) may already have loaded z"% textcomp with different options.Ztextcompz\pagestyle{empty}z\begin{document}z>% The empty hbox ensures that a page is printed even for emptyz=% inputs, except when using psfrag which gets confused by it.z;% matplotlibbaselinemarker is used by dviread to detect thez% last line's baseline.z
\fontsize{z}{z}%z!\ifdefined\psfrag\else\hbox{}\fi%�{� z\end{document})rEr6r[r)r*rQrRrXrDZbaselineskiprrrrH�sB
�zTexManager._get_tex_sourcecCs.|�||�d}t|�j|�||�dd�|S)zv
        Generate a tex file to render the tex string at a specific font size.

        Return the file name.
        z.texrF)�encoding)rWr�
write_textrH)r*rQrR�texfilerrr�make_tex�s
�zTexManager.make_tex��cwdcCs�t�t�|��z$tj||dur$|n|jtjd�}Wn�tyn}z"t	d|d�d��|�WYd}~n`d}~0tj
y�}z>t	dj|dt�|�|�d�|j
�dd�d	��d�WYd}~n
d}~00t�|�|S)
N)rd�stderrz*Failed to process string with tex because rz could not be foundz�{prog} was not able to process the following string:
{tex!r}

Here is the full command invocation and its output:

{format_command}

{exc}

�unicode_escaperF�backslashreplace)�progZformat_commandrQ�exc)r4r>rZ_pformat_subprocess�
subprocess�check_outputr%�STDOUT�FileNotFoundError�RuntimeError�CalledProcessError�formatrL�output�decode)r*rYrQrd�reportrirrr�_run_checked_subprocess�s2�
����
�
z"TexManager._run_checked_subprocessc	Cs�|�||�}d|}tj�|�s�t|�||��}t|�j}t|d��R}t|�}|jdddd|j	��|j	�g||d�|t|�j	�
|�Wd�n1s�0Y|S)	zm
        Generate a dvi file containing latex's layout of tex string.

        Return the file name.
        z%s.dvi)�dirZlatexz-interaction=nonstopmodez--halt-on-errorz--output-directory=rcN)rWrOrP�existsrrb�parentrrt�name�replace)	r*rQrR�basefile�dvifilerard�tmpdirZtmppathrrr�make_dvis 


��2zTexManager.make_dvic
Cs�|�|||�}d|}tj�|�s~|�||�}ddddt|�ddd||g
}ttd	d
�rrt�d�j	dkrr|�
dd
�|�||�|S)zp
        Generate a png file containing latex's rendering of tex string.

        Return the file name.
        z%s.pngZdvipngz-bgZTransparentz-Dz-TZtightz-oZ_called_from_pytestFz1.16r,z--freetype0)rWrOrPrvr}rI�getattrr-Z_get_executable_infoZraw_version�insertrt)r*rQrRrSrz�pngfiler{rBrrr�make_png.s
��zTexManager.make_pngcCs�|stjd}|stjd}|�||�|f}|j�|�}|dur�|�|||�}tj�tj	�
|j|��}|dd�dd�df|j|<}|S)zReturn the alpha channel.z	font.sizezsavefig.dpiN���)r-r.rH�_grey_arrayd�getr��imageZimreadrOrPr6r%)r*rQrRrS�key�alphar��rgbarrr�get_greyFs

 zTexManager.get_grey�rrrcCsH|�|||�}t�g|j�d�R�}tj�|�|ddd�f<||d<|S)a*
        Return latex's rendering of the tex string as an RGBA array.

        Examples
        --------
        >>> texmanager = TexManager()
        >>> s = r"\TeX\ is $\displaystyle\sum_n\frac{-e^{i\pi}}{2^n}$!"
        >>> Z = texmanager.get_rgba(s, fontsize=12, dpi=80, rgb=(1, 0, 0))
        �.N�).r�)r��np�empty�shaper-�colorsZto_rgb)r*rQrRrSZrgbr�r�rrr�get_rgbaUs
zTexManager.get_rgbacCsz|��dkrdS|�||�}|r*|�d�nd}t�|d|��}|\}Wd�n1sZ0Y|j|j|j|jfS)z-Return width, height and descent of the text.rr�g�?r,�HN)�stripr}Zpoints_to_pixelsrZDvi�width�heightZdescent)r*rQrRZrendererr{Zdpi_fractionZdvi�pagerrr�get_text_width_height_descentfs$z(TexManager.get_text_width_height_descent)N)NN)NNr�)N)"�__name__�
__module__�__qualname__�__doc__rZdeprecate_privatize_attributeZtexcacherOrPr6r-Zget_cachedirr%r�r1r2r3�	functools�	lru_cacher(�classmethodr8rErWrZr[rHrbrtr}r�r�r�r�rrrrr8s~	
��


(


$


r)r�r�rJ�loggingrO�pathlibrrj�tempfiler�numpyr�Z
matplotlibr-rrr�	getLoggerr�r4rrrrrr�<module>s


Youez - 2016 - github.com/yon3zu
LinuXploit