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

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

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

�ab$O�@s�UdZddlZddlZddlmZddlmZddlmZddlmZddl	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZddlZddlmZdd	lmZdd
lmZmZmZddlmZm Z m!Z!ddl"m#Z#dd
l$m%Z%m&Z&m'Z'ddl(m)Z)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0m1Z1ddl2m3Z3ddl4m5Z5e3�6e7�Z8e�9d�Z:e�rtddl;m<Z<ddl=m>Z>ddl?m@Z@e,�AejB�jCZDeE�ZFeeeeGd<eedd�dd��ZHeIeJd�dd�ZKeIeedd �d!d"�ZLeIeJd�d#d$�ZMeIe5dd%�d&d'�ZNeIdd�d(d)�ZOeeeJd*�d+d,�ZPeedd*�d-d.�ZQeedd*�d/d0�ZReedd�d1d2��ZSeeeIedd3�d4d5��ZTedZeeIedd3�d6d7��ZUGd8d9�d9�ZVGd:d;�d;eW�ZXGd<d=�d=eV�ZYGd>d?�d?�ZZGd@dA�dAe)�Z[GdBdC�dCe)�Z\eJd�dDdE�Z]ee%e'eddF�dGdH��Z^GdIdJ�dJe�Z_GdKdL�dLe�Z`GdMdN�dN�ZaGdOdP�dPea�ZbGdQdR�dRejc�ZdeDdSk�r~dTdU�Zeeee_edafeejgeGdV<d[eIeejgdW�dXdY�ZhdS)\z�
    sphinx.util.docutils
    ~~~~~~~~~~~~~~~~~~~~

    Utility functions for docutils.

    :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�contextmanager)�copy)�path)�
ModuleType)�IO�
TYPE_CHECKING�Any�Callable�Dict�	Generator�List�Optional�Set�Tuple�Type�cast)�nodes)�
FileOutput)�Element�Node�system_message)�	Directive�
directives�roles)�Inliner)�State�StateMachine�
StringList)�Reporter�unescape)�version)�SphinxError)�_�__)�logging)�RoleFunctionz>^(.+?:(?:\d+)?): \((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\d+)?\) )�Builder)�Config)�BuildEnvironment�additional_nodes)NNN��returnc
cs~zJttj�}ttj�}dVW|t_|t_tt�D]}t|�t�|�q2n.|t_|t_tt�D]}t|�t�|�q`0dS)z"Create namespace for reST parsers.N)	rr�_directivesr�_roles�listr)�unregister_node�discard)r,r-�node�r2�8/usr/lib/python3.9/site-packages/sphinx/util/docutils.py�docutils_namespace0s

�r4)�namer+cCs
|tjvS)z1Check the *name* directive is already registered.)rr,�r5r2r2r3�is_directive_registeredAsr7)r5�	directiver+cCst�||�dS)z�Register a directive to docutils.

    This modifies global state of docutils.  So it is better to use this
    inside ``docutils_namespace()`` to prevent side-effects.
    N)r�register_directive)r5r8r2r2r3r9Fsr9cCs
|tjvS)z,Check the *name* role is already registered.)rr-r6r2r2r3�is_role_registeredOsr:)r5�roler+cCst�||�dS)z�Register a role to docutils.

    This modifies global state of docutils.  So it is better to use this
    inside ``docutils_namespace()`` to prevent side-effects.
    N)rZregister_local_role)r5r;r2r2r3�
register_roleTsr<cCstj�|d�dS)z Unregister a role from docutils.N)rr-�popr6r2r2r3�unregister_role]sr>�r1r+cCsttjd|j�S)z'Check the *node* is already registered.�visit_)�hasattrr�GenericNodeVisitor�__name__�r1r2r2r3�is_node_registeredbsrEcCs.ttjd|j�s*t�|jg�t�|�dS)z�Register a node to docutils.

    This modifies global state of some visitors.  So it is better to use this
    inside ``docutils_namespace()`` to prevent side-effects.
    r@N)rArrBrCZ_add_node_class_namesr)�addrDr2r2r3�
register_nodegsrGcCs^ttjd|j�rZttjd|j�ttjd|j�ttjd|j�ttjd|j�dS)zaUnregister a node from docutils.

    This is inverse of ``nodes._add_nodes_class_names()``.
    r@Zdepart_N)rArrBrC�delattrZSparseNodeVisitorrDr2r2r3r/rs
r/c#sNddlm�dtttd��fdd�
}z|tj_dVW�tj_n
�tj_0dS)z�Patch docutils.languages.get_language() temporarily.

    This ignores the second argument ``reporter`` to suppress warnings.
    refs: https://github.com/sphinx-doc/sphinx/issues/3788
    r��get_languageN)�
language_code�reporterr+cs�|�S�Nr2)rKrLrIr2r3�patched_get_language�sz2patched_get_language.<locals>.patched_get_language)N)Zdocutils.languagesrJ�strrr�docutils�	languages)rNr2rIr3rN~srN)�confdirr+c
cs�zVtj�dd�}|r,t�t�|�d�tjd<dVW|durLtj�dd�q||tjd<n$|durptj�dd�n
|tjd<0dS)z?Let docutils know the location of ``docutils.conf`` for Sphinx.ZDOCUTILSCONFIGNz
docutils.conf)�os�environ�getr�join�abspathr=)rRZdocutilsconfigr2r2r3�using_user_docutils_conf�s�rXc	csXt��>t|��dVWd�n1s,0YWd�n1sJ0YdS)zPatch to docutils temporarily.N)rNrX)rRr2r2r3�patch_docutils�srYc@s�eZdZdZdd�dd�Zdd�dd�Zeeeedd�d	d
�Z	dd�dd�Z
dd�d
d�Zee
ejeeeeeefd�dd�Zee
eeeeeefd�dd�ZdS)�CustomReSTDispatcherz�Custom reST's mark-up dispatcher.

    This replaces docutils's directives and roles dispatch mechanism for reST parser
    by original one temporarily.
    Nr*cCsdd�|_dd�|_dS)NcWsdgfSrMr2��argsr2r2r3�<lambda>��z/CustomReSTDispatcher.__init__.<locals>.<lambda>cWsdgfSrMr2r[r2r2r3r]�r^)�directive_funcZ
roles_func��selfr2r2r3�__init__�s
zCustomReSTDispatcher.__init__cCs|��dSrM)�enabler`r2r2r3�	__enter__�szCustomReSTDispatcher.__enter__)�exc_type�	exc_value�	tracebackr+cCs|��dSrM)�disable)rarerfrgr2r2r3�__exit__�szCustomReSTDispatcher.__exit__cCs$tj|_tj|_|jt_|jt_dSrM)rr8r_rr;�	role_funcr`r2r2r3rc�szCustomReSTDispatcher.enablecCs|jt_|jt_dSrM)r_rr8rjrr;r`r2r2r3rh�szCustomReSTDispatcher.disable��directive_name�language_module�documentr+cCs|�|||�SrM)r_�rarlrmrnr2r2r3r8�szCustomReSTDispatcher.directive��	role_namerm�linenorLr+cCs|�||||�SrM)rj�rarqrmrrrLr2r2r3r;�szCustomReSTDispatcher.role)rC�
__module__�__qualname__�__doc__rbrdr�	ExceptionrrircrhrOrrrnrr
rrrr8�intrr%r;r2r2r2r3rZ�s��rZc@seZdZdS)�ElementLookupErrorN)rCrtrur2r2r2r3ry�srycs�eZdZdZddd��fdd�Zeeed�dd	�Zeee	j
eee
eeefd
��fdd�Zeeeeeeeefd
��fdd�Z�ZS)�sphinx_domainszcMonkey-patch directive and role dispatch, so that domain-specific
    markup takes precedence.
    r(N)�envr+cs||_t���dSrM)r{�superrb)rar{��	__class__r2r3rb�szsphinx_domains.__init__)�typer5r+cCs�|��}d|vrl|�dd�\}}||jjvrX|j�|�}t||�|�}|durj|gfSq�t�td�||�n4|jj	�
d�}|dur�t||�|�}|dur�|gfSt|j�d�|�|�}|dur�|gfSt�dS)ztLookup a markup element (directive or role), given its name which can
        be a full name (with domain).
        �:�Nz%unknown directive or role name: %s:%sZdefault_domainZstd)�lower�splitr{ZdomainsZ
get_domain�getattr�logger�warningr"�	temp_datarUry)rarr5Zdomain_name�domain�elementZ
def_domainr2r2r3�lookup_domain_element�s$
z$sphinx_domains.lookup_domain_elementrkcs6z|�d|�WSty0t��|||�YS0dS)Nr8)r�ryr|r8ror}r2r3r8�szsphinx_domains.directiverpc	s8z|�d|�WSty2t��||||�YS0dS)Nr;)r�ryr|r;rsr}r2r3r;szsphinx_domains.role)rCrtrurvrbrOrr�rrrnrr
rrrrr8rxrr%r;�
__classcell__r2r2r}r3rz�s��rzc@seZdZedd�dd�ZdS)�
WarningStreamN)�textr+cCsRt�|�}|s t�|�d��n.|��\}}}t�d|���}tj|||d�dS)Nz
���location)�	report_re�searchr�r��rstrip�groups�sub�log)rar��matchedr�r�level�messager2r2r3�write
s
zWarningStream.write)rCrtrurOr�r2r2r2r3r�	sr�csNeZdZeedd�dd��Zejejddfee	e	e
edd��fdd	�
Z�ZS)
�LoggingReporter)rLr+cCs||j|j|j|j|j�S)zACreate an instance of LoggingReporter from other reporter object.)�source�report_level�
halt_levelZ
debug_flag�
error_handler)�clsrLr2r2r3�
from_reporters�zLoggingReporter.from_reporterF�backslashreplaceN)r�r�r��debugr�r+cs(ttt��}t�j||||||d�dS)N)r�)rrr�r|rb)rar�r�r�r�r��streamr}r2r3rbs�zLoggingReporter.__init__)
rCrtru�classmethodrr�Z
WARNING_LEVELZSEVERE_LEVELrOrx�boolrbr�r2r2r}r3r�s��r�cs&eZdZdZdd��fdd�Z�ZS)�NullReporterz A dummy reporter; write nothing.Nr*cst��ddd�dS)Nr�i��)r|rbr`r}r2r3rb&szNullReporter.__init__)rCrtrurvrbr�r2r2r}r3r�#sr�cCstdkS)N)r�
r)�__version_info__r2r2r2r3�is_html5_writer_available*sr�)�state�contentr+ccsLz:|jjj}tgd�}||_|j|jj_dVW||jj_n||jj_0dS)z1Switch current source input of state temporarily.N)�memorL�get_source_and_linerZinput_lines)r�r�r��
state_machiner2r2r3�switch_source_input.s

r�cs<eZdZdZedd��fdd�Zeed��fdd�Z�ZS)	�SphinxFileOutputz#Better FileOutput class for Sphinx.N)�kwargsr+cs$|�dd�|_t�jfi|��dS)N�overwrite_if_changedF)r=r�r|rb)rar�r}r2r3rbCszSphinxFileOutput.__init__)�datar+cs�|jrx|jrxd|jvrx|jrxtj�|j�rxt|j|jd��.}|�	�|krZ|Wd�SWd�n1sn0Yt
��|�S)N�b)�encoding)Zdestination_pathZ	autoclose�moder�rSr�exists�openr��readr|r�)rar��fr}r2r3r�Gs��0zSphinxFileOutput.write)	rCrtrurvrrbrOr�r�r2r2r}r3r�@sr�c@sheZdZdZedd�dd��Zedd�dd��Zeee	fd�d	d
�Z
edd�d
d�Zed�dd�Z
dS)�SphinxDirectivez�A base class for Sphinx directives.

    This class provides helper methods for Sphinx directives.

    .. note:: The subclasses of this class might not work with docutils.
              This class is strongly coupled with Sphinx.
    r(r*cCs|jjjjS�z3Reference to the :class:`.BuildEnvironment` object.)r�rn�settingsr{r`r2r2r3r{[szSphinxDirective.envr'cCs|jjS�z)Reference to the :class:`.Config` object.�r{�configr`r2r2r3r�`szSphinxDirective.configcCs|j�|j�S)zGet source and line number.)r�r�rrr`r2r2r3�get_source_infoeszSphinxDirective.get_source_infoNr?cCs|��\|_|_dS)z'Set source and line number to the node.N�r�r��line�rar1r2r2r3�set_source_infoiszSphinxDirective.set_source_infocCsd�dd�|��D��S)�&Get current location info for logging.r�css|]}t|�VqdSrM�rO��.0�sr2r2r3�	<genexpr>or^z/SphinxDirective.get_location.<locals>.<genexpr>�rVr�r`r2r2r3�get_locationmszSphinxDirective.get_location)rCrtrurv�propertyr{r�rrOrxr�rr�r�r2r2r2r3r�Rsr�c@seZdZUdZeed<eed<eed<eed<eed<eed<e	eed<igfeeeeeee	ee
e	ee	efd	�d
d�Z
e
e	ee	efd�d
d�Zedd�dd��Zedd�dd��Zdee
eefd�dd�Zdeedd�dd�Zed�dd�ZdS) �
SphinxRolez�A base class for Sphinx roles.

    This class provides helper methods for Sphinx roles.

    .. note:: The subclasses of this class might not work with docutils.
              This class is strongly coupled with Sphinx.
    r5�rawtextr�rr�inliner�optionsr��r5r�r�rrr�r�r�r+cCsr||_t|�|_||_||_||_||_|r8|��|_n2|j	j
�dd�|_|js\|j	jj
|_|jsjtd��|��S)N�default_roler�zcannot determine default role!)r�rr�rrr�r�r�r�r5r{r�rUr�r�r!�run)rar5r�r�rrr�r�r�r2r2r3�__call__�s
zSphinxRole.__call__r*cCst�dSrM)�NotImplementedErrorr`r2r2r3r��szSphinxRole.runr(cCs|jjjjSr�)r�rnr�r{r`r2r2r3r{�szSphinxRole.envr'cCs|jjSr�r�r`r2r2r3r��szSphinxRole.configN)rrr+cCs|dur|j}|jj�|�SrM)rrr�rLr�)rarrr2r2r3r��szSphinxRole.get_source_info)r1rrr+cCs|�|�\|_|_dSrMr�)rar1rrr2r2r3r��szSphinxRole.set_source_infocCsd�dd�|��D��S)r�r�css|]}t|�VqdSrMr�r�r2r2r3r��r^z*SphinxRole.get_location.<locals>.<genexpr>r�r`r2r2r3r��szSphinxRole.get_location)N)N)rCrtrurvrO�__annotations__rxrr
rrrrr�r�r�r{r�r�r�r�r2r2r2r3r�rs*
�

�r�cs~eZdZUdZeed<eed<eed<eed<e�dej	�Z
igfeeeeee
eeeeeeefd��fdd	�
Z�ZS)
�
ReferenceRolez�A base class for reference roles.

    The reference roles can accept ``link title <target>`` style as a text for
    the role.  The parsed result; link title and target will be stored to
    ``self.title`` and ``self.target``.
    �has_explicit_title�disabled�title�targetz^(.+?)\s*(?<!\x00)<(.*?)>$r�c		sv|�d�|_|j�|�}|rDd|_t|�d��|_t|�d��|_nd|_t|�|_t|�|_t	��
|||||||�S)N�!Tr��F)�
startswithr��explicit_title_re�matchr�r�groupr�r�r|r�)	rar5r�r�rrr�r�r�r�r}r2r3r��s

zReferenceRole.__call__)rCrtrurvr�r�rO�re�compile�DOTALLr�rxrr
rrrrr�r�r2r2r}r3r��s
�

�r�csdeZdZdZejddd��fdd�Zedd��fdd	�Zedd��fd
d�Z	edd�dd
�Z
�ZS)�SphinxTranslatoraxA base class for Sphinx translators.

    This class adds a support for visitor/departure method for super node class
    if visitor/departure method for node class is not found.

    It also provides helper methods for Sphinx translators.

    .. note:: The subclasses of this class might not work with docutils.
              This class is strongly coupled with Sphinx.
    r&N)rn�builderr+cs&t��|�||_|j|_|j|_dSrM)r|rbr�r�r�)rarnr�r}r2r3rb�szSphinxTranslator.__init__r?cs@|jjD]&}t|d|jd�}|r||�q<qt��|�dS)z�
        Dispatch node to appropriate visitor method.
        The priority of visitor method is:

        1. ``self.visit_{node_class}()``
        2. ``self.visit_{super_node_class}()``
        3. ``self.unknown_visit()``
        zvisit_%sN)r~�__mro__r�rCr|�dispatch_visit�rar1Z
node_class�methodr}r2r3r��s	zSphinxTranslator.dispatch_visitcs@|jjD]&}t|d|jd�}|r||�q<qt��|�dS)z�
        Dispatch node to appropriate departure method.
        The priority of departure method is:

        1. ``self.depart_{node_class}()``
        2. ``self.depart_{super_node_class}()``
        3. ``self.unknown_departure()``
        z	depart_%sN)r~r�r�rCr|�dispatch_departurer�r}r2r3r��s	z#SphinxTranslator.dispatch_departurecCstjtd�||d�dS)Nzunknown node type: %rr�)r�r�r#r�r2r2r3�
unknown_visit
szSphinxTranslator.unknown_visit)rCrtrurvrrnrbrr�r�r�r�r2r2r}r3r��s
r�)r�cOst|j|i|���SrM)�iterZtraverse)rar\r�r2r2r3�findallsr��__document_cache__)�source_pathr�r+cCsTtdurtj�|�a|dur&ttj�}ddlm}|j|tj	|d�}|�
|d�|S)a&Return a new empty document object.  This is an alternative of docutils'.

    This is a simple wrapper for ``docutils.utils.new_document()``.  It
    caches the result of docutils' and use it on second call for instantiation.
    This makes an instantiation of document nodes much faster.
    Nr)�addnodes)r����)r�rPZutils�new_documentrr�Zsphinxr�rnrLZnote_source)r�r�r�rnr2r2r3r�s
r�)N)N)irvrSr��
contextlibrrr�typesr�typingrrrr	r
rrr
rrrrrPrZdocutils.iorZdocutils.nodesrrrZdocutils.parsers.rstrrrZdocutils.parsers.rst.statesrZdocutils.statemachinerrrZdocutils.utilsrrZ	packagingr Z
sphinx.errorsr!Z
sphinx.localer"r#Zsphinx.utilr$Zsphinx.util.typingr%Z	getLoggerrCr�r�r�Zsphinx.buildersr&Z
sphinx.configr'Zsphinx.environmentr(�parse�__version__�releaser��setr)r�r4rOr�r7r9r:r<r>rErGr/rNrXrYrZrwryrzr�r�r�r�r�r�r�r�r�ZNodeVisitorr�r�r�rnr�r2r2r2r3�<module>s~
8

		&6 B";


Youez - 2016 - github.com/yon3zu
LinuXploit