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 :  /tmp/calpy/weasyprint/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /tmp/calpy/weasyprint/__pycache__/document.cpython-311.pyc
�

Х=j�6��D�dZddlZddlZddlmZddlmZddlmZm	Z	ddl
mZmZddl
mZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%ddl&m'Z'ddl(m)Z)Gd�d��Z*Gd�d��Z+Gd�d��Z,dS)zDocument generation management.�N)�md5)�Path�)�CSS�DEFAULT_OPTIONS)�gather_anchors�make_page_bookmark_tree)�get_all_computed_styles)�CounterStyle)�TargetCollector)�	draw_page)�build_formatting_structure)�get_html_metadata)�get_image_from_uri)�
LayoutContext�layout_document)�PROGRESS_LOGGER)�Matrix)�VARIANTS�generate_pdf)�DocumentMetadata)�FontConfigurationc� �eZdZdZd�Zdd�ZdS)�PagezRepresents a single rendered page.

    Should be obtained from :attr:`Document.pages` but not
    instantiated directly.

    c�*������|_����|_�fd�dD��|_g|_g|_i|_dgi|_t�|j|j|j|j���|_
dS)Nc�<��i|]}|�jd|��j��S)�bleed_)�style�value)�.0�side�page_boxs  ��F/tmp/claude-1015/pip-target-jmvfl800/lib/python/weasyprint/document.py�
<dictcomp>z!Page.__init__.<locals>.<dictcomp>*s;���<�<�<��
�(�.��$���1�7�<�<�<�)�top�right�bottom�left)�margin_width�width�
margin_height�height�bleed�	bookmarks�links�anchors�formsr�	_page_box)�selfr"s `r#�__init__z
Page.__init__!s�����*�*�,�,��
��,�,�.�.���<�<�<�<�:�<�<�<��
������
�����B�Z��
��x���t�z�4�>�4�:�V�V�V�!����r%rc��|���5|�||���t|j|��ddd��dS#1swxYwYdS)z!Paint the page into the PDF file.��a�dN)�stacked�	transformr
r3)r4�stream�scales   r#�paintz
Page.paintSs���
�^�^�
�
�	.�	.����u���.�.�.��d�n�f�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s�-A�A�AN)r)�__name__�
__module__�__qualname__�__doc__r5r>�r%r#rrsB��������0"�0"�0"�d.�.�.�.�.�.r%rc�6�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	dS)	�	DiskCachez�Dict-like storing images content on disk.

    Bytestring values are stored on disk. Other lightweight Python objects
    (i.e. RasterImage instances) are still stored in memory.

    c��t|��|_|j�dd���i|_t	��|_dS)NT)�parents�exist_ok)r�_path�mkdir�
_memory_cache�set�_disk_paths)r4�folders  r#r5zDiskCache.__init__bsD���&�\�\��
��
������5�5�5�����5�5����r%c��t|���d������}|j|zS)NF)�usedforsecurity)r�encode�	hexdigestrI)r4�key�digests   r#�_path_from_keyzDiskCache._path_from_keyhs5���S�Z�Z�\�\�5�9�9�9�C�C�E�E���z�F�"�"r%c�|�||jvr
|j|S|�|�����S�N)rKrU�
read_bytes�r4rSs  r#�__getitem__zDiskCache.__getitem__ls>���$�$�$�$��%�c�*�*��&�&�s�+�+�6�6�8�8�8r%c���t|t��rF|�|��}|j�|��|�|��dS||j|<dSrW)�
isinstance�bytesrUrM�add�write_bytesrK)r4rSr�paths    r#�__setitem__zDiskCache.__setitem__rsk���e�U�#�#�	,��&�&�s�+�+�D��� � ��&�&�&����U�#�#�#�#�#�&+�D��s�#�#�#r%c�b�||jvp&|�|�����SrW)rKrU�existsrYs  r#�__contains__zDiskCache.__contains__zs4���4�%�%�
.�����$�$�+�+�-�-�	/r%c��	|jD]}|�d����|j���dS#t$rYdSwxYw)NT)�
missing_ok)rM�unlinkrI�rmdir�	Exception)r4r`s  r#�__del__zDiskCache.__del__sl��	��(�
-�
-�����t��,�,�,�,��J����������	�	�	��D�D�	���s�9=�
A�
AN)
r?r@rArBr5rUrZrardrjrCr%r#rErEZsx��������!�!�!�#�#�#�9�9�9�,�,�,�/�/�/�
����r%rEc�\�eZdZdZed���Zed���Zd�Zdd�Zd
d	�Z	dd�Z
d
S)�Documenta�A rendered document ready to be painted in a pydyf stream.

    Typically obtained from :meth:`HTML.render() <weasyprint.HTML.render>`, but
    can also be instantiated directly with a list of :class:`pages <Page>`, a
    set of :class:`metadata <DocumentMetadata>`, a :class:`url_fetcher
    <weasyprint.urls.URLFetcher>`, and a :class:`font_config
    <weasyprint.text.fonts.FontConfiguration>`.

    c
��t��}g}g}g}	|d}
|
�i}
n+t|
ttf��st|
��}
|dpgD]@}t	|d��st||j|||���}|	�|���At||	|d|||||||d�
�
}tj
t|
|j|���}
tjd��t||
|||��}|S)	N�cache�stylesheets�matcher)�guess�
media_type�font_config�
counter_style�color_profiles�presentational_hints�	pdf_forms)rn�url_fetcher�optionsz&Step 4 - Creating formatting structure)rr\�dictrE�hasattrrrr�appendr
�	functools�partial�original_get_image_from_urirxr�infor)�cls�htmlrsrtrury�target_collector�
page_rules�layers�user_stylesheetsrn�css�	style_forr�contexts               r#�_build_layout_contextzDocument._build_layout_context�sR��+�,�,���
������� ���=��E�E��E�D�)�#4�5�5�	%��e�$�$�E��=�)�/�R�	)�	)�C��3�	�*�*�
3���$�/� +�=�#1�3�3�3��
�#�#�C�(�(�(�(�+��"�G�,B�$C�[��>�:�v�?O��K� �"�"�	�'�.�'�u��(�'�;�;�;��	��E�F�F�F���)�;�
������r%c
�2�|�t��}|�t��}|�i}|dx}rHt|\}}t|�����D]\}	}
|
�|	|vr||	||	<�|�|||||��}t
|j|j|j	|j
|j||j��}t|||��}
|d�|
D��tdit|����|j|||d��}||_|S)N�pdf_variantc�,�g|]}t|����SrC)r)r r"s  r#�
<listcomp>z$Document._render.<locals>.<listcomp>�s��7�7�7��T�(�^�^�7�7�7r%�
output_intentrC)rrr�tuple�itemsr�r�
etree_elementr�r�base_urlr��	footnotesrrrrx�_html)r�r�rsrtrury�variant�_�
propertiesrSrr��root_box�
page_boxes�	renderings               r#�_renderzDocument._render�sU����+�-�-�K�� �(�N�N�M��!��N��m�,�,�7�	3�$�W�-�M�A�z�#�G�M�M�O�O�4�4�
3�
3�
��U��=�S�J�%6�%6�#-�c�?�G�C�L���+�+��+�}�n�g�G�G��.���� 1�7�3M��M�7�3�]������
%�T�8�W�=�=�
��C�7�7�J�7�7�7��7�7�0��6�6�7�7���k�>�7�?�;S�U�U�	��	���r%c�h�||_||_||_i|_||_||_||_dSrW)�pages�metadatarx�fontsrsrur�)r4r�r�rxrsrur�s       r#r5zDocument.__init__�sE����
�!��
�&�����
�
'���,���*����r%�allc���|dkr|j}n$t|t��st|��}t|��||j|j|j|j|j��S)aPTake a subset of the pages.

        :type pages: :term:`iterable`
        :param pages:
            An iterable of :class:`Page` objects from :attr:`pages`.
        :return:
            A new :class:`Document` object.

        Examples:

        Write two PDF files for odd-numbered and even-numbered pages::

            # Python lists count from 0 but pages are numbered from 1.
            # [::2] is a slice of even list indexes but odd-numbered pages.
            document.copy(document.pages[::2]).write_pdf('odd_pages.pdf')
            document.copy(document.pages[1::2]).write_pdf('even_pages.pdf')

        Combine multiple documents into one PDF file,
        using metadata from the first::

            all_pages = [p for doc in documents for p in doc.pages]
            documents[0].copy(all_pages).write_pdf('combined.pdf')

        r�)	r�r\�list�typer�rxrsrur�)r4r�s  r#�copyz
Document.copy�si��2�E�>�>��J�E�E��E�4�(�(�	 ���K�K�E��t�D�z�z��4�=�$�"2�D�4D����!3�5�5�	5r%rFc	���g}g}|g}d}t|j��D]H\}}|rt|||j|z���}	nt||���}	t	||||||	��}�I|S)aEMake a tree of all bookmarks in the document.

        :param float scale:
            Zoom scale.
        :param bool transform_pages:
            A boolean defining whether the default PDF page transformation
            matrix has to be applied to bookmark coordinates, setting the
            bottom-left corner as the origin.
        :return: A list of bookmark subtrees.
            A subtree is ``(label, target, children, state)``. ``label`` is
            a string, ``target`` is ``(page_number, x, y)``  and ``children``
            is a list of child subtrees.

        r)r8r9�fr7)�	enumerater�rr-r	)
r4r=�transform_pages�root�skipped_levels�
last_by_depth�previous_level�page_number�page�matrixs
          r#�make_bookmark_treezDocument.make_bookmark_trees�����
����
���!*�4�:�!6�!6�	%�	%��K���
2��%�E�6�T�[�5�5H�I�I�I����%�5�1�1�1��4��n�m�^��V�%�%�N�N��r%Nc���tj��}|�|��|}|dx}rHt|\}}t	|�����D]\}	}
|
�|	|vr||	||	<�t
|||fi|��}|r|||��|d}|d}
|d}|�?tj��}|�	||||
��|�
��St|d��r|�	||||
��dSt|d��5}|�	||||
��ddd��dS#1swxYwYdS)a�Paint the pages in a PDF file, with metadata.

        :type target:
            :class:`str`, :class:`pathlib.Path` or :term:`file object`
        :param target:
            A filename where the PDF file is generated, a file object, or
            :obj:`None`.
        :param float zoom:
            The zoom factor in PDF units per CSS units.  **Warning**:
            All CSS units are affected, including physical units like
            ``cm`` and named sizes like ``A4``.  For values other than
            1, the physical CSS units will thus be "wrong".
        :type finisher: :term:`callable`
        :param finisher:
            A finisher function or callable that accepts the document and a
            :class:`pydyf.PDF` object as parameters. Can be passed to perform
            post-processing on the PDF right before the trailer is written.
        :param options:
            The ``options`` parameter includes by default the
            :data:`weasyprint.DEFAULT_OPTIONS` values.
        :returns:
            The PDF as :obj:`bytes` if ``target`` is not provided or
            :obj:`None`, otherwise :obj:`None` (the PDF is written to
            ``target``).

        r�N�pdf_identifier�uncompressed_pdf�pdf_version�write�wb)
rr��updaterr�r�r�io�BytesIOr��getvaluer{�open)r4�target�zoom�finisherry�new_optionsr�r�r�rSr�pdf�
identifier�compress�version�output�fds                 r#�	write_pdfzDocument.write_pdf/s���6&�*�,�,�����7�#�#�#����m�,�,�7�	3�$�W�-�M�A�z�#�G�M�M�O�O�4�4�
3�
3�
��U��=�S�J�%6�%6�#-�c�?�G�C�L���4���9�9��9�9���	 ��H�T�3�����-�.�
��1�2�2���-�(���>��Z�\�\�F��I�I�f�g�z�8�<�<�<��?�?�$�$�$��6�7�#�#�	=��I�I�f�g�z�8�<�<�<�<�<��f�d�#�#�
=�r��	�	�"�g�z�8�<�<�<�
=�
=�
=�
=�
=�
=�
=�
=�
=�
=�
=�
=����
=�
=�
=�
=�
=�
=s�.E�E�E)r�)rF)NrN)r?r@rArB�classmethodr�r�r5r�r�r�rCr%r#rlrl�s�������������[��>����[��B+�+�+�.5�5�5�5�B����B8=�8=�8=�8=�8=�8=r%rl)-rBr}r��hashlibr�pathlibr�rrr1rr	r�r
�css.countersr�css.targetsr�drawr
�formatting_structure.buildrr�r�imagesrr�layoutrr�loggerrr�rr�rr�pdf.metadatar�
text.fontsrrrErlrCr%r#�<module>r�s���%�%�����	�	�	�	�������������"�"�"�"�"�"�"�"�<�<�<�<�<�<�<�<�(�(�(�(�(�(�&�&�&�&�&�&�(�(�(�(�(�(�������B�B�B�B�B�B�#�#�#�#�#�#�E�E�E�E�E�E�2�2�2�2�2�2�2�2�#�#�#�#�#�#�������'�'�'�'�'�'�'�'�*�*�*�*�*�*�)�)�)�)�)�)�>.�>.�>.�>.�>.�>.�>.�>.�B,�,�,�,�,�,�,�,�^^=�^=�^=�^=�^=�^=�^=�^=�^=�^=r%

Youez - 2016 - github.com/yon3zu
LinuXploit