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/pygments/formatters/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/pygments/formatters/__pycache__/img.cpython-39.pyc
a

SҼa#U�@sZdZddlZddlZddlmZddlmZmZmZm	Z	ddl
Z
zddlmZm
Z
mZdZWneyrdZYn0zddlZWn6ey�zddlZWney�dZYn0Yn0gd�Zgd	�d
dgdgd
dgd�ZdZdZdZGdd�de�ZGdd�de�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd �d e�ZdS)!z�
    pygments.formatters.img
    ~~~~~~~~~~~~~~~~~~~~~~~

    Formatter for Pixmap output.

    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�	Formatter)�get_bool_opt�get_int_opt�get_list_opt�get_choice_opt)�Image�	ImageDraw�	ImageFontTF)�ImageFormatter�GifImageFormatter�JpgImageFormatter�BmpImageFormatter)�ZRomanZBookZNormalZRegularZMediumZObliqueZItalicZBoldzBold ObliquezBold Italic)�NORMAL�ITALIC�BOLD�
BOLDITALICzDejaVu Sans MonozCourier NewZMenloc@seZdZdZdS)�PilNotAvailablez,When Python imaging library is not availableN��__name__�
__module__�__qualname__�__doc__�rr�;/usr/lib/python3.9/site-packages/pygments/formatters/img.pyr5src@seZdZdZdS)�FontNotFoundz(When there are no usable fonts specifiedNrrrrrr9src@sdeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�FontManagerz>
    Manages a set of fonts: normal, italic, bold, etc...
    �cCsn||_||_i|_d|_tj�d�r8|s.t|_|��n2tj�d�rX|sNt	|_|�
�n|sbt|_|��dS)N�win�darwin)
�	font_name�	font_size�fonts�encoding�sys�platform�
startswith�DEFAULT_FONT_NAME_WIN�_create_win�DEFAULT_FONT_NAME_MAC�_create_mac�DEFAULT_FONT_NAME_NIX�_create_nix)�selfr r!rrr�__init__Bs

zFontManager.__init__c	Csztjdd||fdgtjdd�}|��\}}|jdkrv|��}|D].}|�d�rRqB|�����d�}|rB|SqBdSdS)Nzfc-listz%s:style=%s�file)�stdout�stderrrsFontconfig warning:�:)	�
subprocess�Popen�PIPEZcommunicate�
returncode�
splitlinesr&�decode�strip)	r-�name�style�procr0�_�lines�line�pathrrr�_get_nix_font_pathTs�


zFontManager._get_nix_font_pathcCs�tdD]2}|�|j|�}|durt�||j�|jd<qJqtd|j��dD]j}t|D]2}|�|j|�}|durZt�||j�|j|<qNqZ|dkr�|jd|j|<qN|jd|j|<qNdS)Nr�No usable fonts named: "%s"�rrrrr)�STYLESrAr r	�truetyper!r"r)r-r:r@r;�	stylenamerrrr,bs"�zFontManager._create_nixcCs|�|d|�����S)N� )�getr9�lower)r-�font_mapr:r;rrr�_get_mac_font_pathwszFontManager._get_mac_font_pathcsi}tj�t�d�d�ddfD]"�|��fdd�t���D��qtdD]4}|�||j|�}|durJt	�
||j�|jd<q�qJt
d|j��d	D]l}t|D]4}|�||j|�}|dur�t	�
||j�|j|<q�q�|d
kr�|jd|j|<q�|jd|j|<q�dS)N�HOMEzLibrary/Fonts/z/Library/Fonts/z/System/Library/Fonts/c3s>|]6}|���d�rtj�|�d��tj��|�fVqdS))ZttfZttcrN)rI�endswith�osr@�splitext�join)�.0�f�Zfont_dirrr�	<genexpr>~s�z*FontManager._create_mac.<locals>.<genexpr>rrBrCrr)rNr@rP�getenv�update�listdirrDrKr r	rEr!r"r)r-rJr:r@r;rFrrSrr*zs0��
�zFontManager._create_macFc

Cs|dD]Z}|D]P}z4d||o d||f}t�||�\}}	|WStyZYqYq0qq|rxtd||df��dS)N)rz (TrueType)z%s%s%srGz"Font %s (%s) not found in registryr)�_winregZQueryValueEx�OSErrorr)
r-�key�basename�stylesZfail�suffixr;Zvalname�valr=rrr�_lookup_win�s
�zFontManager._lookup_wincCsXd}tjdftjdftjdftjdfg}|D�]}z�tj|�}z�z�|�||jtdd�}t�||j	�|j
d<dD]\}|�||jt|�}|r�t�||j	�|j
|<qp|dkr�|j
d|j
|<qp|j
d|j
|<qpWWt�|�WdSt�y}z|}WYd}~n
d}~00Wt�|�nt�|�0Wq,t
�y>Yq,0q,|�rL|�td��dS)	Nz2Software\Microsoft\Windows NT\CurrentVersion\Fontsz/Software\Microsoft\Windows\CurrentVersion\FontsrTrCrrz$Can't open Windows font registry key)rX�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINE�OpenKeyr_r rDr	rEr!r"ZCloseKeyrrY)r-ZlookuperrorZkeynamesZkeynamerZr@r;�errrrrr(�s<�


�zFontManager._create_wincCs|jd�d�S)z)
        Get the character size.
        r�M�r"�getsize�r-rrr�
get_char_size�szFontManager.get_char_sizecCs|jd�|�S)z3
        Get the text size(width, height).
        rre)r-�textrrr�
get_text_size�szFontManager.get_text_sizecCs<|r|r|jdS|r |jdS|r.|jdS|jdSdS)z>
        Get the font based on bold and italic flags.
        rrrrN)r")r-�boldZobliquerrr�get_font�s


zFontManager.get_fontN)r)F)rrrrr.rAr,rKr*r_r(rhrjrlrrrrr=s

'rc@s�eZdZdZdZgd�ZdgZdZdZdd�Z	d-d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,S).r
a�	
    Create a PNG image from source code. This uses the Python Imaging Library to
    generate a pixmap from the source code.

    .. versionadded:: 0.10

    Additional options accepted:

    `image_format`
        An image format to output to that is recognised by PIL, these include:

        * "PNG" (default)
        * "JPEG"
        * "BMP"
        * "GIF"

    `line_pad`
        The extra spacing (in pixels) between each line of text.

        Default: 2

    `font_name`
        The font name to be used as the base font from which others, such as
        bold and italic fonts will be generated.  This really should be a
        monospace font to look sane.

        Default: "Courier New" on Windows, "Menlo" on Mac OS, and
                 "DejaVu Sans Mono" on \*nix

    `font_size`
        The font size in points to be used.

        Default: 14

    `image_pad`
        The padding, in pixels to be used at each edge of the resulting image.

        Default: 10

    `line_numbers`
        Whether line numbers should be shown: True/False

        Default: True

    `line_number_start`
        The line number of the first line.

        Default: 1

    `line_number_step`
        The step used when printing line numbers.

        Default: 1

    `line_number_bg`
        The background colour (in "#123456" format) of the line number bar, or
        None to use the style background color.

        Default: "#eed"

    `line_number_fg`
        The text color of the line numbers (in "#123456"-like format).

        Default: "#886"

    `line_number_chars`
        The number of columns of line numbers allowable in the line number
        margin.

        Default: 2

    `line_number_bold`
        Whether line numbers will be bold: True/False

        Default: False

    `line_number_italic`
        Whether line numbers will be italicized: True/False

        Default: False

    `line_number_separator`
        Whether a line will be drawn between the line number area and the
        source code area: True/False

        Default: True

    `line_number_pad`
        The horizontal padding (in pixels) between the line number margin, and
        the source code area.

        Default: 6

    `hl_lines`
        Specify a list of lines to be highlighted.

        .. versionadded:: 1.2

        Default: empty list

    `hl_color`
        Specify the color for highlighting lines.

        .. versionadded:: 1.2

        Default: highlight color of the selected style
    �img)rmZIMG�pngz*.pngFrnc	Ks�tstd��tj|fi|��d|_t|j�|_|jjdurDd|_n
|jj|_t	|dgd�|j
dd�|_t|d	d
�|_
t|dd�|_t|d
d�}t|�dd�|�|_|j��\|_|_|�dd�|_|�dd�|_t|dd�|_t|dd�|_t|dd�|_t|dd�|_t|dd�|_t|dd�|_t|dd�|_t|dd�|_|j�rd|j|j|jd|_ nd |_ g|_!t"|d!g�}|D]0}z|j!�#t$|��Wnt%�y�Yn0�q�|�d"|jj&��p�d#|_'g|_(dS)$zE
        See the class docstring for explanation of options.
        z5Python Imaging Library is required for this formatter�latin1Nz#fff�image_format)rn�jpeg�gif�bmpT)�normcase�	image_pad�
�line_pad�r!rr r�line_number_fgz#886�line_number_bgz#eed�line_number_chars�line_number_boldF�line_number_italic�line_number_pad��line_numbers�line_number_separator�line_number_step��line_number_startr�hl_lines�hl_colorz#f90))�
pil_availablerrr.r#�dictr;r\�background_colorr�default_image_formatrprrurwrrHr"rh�fontw�fonthryrzr{rr|r}r~r�r�r�r��line_number_widthr�r�append�int�
ValueErrorZhighlight_colorr��	drawables)r-�optionsZfontsizeZhl_lines_strr?rrrr.]sn�

�����
�
��zImageFormatter.__init__rcCstd��dS)NzWThe -S option is meaningless for the image formatter. Use -O style=<stylename> instead.)�NotImplementedError)r-�argrrr�get_style_defs�szImageFormatter.get_style_defscCs|j|jS)z+
        Get the height of a line.
        )r�rwrgrrr�_get_line_height�szImageFormatter._get_line_heightcCs||��|jS)z8
        Get the Y coordinate of a line number.
        )r�ru�r-�linenorrr�_get_line_y�szImageFormatter._get_line_ycCs|jS)z/
        Get the width of a character.
        )r�rgrrr�_get_char_width�szImageFormatter._get_char_widthcCs||j|jS)z?
        Get the X coordinate of a character position.
        )rur�)r-�
linelengthrrr�_get_char_x�szImageFormatter._get_char_xcCs|�|�|�|�fS)zL
        Get the actual position for a character and line position.
        )r�r�)r-r�r�rrr�
_get_text_pos�szImageFormatter._get_text_poscCs|j|�|�fS)zI
        Get the actual position for the start of a line number.
        )rur�r�rrr�_get_linenumber_pos�sz"ImageFormatter._get_linenumber_poscCs"|ddurd|d}nd}|S)zE
        Get the correct color for the token from the style.
        ZcolorN�#z#000r)r-r;�fillrrr�_get_text_color�szImageFormatter._get_text_colorcCs"|ddurd|d}nd}|S)zP
        Get the correct background color for the token from the style.
        ZbgcolorNr�r)r-r;Zbg_colorrrr�_get_text_bg_color�sz!ImageFormatter._get_text_bg_colorcCs|j�|d|d�S)z5
        Get the correct font for the style.
        rkZitalic)r"rl)r-r;rrr�_get_style_font�szImageFormatter._get_style_fontcCs$|�|�|j|�|d�|jfS)z.
        Get the required image size.
        r)r�rur�)r-�
maxlinelength�	maxlinenorrr�_get_image_size�s�zImageFormatter._get_image_sizecCs:|j|�|�t|��|j�|j�|j|j�|j	dd�dS)zA
        Remember a line number drawable to paint later.
        N��font�text_fg�text_bg)
�
_draw_textr��str�rjustr{r"rlr|r}ry)r-Zposnor�rrr�_draw_linenumber�s
��zImageFormatter._draw_linenumbercCs|j�|||||f�dS)zB
        Remember a single drawable tuple to paint later.
        N)r�r�)r-�posrir�r�r�rrrr��szImageFormatter._draw_textc
Csd}}}d}}|D]�\}}||jvr2|j}q |j|}	|�d�}|�d�}
t|
�D]�\}}|�d�}
|
r�|j|�||�|
|�|	�|�	|	�|�
|	�d�|j�|
�\}}||7}t
||�}|t|
�7}t
||�}|�d�rXd}d}|d7}qXq||_||_||_dS)z9
        Create drawables for the token content.
        r�T�
r�r�N)r\�parent�
expandtabsr7�	enumerate�rstripr�r�r�r�r�r"rj�max�lenrMr��	maxcharnor�)r-�tokensourcer�Zcharnor�r�r�Zttype�valuer;r>�ir?ZtempZ
temp_widthZ
temp_hightrrr�_create_drawables�s<





�


z ImageFormatter._create_drawablescCsB|js
dSt|j�D](}||j}||jdkr|�||�qdS)z8
        Create drawables for the line numbers.
        Nr)r��ranger�r�r�r�)r-�p�nrrr�_draw_line_numberss
z!ImageFormatter._draw_line_numberscCs~|js
dS|jdurdSt�|�}|jd}|j|j|j}|jd||fg|j	d�|j
rx|j|df||fg|jd�~dS)z@
        Paint the line number background on the image.
        N���)rr�r�r)r�ryr�Draw�sizerur�r~�	rectanglerzr�r?)r-�im�draw�recth�rectwrrr�_paint_line_number_bg$s


�z$ImageFormatter._paint_line_number_bgcCs:|�|�|��t�d|�|j|j�|j�}|�|�t	�
|�}|jr�|j|j
|jd}|��}|jd|}|jD]6}|�|d�}	|j||	f|||	|fg|jd�qz|jD]j\}
}}}
}|�r|j||d�}|j|
d|
d|
d|d|
d|dg|d�|j|
|||
d�q�|�||j���dS)a 
        Format ``tokensource``, an iterable of ``(tokentype, tokenstring)``
        tuples and write it into ``outfile``.

        This implementation calculates where it should draw each token on the
        pixmap, then calculates the required pixmap size and draws the items.
        ZRGBr�rr�)rir�)r�r�N)r�r�r�newr�r�r�r�r�rr�r�rur�r~r�r�r�r�r�r�ZtextsizeriZsaverp�upper)r-r�Zoutfiler�r��xr�r�Z
linenumber�yr�r�r�r�r�Z	text_sizerrr�format5s0
�


�6zImageFormatter.formatN)r)rrrrr:�aliases�	filenamesZ
unicodeoutputr�r.r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr
�s0m8



(r
c@s$eZdZdZdZdgZdgZdZdS)rz�
    Create a GIF image from source code. This uses the Python Imaging Library to
    generate a pixmap from the source code.

    .. versionadded:: 1.0
    Zimg_gifrrz*.gifN�rrrrr:r�r�r�rrrrrZs
rc@s&eZdZdZdZddgZdgZdZdS)rz�
    Create a JPEG image from source code. This uses the Python Imaging Library to
    generate a pixmap from the source code.

    .. versionadded:: 1.0
    Zimg_jpgZjpgrqz*.jpgNr�rrrrrhs
rc@s&eZdZdZdZddgZdgZdZdS)r
z�
    Create a bitmap image from source code. This uses the Python Imaging Library to
    generate a pixmap from the source code.

    .. versionadded:: 1.0
    Zimg_bmprsZbitmapz*.bmpNr�rrrrr
vs
r
) rrNr$Zpygments.formatterrZ
pygments.utilrrrrr3ZPILrrr	r��ImportErrorrX�winreg�__all__rDr+r'r)r�	Exceptionrrr
rrr
rrrr�<module>sH

�+u

Youez - 2016 - github.com/yon3zu
LinuXploit