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/builders/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/sphinx/builders/__pycache__/_epub_base.cpython-39.pyc
a

�ab�q�@s�dZddlZddlZddlZddlmZddlmZmZmZm	Z	m
Z
mZddlm
Z
mZmZddlmZddlmZmZddlmZdd	lmZdd
lmZmZddlmZddlmZm Z dd
l!m"Z"ddl#m$Z$ddl%m&Z&m'Z'zddl(m)Z)Wne*�ydZ)Yn0e�+e,�Z-dZ.dZ/dZ0dZ1dZ2dZ3ddd�Z4dddddddd d!d"d#�
Z5d$Z6e�7d%�Z8Gd&d'�d'e	�Z9Gd(d)�d)e	�Z:Gd*d+�d+e	�Z;Gd,d-�d-e	�Z<d4e=e=e=d/�d0d1�Z>e>Z?Gd2d3�d3e�Z@dS)5z�
    sphinx.builders._epub_base
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    Base class of epub2/epub3 builders.

    :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�path)�Any�Dict�List�
NamedTuple�Set�Tuple)�ZIP_DEFLATED�
ZIP_STORED�ZipFile)�nodes)�Element�Node)�smartquotes)�addnodes)�	BuildInfo�StandaloneHTMLBuilder)�__)�logging�status_iterator)�copy_asset_file)�format_date)�copyfile�	ensuredir)�Imagezepub-cover.xhtmlztoctree-l%dz
 [%(uri)s]z#%dZ	Footnoteszlink-targetzTable of ContentsZCover)�toc�coverzapplication/xhtml+xmlztext/css�	image/png�	image/gif�
image/svg+xml�
image/jpegzapplication/x-font-otfzapplication/x-font-ttfzapplication/font-woff)
�.xhtmlz.cssz.pngz.gif�.svgz.jpgz.jpegz.otfz.ttfz.woff)r"z
([^#:]*#)(.*)c@s&eZdZUeed<eed<eed<dS)�ManifestItemZhref�idZ
media_typeN��__name__�
__module__�__qualname__�str�__annotations__�r+r+�>/usr/lib/python3.9/site-packages/sphinx/builders/_epub_base.pyr#Ts
r#c@seZdZUeed<eed<dS)�SpineZidrefZlinearN)r&r'r(r)r*�boolr+r+r+r,r-Zs
r-c@s&eZdZUeed<eed<eed<dS)�Guide�type�title�uriNr%r+r+r+r,r/_s
r/c@s:eZdZUeed<eed<eed<eed<eeed<dS)�NavPoint�navpoint�	playorder�text�refuri�childrenN)r&r'r(r)r*�intrrr+r+r+r,r3es

r3�en)�t�language�returncCs2|�dd�}t�|�}t�||�}|�dd�}|S)Nz&quot;�")�replacerZeducateDashesOldSchoolZ
educateQuotes)r;r<r+r+r,�sphinx_smarty_pantsns

r@cs�eZdZdZdZgd�ZdZdZdZdZ	dZ
dZdZe
ZeZeZeZeZeZeZdZdZdd��fdd	�Zed�d
d�Ze e!e"fd�dd
�Z#e!e!d�dd�Z$e%e&e"e!e'fe&e"e!e'fd�dd�Z(e&e"e!e'fdd�dd�Z)dd�dd�Z*e&e"e!e'fdd�dd�Z+e!e!e!d�dd�Z,e-j.dd�d d!�Z/dNe-j.e!dd#�d$d%�Z0e!e-j.dd&��fd'd(�Z1e&e e!e&e e!e'ffdd�d)d*�Z2e!e3d+�d,d-�Z4dd�d.d/�Z5dd��fd0d1�Z6dd�d2d3�Z7dOe!e"e!e!e'dd5��fd6d7�
Z8dd�d8d9�Z9dPe!dd;�d<d=�Z:e"e!e'fd�d>d?�Z;dd�d@dA�Z<dQe"e!e'fe=e3e>dB�dCdD�Z?e&e"e!e'fe&e>d�dEdF�Z@e=e&e>e"e!e'fdG�dHdI�ZAdd�dJdK�ZBdd�dLdM�ZC�ZDS)R�EpubBuilderz�
    Builder that outputs epub files.

    It creates the metainfo files container.opf, toc.ncx, mimetype, and
    META-INF/container.xml.  Afterwards, all necessary files are zipped to an
    epub file.
    F)rrrr T�N)r=cs@t���d|_d|_d|_d|_i|_|�dd�|_g|_	dS)Nr!r�	use_index�epub)
�super�init�
out_suffixZlink_suffixr5�tocid�id_cacheZget_builder_configrC�refnodes��self��	__class__r+r,rF�s
zEpubBuilder.initcCst|j|jddg�S)N�htmlrD)r�config�tagsrKr+r+r,�create_build_info�szEpubBuilder.create_build_infocCs|jj|jjfS�N)rPZ
epub_themeZepub_theme_optionsrKr+r+r,�get_theme_config�szEpubBuilder.get_theme_config)�namer=cCs.|j�|�}|s*d|j�d�}||j|<|S)zReturn a unique id for name.zepub-%drD)rI�get�envZnew_serialno)rLrUr$r+r+r,�make_id�s

zEpubBuilder.make_id)�doctree�resultr=c
Cs�t|tj�r�|�d�r�|d}|�d�sF|�d�sF|�d�sF|�d�rJ|S|jjd}tddd	�D]<}|j||vrb|�	|t
�|�tt
�|�
���d
��q�qbn"t|tj�r�|D]}|�||�}q�|S)z>Collect section titles, their depth in the toc and the refuri.r7zhttp://zhttps://zirc:zmailto:�classes�r�����levelr7r6)�
isinstancer�	referencerV�
startswith�parentZ
attributes�range�toctree_template�appendrO�escape�ssp�astextr
�get_refnodes)rLrYrZr7r[r_�elemr+r+r,rj�s*���zEpubBuilder.get_refnodes)rr=cCsJt�}|D]:}|d|vr6tjtd�|dddd�q
|�|d�q
dS)Nr7zduplicated ToC entry found: %srDZduplicated_toc_entry�r0Zsubtype)�set�logger�warningr�add)rLrZappeared�noder+r+r,�check_refnodes�s�zEpubBuilder.check_refnodescCsl|jj|jj|ddd�}|�|g�|_t�|jj�}|r\|d7}|jD]}||d|d<qF|�|j�dS)zwGet the total table of contents, containing the root_doc
        and pre and post files not managed by sphinx.
        FT�Zprune_toctreesZ
includehidden�/r7N)	rW�get_and_resolve_doctreerP�root_docrjrJr�dirname�
toc_add_files)rLrYZ
master_dir�itemr+r+r,�get_toc�s�
zEpubBuilder.get_toc)rJr=c
Cs�|�ddt�|jj|j�tt�|jj|jj�	���d��t
|jj�D],\}}|�ddt�|�tt�|��d��qJ|jjD]*\}}|�
dt�|�tt�|��d��q�dS)zDAdd the root_doc, pre and post files to a list of refnodes.
        r�r^N)�insertrOrgrPrvrGrhrWZtitlesri�reversedZepub_pre_filesZepub_post_filesrf)rLrJ�filer6r+r+r,rx�s&���
�zEpubBuilder.toc_add_files)�prefix�fragmentr=cCs||�dd�S)z;Return a href/id attribute with colons replaced by hyphens.�:�-)r?)rLrr�r+r+r,�fix_fragmentszEpubBuilder.fix_fragment��treer=cs�tdd��fdd�}|�tj�D]X}d|vr\�j�|d�}|r\��|�d�|�d��|d<d|vr ��d	|d�|d<q |�tj�D],}||�|j	d
d�}t
|tj�r�||�q�|�tj�D]}||�q�dS)z�Replace colons with hyphens in href and id attributes.

        Some readers crash because they interpret the part as a
        transport protocol specification.
        N)rqr=cs<g}|dD]"}��d|�}||vr|�|�q||d<dS)zUpdate IDs of given *node*.�idsrBN)r�rf)rqZnew_idsZnode_idZnew_idrKr+r,�update_node_idsz+EpubBuilder.fix_ids.<locals>.update_node_idr7r{��refidrBT)Zascend)
r
�findallrra�	refuri_re�matchr��group�target�	next_noder`r�desc_signature)rLr�r�ra�mr�r�r�r+rKr,�fix_ids	s	
zEpubBuilder.fix_ids�inline)r��	show_urlsr=cCs�tjttjd�dd�}tjtttjd�dd�}tjtttfd�dd	�}|d
krTdS|dkr|t|�	tj��}||�\}}d
}	t
|�	tj��D�]}
|
�dd�}|�
d�s�|�
d�s�|�
d�r�||
��vr�|
j�|
�d
}|dk�r|jd|i}t�||�}
|
d�|j�|
j�||
�q�|dkr�t|	}|	d
7}	|||�}|
j�||�||||�}|�||�|dd|d<|�|dd�|d
7}q�dS)z+Add visible link targets for external links)�doc�labelr=cSs(t�d�}|�t�|��|�|�|S)z.Create a footnote_reference node with childrenz[#]_)r�footnote_referencerf�TextZnote_autofootnote_ref)r�r��footnote_refr+r+r,�make_footnote_ref-s

z8EpubBuilder.add_visible_links.<locals>.make_footnote_ref)r�r�r2r=cSsNt�|�}t��}|�t�|��|�|�|�dt�d|��|�|�|S)z$Create a footnote node with childrenrrB)r�footnoteZ	paragraphrfr�r|r�Znote_autofootnote)r�r�r2r�Zparar+r+r,�
make_footnote4s


z4EpubBuilder.add_visible_links.<locals>.make_footnoter�cSs�t|�tj��}|r2|d}|j|j�|�dfS|�tj�D]6}t|�dkr>|��t	kr>|j|j�|�dfSq>t
|�tj��}t��}|�t�
t	��|�|�||�|�dfS)zfFind or create a spot to place footnotes.

            The function returns the tuple (parent, index).r]r{)�listr�rr�rc�indexZrubric�lenri�FOOTNOTES_RUBRIC_NAME�next�documentrfr�)r�Zfns�fnrqr�Zrubr+r+r,�
footnote_spot>s
z4EpubBuilder.add_visible_links.<locals>.footnote_spot�noNr�r{r7rBzhttp:zhttps:zftp:r�r2r[r�rr�)rr�r)r�r�rr
r9r�r�r�rarVrbrircr��link_target_templater�rf�css_link_target_classr|�FOOTNOTE_LABEL_TEMPLATEZadd_backref)rLr�r�r�r�r�r�Zfn_spotZfn_idx�nrrqr2�idx�linkr�r�r�r+r+r,�add_visible_links*s@
�
�

zEpubBuilder.add_visible_links)�docnamerYr=cs,|�|�|�||jj�t��||�dS)z�Write one document file.

        This method is overwritten in order to fix fragment identifiers
        and to add visible external links.
        N)r�r�rPZepub_show_urlsrE�	write_doc)rLr�rYrMr+r,r�ns
zEpubBuilder.write_docc
Cs�|D]�\}}|D]�\}\}}}t|�D]<\}\}}	|j�|	�}
|
r&||�|
�d�|
�d��f||<q&|D]N\}}t|�D]<\}\}}	|j�|	�}
|
rx||�|
�d�|
�d��f||<qxqhqqdS)z'Fix href attributes for genindex pages.r{r�N)�	enumerater�r�r�r�)
rLr�Z_key�columnsZ
_entrynameZlinksZsubitems�iZismainr�r�Z
_subentrynameZ
subentrylinksr+r+r,�fix_genindexxs�
�zEpubBuilder.fix_genindex)�filenamer=cCst�|�d}|tvS)z=Does the filename extension indicate a vector graphic format?r])r�splitext�VECTOR_GRAPHICS_EXTENSIONS)rLr��extr+r+r,�is_vector_graphics�szEpubBuilder.is_vector_graphicsc	Cs�tt�|j|j��t|jtd�dt|j�|j	j
�D�]�}|j|}zt�t�|j
|��}Wn�ty�|�|�s�t�td�t�|j
|��z&tt�|j
|�t�|j|j|��Wn@ty�}z(t�td�t�|j
|�|�WYd}~n
d}~00Yq4Yn0|jj�r|jdv�r|��}|jjdk�rf|j\}}|jj}||k�rf|||}|�||ftj�}z|�t�|j|j|��Wq4t�y�}z(t�td�t�|j
|�|�WYd}~q4d}~00q4dS)	z�Copy images using Pillow, the Python Imaging Library.
        The method tries to read and write the files with Pillow, converting
        the format and resizing the image if necessary/possible.
        zcopying images... Zbrownz-cannot read image file %r: copying it insteadzcannot copy image file %r: %sN)�Przcannot write image file %r: %s)rr�join�outdirZimagedirr�imagesrr�Zapp�	verbosityr�openZsrcdir�OSErrorr�rnrorrP�epub_fix_images�modeZconvert�epub_max_image_width�sizeZresizeZBICUBICZsave)	rL�src�destZimg�err�widthZheightZnwZnhr+r+r,�copy_image_files_pil�sH�



��
�




�z EpubBuilder.copy_image_files_pilcsL|jrH|jjs|jjr>ts4t�td��t��	�qH|�
�n
t��	�dS)zzCopy image files to destination directory.
        This overwritten method can use Pillow to convert image files.
        z&Pillow not found - copying image filesN)r�rPr�r�rrnrorrE�copy_image_filesr�rKrMr+r,r��s
zEpubBuilder.copy_image_filescCsdSrSr+rKr+r+r,�copy_download_files�szEpubBuilder.copy_download_files�	page.html)�pagename�addctx�templatename�outfilename�	event_argr=csL|�d�r*d|vr*|jsdS|�|d�|j|d<t��|||||�dS)z�Create a rendered page.

        This method is overwritten for genindex pages in order to fix href link
        attributes.
        �genindexZgenindexentriesN�doctype)rbrCr�r�rE�handle_page)rLr�r�r�r�r�rMr+r,r��s
zEpubBuilder.handle_pagecCs(t�td��tt�|jd�|j�dS)z!Write the metainfo file mimetype.zwriting mimetype file...�mimetypeN)rn�inforrrr��template_dirr�rKr+r+r,�build_mimetype�szEpubBuilder.build_mimetype�META-INF/container.xml)�outnamer=cCs<t�td��t�|jd�}t|�tt�|jd�|�dS)z/Write the metainfo file META-INF/container.xml.z&writing META-INF/container.xml file...zMETA-INFz
container.xmlN)	rnr�rrr�r�rrr�)rLr�r�r+r+r,�build_container�szEpubBuilder.build_containercCs�i}t�|jj�|d<t�|jj�|d<t�|jj�|d<t�|jj�|d<t�|jj�|d<t�|jj�|d<t�|jj	�|d<t�|jj
�|d<t�td	��|d
<g|d<g|d<g|d
<|S)zaCreate a dictionary with all metadata for the content.opf
        file properly escaped.
        r1Zauthor�uid�langZ	publisher�	copyright�schemer$z%Y-%m-%d�date�manifest_items�spines�guides)rOrgrP�
epub_titleZepub_author�epub_uidZ
epub_languageZepub_publisherZepub_copyrightZepub_schemeZepub_identifierr)rL�metadatar+r+r,�content_metadata�szEpubBuilder.content_metadatacCs�t�td��|��}|j�tj�s4|jtj7_t|j�}g|_	dddddddd	d
|j
jdg
|j
j|_
|js�|j
�d|j�t�|j�D]�\}}}|��t|�D]�}t�||�|d
�}||j
vr�q�t�|�d}||jv�r
|dvr�tjtd�|ddd�q�|�tjd�}tt�|�t�|�|��t�|j|��}	|d�|	�|j	�|�q�q�t�}
|jD]b}d|dv�r��ql|d|j
v�r��qlt t�|�|d��d�}|d�|�|
�!|d��ql|j"D]H}
t t�|�|
d|j��d�}|d�|�|
�!|
d|j��q�|j�rbt t�|�d|j��d�}|d�|�|
�!d|j�|j	D]B}||
v�rh|�|j��rht t�|�|��d�}|d�|��qhd
}|j
j#�r�|j
j#\}}|�tjd�}t�|�|��|d<|�r�t t�|�|j$��d�}|d�%d|�|j$|j	v�r~t�|j$�d}|j	�|j$�tt�|j$�t�|�|j$��t�|j|��}	|d�|	�t�|�|j
j&d�}|�'t�|j$�d||�|
�!|j$�d}d}|j
j(�rJ|j
j(D]v\}}}|�)d�d}||j	v�r|j	�|�|dk�rd}|dk�rd}|d�t*t�|�t�|�t�|����q�|�rz|�rz|d�t*d|j+dt�|j$���|�r�|j�r�|d�t*d|j+dt�|jdd���t,t�|j-d �|j|�d
S)!z�Write the metainfo file content.opf It contains bibliographic data,
        a file list and the spine (the reading order).
        zwriting content.opf file...z
.buildinfor��content.opf�toc.ncxr�z	Thumbs.dbzehthumbs.dbz	.DS_Storez	nav.xhtml�.epubr�Nr])z.jsz.xmlz!unknown mimetype for %s, ignoringrDZunknown_project_filesrlrtr��#r7Tr�rFr)�imager1rr�z
content.opf_t).rnr�rr�r��endswith�os�sepr��filesrP�
epub_basenameZepub_exclude_files�
ignored_filesrCrfrG�walk�sort�sortedrr�r��media_typesror?r#rOrgrXrmrJr-rpZdomain_indicesZ
epub_cover�coverpage_namer|Zprojectr�Z
epub_guide�splitr/�guide_titlesrr�)rLr�Zolen�root�dirsr�r�r�r�ryZ
spinefilesZrefnodeZspiner�rUZ	html_tmplr��ctxZauto_add_coverZauto_add_tocr0r2r1r~r+r+r,�
build_content�s�
��
�
�

 

��


�

��zEpubBuilder.build_content)rqr_�incrr=cCs@|r|jd7_|jd7_td|j|j|d|dg�S)z;Create a new entry in the toc from the node at given level.r{z
navPoint%dr6r7)r5rHr3)rLrqr_r�r+r+r,�new_navpointcs�zEpubBuilder.new_navpointcCsxg}|�tddddg��d}d}|D�]D}|ds6q&|d�d�d}||jvrTq&|d|jjkrfq&|d|kr�|�||�}|��|d	j�|�|�|�n�|d|d
k�r
|d
7}|r�|jj	r�|d	j�|�||d��|�||�}|d	j�|�|�|�n^|d|k�rf|dt
|�k�r6|���q|d}|�||�}|d	j�|�|�|�n�|}q&|djS)z�Create the toc navigation structure.

        Subelements of a node are nested inside the navpoint.  For nested nodes
        the parent node is reinserted in the subnav.
        ZdummyrrBNr6r7r�r_r]r{F)rfr3r�r�rP�
epub_tocdepthr��popr8Zepub_tocdupr�)rLrZnavstackr_Zlastnoderqr~r4r+r+r,�build_navpointslsD

zEpubBuilder.build_navpoints)r_�	navpointsr=cCs6i}|jj|d<t�|jj�|d<||d<||d<|S)z]Create a dictionary with all metadata for the toc.ncx file
        properly escaped.
        r�r1r_r)rPr�rOrgr�)rLr_rr�r+r+r,�toc_metadata�szEpubBuilder.toc_metadatacCs�t�td��|jjdkrJ|jj|jj|ddd�}|�|g�}|�	|�n|j
}|�|�|�|�}t
dd�|j
D��}t||jj�}tt�|jd�|j|�||��dS)	z Write the metainfo file toc.ncx.zwriting toc.ncx file...�defaultFrscss|]}|dVqdS)r_Nr+)�.0ryr+r+r,�	<genexpr>��z(EpubBuilder.build_toc.<locals>.<genexpr>z	toc.ncx_tN)rnr�rrPZ
epub_tocscoperWrurvrjrxrJrrr�max�minr�rrr�r�r�r)rLrYrJrr_r+r+r,�	build_toc�s �


�zEpubBuilder.build_toccCs�|jjd}t�td�|�t�|j|�}t|dt	��n}|�
t�|jd�dt�dD]}|�
t�|j|�|t	�qT|jD]}|�
t�|j|�|t	�qxWd�n1s�0YdS)z~Write the epub file.

        It is a zip file with the mimetype file stored uncompressed as the first
        entry.
        r�zwriting %s file...�wr�)r�r�r�N)
rPr�rnr�rrr�r�rr	�writer
r�)rLr�Z
epub_filenamerDr�r+r+r,�
build_epub�s
zEpubBuilder.build_epub)r�)r�NN)r�)T)Er&r'r(�__doc__Z
copysourceZsupported_image_typesZsupported_remote_imagesZadd_permalinksZallow_sharp_as_current_pathZembeddedZdownload_supportZhtml_scaled_image_link�search�COVERPAGE_NAMEr��TOCTREE_TEMPLATEre�LINK_TARGET_TEMPLATEr��CSS_LINK_TARGET_CLASSr��GUIDE_TITLESr��MEDIA_TYPESr��	REFURI_REr�r�r�rFrrRrr)rrTrXrrrrjrrrzrxr�rr�r�r�r�r�r.r�r�r�r�r�r�r�r�r�r9r3r�rrr	r�
__classcell__r+r+rMr,rA{sd		*
!D
('��o	 ,rA)r:)Ar
rOr��rer�typingrrrrrr�zipfiler	r
rZdocutilsrZdocutils.nodesr
rZdocutils.utilsrZsphinxrZsphinx.builders.htmlrrZ
sphinx.localerZsphinx.utilrrZsphinx.util.fileutilrZsphinx.util.i18nrZsphinx.util.osutilrrZPILr�ImportErrorZ	getLoggerr&rnrrrr�r�rrrr��compilerr#r-r/r3r)r@rhrAr+r+r+r,�<module>sd
 

	��

	

Youez - 2016 - github.com/yon3zu
LinuXploit